public interface TextFormatter<E extends TextRepresentable> extends TextRepresentable, Iterable<E>
TextRepresentable
s which
are all concatenated to an empty Text
object on format()
.Modifier and Type | Method and Description |
---|---|
boolean |
add(Collection<E> elements)
Adds the specified elements to the end of this formatter.
|
boolean |
add(E element)
Adds the specified element to the end of this formatter.
|
default boolean |
add(Iterable<E> elements)
Adds the specified elements to the end of this formatter.
|
default boolean |
add(Iterator<E> elements)
Adds the specified elements to the end of this formatter.
|
void |
clear()
Clears all elements from this formatter.
|
boolean |
contains(E e)
Returns true if the specified element is in the formatter.
|
default <T extends TextRepresentable> |
first(Class<T> clazz)
Returns the first element of the specified type.
|
default <T extends TextRepresentable> |
firstAfter(int index,
Class<T> clazz)
Returns the first element of the specified type after the specified
index.
|
default <T extends TextRepresentable> |
forEach(Class<T> clazz,
Consumer<T> consumer)
Applies the specified consumer to each element of the specified type
after the specified index.
|
default <T extends TextRepresentable> |
forEachAfter(int index,
Class<T> clazz,
Consumer<T> consumer)
Applies the specified consumer to each element of the specified type
after the specified index.
|
default Text |
format()
Builds the result
Text for this formatter using the current
configuration of each element. |
E |
get(int i)
Returns the element at the specified index.
|
ImmutableList<E> |
getAll()
Returns an
ImmutableList of this formatter's elements. |
void |
insert(int i,
Collection<E> elements)
Inserts the specified elements at the specified index within the
formatter.
|
void |
insert(int i,
E element)
Inserts the specified element at the specified index within the
formatter.
|
default void |
insert(int i,
Iterable<E> elements)
Inserts the specified elements at the specified index within the
formatter.
|
default void |
insert(int i,
Iterator<E> elements)
Inserts the specified elements at the specified index within the
formatter.
|
boolean |
isEmpty()
Returns true if the formatter contains no elements.
|
default Iterator<E> |
iterator() |
boolean |
remove(Collection<E> elements)
Removes the specified elements from the formatter.
|
boolean |
remove(E element)
Removes the specified element from the formatter.
|
default boolean |
remove(Iterable<E> elements)
Removes the specified elements from the formatter.
|
default boolean |
remove(Iterator<E> elements)
Removes the specified elements from the formatter.
|
boolean |
retain(Collection<E> elements)
Removes all elements from the formatter except for these specified
elements.
|
default boolean |
retain(Iterable<E> elements)
Removes all elements from the formatter except for these specified
elements.
|
default boolean |
retain(Iterator<E> elements)
Removes all elements from the formatter except for these specified
elements.
|
E |
set(int i,
E e)
Replaces the element previously at the specified index with the
specified element.
|
int |
size()
Returns the amount of elements in this formatter.
|
default Text |
toText()
Gets the textual representation of this instance for its usage in other
Text objects. |
applyTo
forEach, spliterator
ImmutableList<E> getAll()
ImmutableList
of this formatter's elements.E get(int i)
i
- Index to retrieve fromdefault <T extends TextRepresentable> Optional<T> firstAfter(int index, Class<T> clazz)
T
- Type of TextRepresentableindex
- To start atclazz
- Class of typedefault <T extends TextRepresentable> Optional<T> first(Class<T> clazz)
T
- Type of TextRepresentable
clazz
- Type to getdefault <T extends TextRepresentable> void forEachAfter(int index, Class<T> clazz, Consumer<T> consumer)
T
- Typeindex
- Index to start atclazz
- Class of typeconsumer
- Consumerdefault <T extends TextRepresentable> void forEach(Class<T> clazz, Consumer<T> consumer)
T
- Typeclazz
- Class of typeconsumer
- ConsumerE set(int i, E e)
i
- Index to replacee
- Element to replace withint size()
boolean isEmpty()
boolean contains(E e)
e
- Element to checkvoid clear()
boolean add(E element)
element
- Element to addboolean add(Collection<E> elements)
elements
- Elements to adddefault boolean add(Iterable<E> elements)
elements
- Elements to adddefault boolean add(Iterator<E> elements)
elements
- Elements to addvoid insert(int i, E element)
i
- Index to insert atelement
- Element to insertvoid insert(int i, Collection<E> elements)
i
- Index to insert atelements
- Elements to insertdefault void insert(int i, Iterable<E> elements)
i
- Index to insert atelements
- Elements to insertdefault void insert(int i, Iterator<E> elements)
i
- Index to insert atelements
- Elements to insertboolean remove(E element)
element
- Element to removeboolean remove(Collection<E> elements)
elements
- Elements to removedefault boolean remove(Iterable<E> elements)
elements
- Elements to removedefault boolean remove(Iterator<E> elements)
elements
- Elements to removeboolean retain(Collection<E> elements)
elements
- Elements to retaindefault boolean retain(Iterable<E> elements)
elements
- Elements to retaindefault boolean retain(Iterator<E> elements)
elements
- Elements to retaindefault Text format()
Text
for this formatter using the current
configuration of each element. The result of each element is
concatenated to an empty Text
to yield the result.default Iterator<E> iterator()
iterator
in interface Iterable<E extends TextRepresentable>
default Text toText()
TextRepresentable
Text
objects. This may but does not need to include
hover texts
or other actions
. This
method is basically the toString()
equivalent
for Text
s.toText
in interface TextRepresentable