Removes redundant underline functions.
@@ -863,55 +863,36 @@ public class AsciiString {
}
}
- /** Sets all characters to be underlined when being drawn. */
- public void setUnderlined(final boolean underline) {
- setUnderlined(new IntRange(0, characters.length));
- }
-
- /** Sets all characters to not be underlined when being drawn. */
- public void unUnderlineCharacters() {
- unUnderlineCharacters(new IntRange(0, characters.length));
- }
-
/**
- * Sets the specified range of characters to be underlined when being drawn.
+ * Sets all characters to either be underlined or not underlined when
+ * being drawn.
*
- * @param range
- * The x-axis (column) coordinates of the characters to begin/end the change between.
- * Includes the first index and excludes the last index.
+ * @param underline
+ * Whether or not the characters should be underlined.
*/
- public void setUnderlined(final IntRange range) {
- checkRangeValidity(range);
-
- final int beginIndex = range.getStart();
- final int endIndex = range.getEnd();
-
- for (int columnIndex = beginIndex ; columnIndex < endIndex ; columnIndex++) {
- if (characters[columnIndex].isUnderlined() == false) {
- charactersToBeRedrawn[columnIndex] = true;
- characters[columnIndex].setUnderlined(true);
- }
- }
+ public void setUnderlined(final boolean underline) {
+ setUnderlined(new IntRange(0, characters.length), underline);
}
/**
- * Sets the specified range of characters to not be underlined when being drawn.
+ * Sets the specified range of characters to be underlined when being drawn.
*
* @param range
* The x-axis (column) coordinates of the characters to begin/end the change between.
* Includes the first index and excludes the last index.
+ *
+ * @param underline
+ * Whether or not the characters should be underlined.
*/
- public void unUnderlineCharacters(final IntRange range) {
+ public void setUnderlined(final IntRange range, final boolean underline) {
checkRangeValidity(range);
final int beginIndex = range.getStart();
final int endIndex = range.getEnd();
for (int columnIndex = beginIndex ; columnIndex < endIndex ; columnIndex++) {
- if (characters[columnIndex].isUnderlined() == true) {
charactersToBeRedrawn[columnIndex] = true;
- characters[columnIndex].setUnderlined(false);
- }
+ characters[columnIndex].setUnderlined(underline);
}
}
}
\ No newline at end of file
