public final class StateCollection extends AbstractList<State>
Variable
.
Note that a continuous variable always has a single state.State
modCount
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
State item)
Inserts an element into the collection at the specified index.
|
void |
clear() |
boolean |
contains(Object o)
Determines whether a
State is in the collection. |
State |
findByValue(Object value)
Finds the state whose
value /> matches the given [value], or null if a match is not found. |
State |
get(int index)
Gets the
State at the specified index. |
State |
get(String name)
Performs a case sensitive lookup.
|
State |
get(String name,
boolean throwIfNotFound)
Performs a case sensitive lookup.
|
boolean |
getIsReadOnly()
Gets a value indicating whether or not the collection is read-only.
|
Variable |
getVariable()
Gets the
Variable this collection belongs to. |
int |
indexOf(Object o)
Determines the index of a specific
State in the collection. |
State |
remove(int index)
Removes an element from the collection at the specified index.
|
State |
set(int index,
State value)
Sets the
State at the specified index. |
int |
size() |
add, addAll, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
public int size()
size
in interface Collection<State>
size
in interface List<State>
size
in class AbstractCollection<State>
public boolean getIsReadOnly()
public Variable getVariable()
Variable
this collection belongs to. This is null if this is a child state collection.public State findByValue(Object value)
value
/> matches the given [value], or null if a match is not found.
For discretized variables, each State.getValue()
is an Interval
, and this method returns the state whose interval contains the given [value].value
- The value to match to a State.getValue()
.State
or null if a match is not found.public void clear()
clear
in interface Collection<State>
clear
in interface List<State>
clear
in class AbstractList<State>
public boolean contains(Object o)
State
is in the collection. The operation is O(1).contains
in interface Collection<State>
contains
in interface List<State>
contains
in class AbstractCollection<State>
o
- The State
to locate in the collection. The value can be null.public int indexOf(Object o)
State
in the collection. This operation is O(1).public void add(int index, State item)
add
in interface List<State>
add
in class AbstractList<State>
index
- The zero based index at which to add the element.item
- The item to insert. Cannot be null.NullPointerException
- Raised when [item] is null.IllegalStateException
- Raised if the state already belongs to a network.IllegalArgumentException
- index is less than 0.-or-index is equal to or greater than the collection count.public State remove(int index)
remove
in interface List<State>
remove
in class AbstractList<State>
index
- The zero based index at which to remove the element.IllegalArgumentException
- index is less than 0.-or-index is equal to or greater than the collection count.Copyright © 2021. All rights reserved.