com.xj.anylogic.engine
Class Environment.AgentCollection<T extends Agent>

java.lang.Object
  extended by java.util.AbstractCollection<T>
      extended by com.xj.anylogic.engine.Environment.AgentCollection<T>
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<T>, java.util.Collection<T>
Enclosing class:
Environment<T extends Agent>

public static class Environment.AgentCollection<T extends Agent>
extends java.util.AbstractCollection<T>
implements java.io.Serializable

A collection of agents. Supports iterations, size() and get( index ) methods.

See Also:
Serialized Form

Constructor Summary
Environment.AgentCollection()
           
 
Method Summary
 T get(int index)
          Returns the agent with a given index in the collection.
 java.util.Iterator<T> iterator()
          Returns the iterator that is used to traverse the collection.
 int size()
          Returns the number of agents in the collection.
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

Environment.AgentCollection

public Environment.AgentCollection()
Method Detail

size

public int size()
Returns the number of agents in the collection.

Specified by:
size in interface java.util.Collection<T extends Agent>
Specified by:
size in class java.util.AbstractCollection<T extends Agent>
Returns:
the number of agents in the collection

iterator

public java.util.Iterator<T> iterator()
Returns the iterator that is used to traverse the collection.

Specified by:
iterator in interface java.lang.Iterable<T extends Agent>
Specified by:
iterator in interface java.util.Collection<T extends Agent>
Specified by:
iterator in class java.util.AbstractCollection<T extends Agent>
Returns:
the iterator that is used to traverse the collection

get

public T get(int index)
Returns the agent with a given index in the collection. Note that index of an agent may change as other agents are added or removed.

Parameters:
index - the index
Returns:
the agent with a given index, or null


Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.