public class SimpleTextFormatter extends Object implements TextFormatter<SimpleTextTemplateApplier>
TextFormatter
backed by an
ArrayList
.Modifier and Type | Field and Description |
---|---|
protected List<SimpleTextTemplateApplier> |
parts |
Constructor and Description |
---|
SimpleTextFormatter()
Constructs an empty text formatter.
|
SimpleTextFormatter(int initialSize)
Constructs a new
SimpleTextFormatter with the specified amount
of initial TextTemplateApplier s. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Collection<SimpleTextTemplateApplier> elements)
Adds the specified elements to the end of this formatter.
|
boolean |
add(SimpleTextTemplateApplier element)
Adds the specified element to the end of this formatter.
|
void |
clear()
Clears all elements from this formatter.
|
boolean |
contains(SimpleTextTemplateApplier element)
Returns true if the specified element is in the formatter.
|
SimpleTextTemplateApplier |
get(int i)
Returns the element at the specified index.
|
ImmutableList<SimpleTextTemplateApplier> |
getAll()
Returns an
ImmutableList of this formatter's elements. |
void |
insert(int i,
Collection<SimpleTextTemplateApplier> elements)
Inserts the specified elements at the specified index within the
formatter.
|
void |
insert(int i,
SimpleTextTemplateApplier element)
Inserts the specified element at the specified index within the
formatter.
|
boolean |
isEmpty()
Returns true if the formatter contains no elements.
|
boolean |
remove(Collection<SimpleTextTemplateApplier> elements)
Removes the specified elements from the formatter.
|
boolean |
remove(SimpleTextTemplateApplier element)
Removes the specified element from the formatter.
|
boolean |
retain(Collection<SimpleTextTemplateApplier> elements)
Removes all elements from the formatter except for these specified
elements.
|
SimpleTextTemplateApplier |
set(int i,
SimpleTextTemplateApplier element)
Replaces the element previously at the specified index with the
specified element.
|
int |
size()
Returns the amount of elements in this formatter.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, add, first, firstAfter, forEach, forEachAfter, format, insert, insert, iterator, remove, remove, retain, retain, toText
applyTo
forEach, spliterator
protected final List<SimpleTextTemplateApplier> parts
public SimpleTextFormatter(int initialSize)
SimpleTextFormatter
with the specified amount
of initial TextTemplateApplier
s.initialSize
- Initial amount of Partspublic SimpleTextFormatter()
public ImmutableList<SimpleTextTemplateApplier> getAll()
TextFormatter
ImmutableList
of this formatter's elements.getAll
in interface TextFormatter<SimpleTextTemplateApplier>
public SimpleTextTemplateApplier get(int i)
TextFormatter
get
in interface TextFormatter<SimpleTextTemplateApplier>
i
- Index to retrieve frompublic SimpleTextTemplateApplier set(int i, SimpleTextTemplateApplier element)
TextFormatter
set
in interface TextFormatter<SimpleTextTemplateApplier>
i
- Index to replaceelement
- Element to replace withpublic int size()
TextFormatter
size
in interface TextFormatter<SimpleTextTemplateApplier>
public boolean isEmpty()
TextFormatter
isEmpty
in interface TextFormatter<SimpleTextTemplateApplier>
public boolean contains(SimpleTextTemplateApplier element)
TextFormatter
contains
in interface TextFormatter<SimpleTextTemplateApplier>
element
- Element to checkpublic void clear()
TextFormatter
clear
in interface TextFormatter<SimpleTextTemplateApplier>
public boolean add(SimpleTextTemplateApplier element)
TextFormatter
add
in interface TextFormatter<SimpleTextTemplateApplier>
element
- Element to addpublic boolean add(Collection<SimpleTextTemplateApplier> elements)
TextFormatter
add
in interface TextFormatter<SimpleTextTemplateApplier>
elements
- Elements to addpublic void insert(int i, SimpleTextTemplateApplier element)
TextFormatter
insert
in interface TextFormatter<SimpleTextTemplateApplier>
i
- Index to insert atelement
- Element to insertpublic void insert(int i, Collection<SimpleTextTemplateApplier> elements)
TextFormatter
insert
in interface TextFormatter<SimpleTextTemplateApplier>
i
- Index to insert atelements
- Elements to insertpublic boolean remove(SimpleTextTemplateApplier element)
TextFormatter
remove
in interface TextFormatter<SimpleTextTemplateApplier>
element
- Element to removepublic boolean remove(Collection<SimpleTextTemplateApplier> elements)
TextFormatter
remove
in interface TextFormatter<SimpleTextTemplateApplier>
elements
- Elements to removepublic boolean retain(Collection<SimpleTextTemplateApplier> elements)
TextFormatter
retain
in interface TextFormatter<SimpleTextTemplateApplier>
elements
- Elements to retain