public class MultiAgentSystem<T extends Agent>
extends java.lang.Object
implements java.util.Collection<T>
Modifier and Type | Field and Description |
---|---|
private java.util.Set<T> |
agents
The agents in this multi-agent system.
|
private Environment |
environment
The environment of this multi-agent system.
|
static int |
EXECUTE_TILL_TERMINATION
Indicates that the execution of this system's protocol should
be repeated until it has terminated.
|
Constructor and Description |
---|
MultiAgentSystem(Environment environment)
Creates a new empty multi-agent system with the given environment.
|
MultiAgentSystem(Environment environment,
java.util.Collection<? extends T> agents)
Creates a new multi-agent system with the given collection of agents.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T e) |
boolean |
addAll(java.util.Collection<? extends T> c) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
equals(java.lang.Object obj) |
void |
execute(AbstractProtocol protocol)
Executes the given protocol till it terminates.
|
boolean |
execute(AbstractProtocol protocol,
int numOfSteps)
Executes the given protocol for the given number of steps.
|
Environment |
getEnvironment()
Returns the environment of this multi-agent system.
|
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<S> S[] |
toArray(S[] a) |
public static final int EXECUTE_TILL_TERMINATION
private Environment environment
public MultiAgentSystem(Environment environment)
environment
- some environment.public MultiAgentSystem(Environment environment, java.util.Collection<? extends T> agents)
agents
- a collection of agents.environment
- some environment.public Environment getEnvironment()
public boolean execute(AbstractProtocol protocol, int numOfSteps) throws ProtocolTerminatedException, java.lang.IllegalArgumentException
protocol
- a protocol.numOfSteps
- the number of steps to be executed.ProtocolTerminatedException
- if the protocol terminates before all
steps could be executed.java.lang.IllegalArgumentException
- if the given number of steps is zero or
negative and not equal to Protocol.EXECUTE_TILL_TERMINATION.public void execute(AbstractProtocol protocol) throws ProtocolTerminatedException
protocol
- a protocol.ProtocolTerminatedException
- if the protocol has already terminated.public boolean addAll(java.util.Collection<? extends T> c)
public boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean isEmpty()
public java.util.Iterator<T> iterator()
public boolean remove(java.lang.Object o)
public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public java.lang.Object[] toArray()
public <S> S[] toArray(S[] a)
public int hashCode()