- java.lang.Object
- com.anylogic.engine.AgentList<E>
- com.anylogic.engine.AgentArrayList<E>
- Type Parameters:
E
- agent type
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,IterableWithSize<E>
,Serializable
,Iterable<E>
public class AgentArrayList<E extends Agent> extends AgentList<E>
Agent population list based on array implementation
Supports fast element retrieval by its index (the
The add operation runs in amortized constant time, that is, adding n elements requires O(n) time.
Supports fast element retrieval by its index (the
get(int)
operation
runs in constant time).The add operation runs in amortized constant time, that is, adding n elements requires O(n) time.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Constructor | Description |
---|---|
AgentArrayList |
Constructs an empty list with an initial capacity of ten.
|
Modifier and Type | Method | Description |
---|---|---|
void | _add |
This method should not be called by user
Call add_EONAME() method of class containing embedded object
with name EONAME or agent.goToPopulation( population ) |
boolean | _remove |
This method should not be called by user
Call remove_EONAME() method of class containing embedded
object with name EONAME or agent.goToPopulation( null ) |
boolean | contains |
Returns
true if this agent population contains the
specified element. |
E | get |
Returns the agent element at the specified position in this
agent population.
The position index is the number of list element in the insertion order (i.e. |
boolean | isEmpty() |
Returns
true if this agent population contains no
elements. |
Iterator<E> | iterator() |
Returns an iterator over the agent population.
This iterator guarantees the insertion order of elements (i.e. |
int | size() |
Returns the number of elements in this agent population.
If this collection contains more than Integer.MAX_VALUE
elements, returns Integer.MAX_VALUE . |
Stream<E> | stream() |
Returns a sequential Stream with this agent population as its source.
|
String | toString() |
average, average, callCreate, callCreate, callSetupParameters, callSetupParameters, count, fillFromTable, fillFromTable, fillFromTable, findAll, findFirst, getEnvironment, getOwner, getPresentationScaleOnOwnerSpace, getValueFromTable, instantiateAgent, isPresentationEnabled, max, max, min, min, min, onChange, random, random, randomExcept, randomExcept, restoreOwner, setEnvironment, sum, sum
public AgentArrayList(Agent owner)
Constructs an empty list with an initial capacity of ten.
@AnyLogicInternalCodegenAPI public void _add(E agent)
Description copied from class:
AgentList
This method should not be called by user
Call
Call
add_EONAME()
method of class containing embedded object
with name EONAME or agent.goToPopulation( population )
@AnyLogicInternalCodegenAPI public boolean _remove(Agent agent)
Description copied from class:
AgentList
This method should not be called by user
Call
Call
remove_EONAME()
method of class containing embedded
object with name EONAME or agent.goToPopulation( null )
public E get(int index)
Description copied from class:
AgentList
Returns the agent element at the specified position in this
agent population.
The position index is the number of list element in the insertion order (i.e. the order in which agent were added to this replicated agent list). Thus, index of an element decreases when preceding elements are removed.
The position index is the number of list element in the insertion order (i.e. the order in which agent were added to this replicated agent list). Thus, index of an element decreases when preceding elements are removed.
public boolean contains(Object agent)
Description copied from class:
AgentList
Returns
true
if this agent population contains the
specified element. More formally, returns true
if and only if
this collection contains at least one element e
such that
(o==null ? e==null : o.equals(e))
.public boolean isEmpty()
Description copied from class:
AgentList
Returns
true
if this agent population contains no
elements.public Iterator<E> iterator()
Description copied from class:
AgentList
Returns an iterator over the agent population.
This iterator guarantees the insertion order of elements (i.e. the order in which agent were added to this agent population list).
Note, that returned iterator doesn't support remove operation
This iterator guarantees the insertion order of elements (i.e. the order in which agent were added to this agent population list).
Note, that returned iterator doesn't support remove operation
public Stream<E> stream()
Description copied from class:
AgentList
Returns a sequential Stream with this agent population as its source.
public int size()
Description copied from class:
AgentList
Returns the number of elements in this agent population.
If this collection contains more than
If this collection contains more than
Integer.MAX_VALUE
elements, returns Integer.MAX_VALUE
.public String toString()