Package squidpony
Class ColoredStringList<T>
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<IColoredString<T>>,Collection<IColoredString<T>>,List<IColoredString<T>>,RandomAccess
public class ColoredStringList<T> extends ArrayList<IColoredString<T>>
An helper class for code that deals with lists of
IColoredStrings. It
does nothing smart, its only purpose is to save you some typing for frequent
calls. It is particularly useful when feeding large pieces of text to classes
like TextPanel in the display module.- Author:
- smelC
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ColoredStringList()ColoredStringList(int expectedSize) -
Method Summary
Modifier and Type Method Description voidaddAllText(Collection<? extends IColoredString<T>> texts)Contrary toCollection.addAll(Collection), this method appends text to the current text, without inserting new lines.voidaddColoredText(String text, T c)Appends colored text tothis.voidaddColoredTextOnNewLine(String text, T color)Appends colored text tothis.voidaddEmptyLine()Jumps a line.voidaddOnNewLine(Collection<? extends IColoredString<T>> texts)Addstextstothis, starting a new line for the first one.voidaddText(String text)Appendstexttothis, without specifying its color.voidaddText(IColoredString<T> text)Appendstexttothis.voidaddTextOnNewLine(String text)Appends text tothis, on a new line; without specifying its color.voidaddTextOnNewLine(IColoredString<T> text)static <T> ColoredStringList<T>create()static <T> ColoredStringList<T>create(int expectedSize)voidreplaceColor(T old, T new_)Changes a color in members ofthis.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Constructor Details
-
Method Details
-
create
- Returns:
- A fresh empty instance.
-
create
- Parameters:
expectedSize-- Returns:
- A fresh empty instance.
-
addText
Appendstexttothis, without specifying its color.- Parameters:
text- the text to append
-
addText
Appendstexttothis.- Parameters:
text- the text to append
-
addColoredText
Appends colored text tothis.- Parameters:
text- the text to append
-
addTextOnNewLine
Appends text tothis, on a new line; without specifying its color.- Parameters:
text- the text to append
-
addTextOnNewLine
-
addColoredTextOnNewLine
Appends colored text tothis.- Parameters:
text- the text to append
-
addOnNewLine
Addstextstothis, starting a new line for the first one.- Parameters:
texts- the Collection of objects extending IColoredString to append
-
addAllText
Contrary toCollection.addAll(Collection), this method appends text to the current text, without inserting new lines.- Parameters:
texts- the Collection of objects extending IColoredString to append
-
addEmptyLine
Jumps a line. -
replaceColor
Changes a color in members ofthis.- Parameters:
old- The color to replace. Can benull.
-