Skip to content

Commit

Permalink
#198 Added private constants and javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriciofx committed Jan 26, 2018
1 parent e5e425d commit 04805e5
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/main/java/org/cactoos/text/AbbreviatedText.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -49,6 +59,9 @@ public final class AbbreviatedText implements Text {

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

/**
* Ctor.
*
* <p> 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
*/
Expand Down Expand Up @@ -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()
);
}
Expand Down

0 comments on commit 04805e5

Please sign in to comment.