From 04805e56dc84f8ebcb666d79871999ae07ce6e73 Mon Sep 17 00:00:00 2001 From: Fabricio Cabral Date: Thu, 25 Jan 2018 14:20:26 -0300 Subject: [PATCH] #198 Added private constants and javadoc --- .../org/cactoos/text/AbbreviatedText.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/cactoos/text/AbbreviatedText.java b/src/main/java/org/cactoos/text/AbbreviatedText.java index 7ef9a92006..93e621a4a5 100644 --- a/src/main/java/org/cactoos/text/AbbreviatedText.java +++ b/src/main/java/org/cactoos/text/AbbreviatedText.java @@ -37,6 +37,16 @@ */ public final class AbbreviatedText implements Text { + /** + * The default max line width. + */ + private static final int MAX_WIDTH = 80; + + /** + * The ellipses width. + */ + private static final int ELLIPSES_WIDTH = 3; + /** * The origin Text. */ @@ -49,6 +59,9 @@ public final class AbbreviatedText implements Text { /** * Ctor. + * + *

By default, the max line width is 80 characters. + * * @param text The Text */ public AbbreviatedText(final String text) { @@ -57,15 +70,18 @@ public AbbreviatedText(final String text) { /** * Ctor. + * + *

By default, the max line width is 80 characters. + * * @param text The Text */ public AbbreviatedText(final Text text) { - // @checkstyle MagicNumber (1 line) - this(text, 80); + this(text, AbbreviatedText.MAX_WIDTH); } /** * Ctor. + * * @param text A String * @param max Max width of the result string */ @@ -94,8 +110,7 @@ public String asString() throws IOException { new SubText( this.origin, 0, - // @checkstyle MagicNumber (1 line) - this.width - 3 + this.width - AbbreviatedText.ELLIPSES_WIDTH ).asString() ); }