T
- the type of the items in the listpublic abstract class NodeList<T extends Serializable> extends NodeFeature
Should not be used directly, use one of the extending classes instead, which
provide a type safe API while ensuring the list is Serializable
.
For internal use only. May be renamed or removed in a future release.
Modifier and Type | Class and Description |
---|---|
protected static class |
NodeList.SetView<T extends Serializable>
|
Modifier | Constructor and Description |
---|---|
protected |
NodeList(StateNode node)
Creates a new list for the given node.
|
Modifier and Type | Method and Description |
---|---|
protected void |
add(int index,
T item)
Inserts an item at the given index of the list.
|
protected void |
add(T item)
Adds an item to the end of the list.
|
protected void |
addAll(Collection<? extends T> items)
Adds all provided items to the end of the list.
|
protected void |
clear()
Removes all nodes, including those not known by the server.
|
void |
collectChanges(Consumer<NodeChange> collector)
Collects all changes that are recorded for this feature.
|
void |
forEachChild(Consumer<StateNode> action)
Passes each child node instance to the given consumer.
|
void |
generateChangesFromEmpty()
Generates all changes that would be needed to take this node from its
initial empty state to its current state.
|
protected T |
get(int index)
Gets the item at the given index.
|
protected List<AbstractListChange<T>> |
getChangeTracker()
Gets or creates the list used to track changes that should be sent to the
client.
|
protected int |
indexOf(T value)
Gets the position of a value in the list.
|
protected boolean |
isNodeValues()
Checks whether this list contains node values.
|
protected Iterator<T> |
iterator()
Gets an iterator returning all items in this list.
|
void |
onDetach()
Called when the state node has been detached from the state tree.
|
protected T |
remove(int index)
Removes the item at the given index.
|
protected int |
size()
Gets the number of items in this list.
|
allowsChanges, attachPotentialChild, detatchPotentialChild, getNode, onAttach
protected NodeList(StateNode node)
node
- the node that the list belongs toprotected int size()
protected T get(int index)
index
- the of the desired itemprotected void add(T item)
item
- the item to addprotected void addAll(Collection<? extends T> items)
items
- a collection of items to add, not nullprotected void add(int index, T item)
index
- index to insert atitem
- the item to insertprotected T remove(int index)
index
- index of the item to removeprotected List<AbstractListChange<T>> getChangeTracker()
This method is non-private for testing purposes.
public void collectChanges(Consumer<NodeChange> collector)
NodeFeature
collectChanges
in class NodeFeature
collector
- a consumer accepting node changespublic void forEachChild(Consumer<StateNode> action)
NodeFeature
forEachChild
in class NodeFeature
action
- the consumer that accepts each childpublic void generateChangesFromEmpty()
NodeFeature
generateChangesFromEmpty
in class NodeFeature
protected boolean isNodeValues()
true
if this list contains node values;
false
if this list contains primitive valuesprotected void clear()
protected int indexOf(T value)
value
- the value to look forprotected Iterator<T> iterator()
public void onDetach()
NodeFeature
onDetach
in class NodeFeature
Copyright © 2023. All rights reserved.