Class MultiAgentSystem<T extends Agent>

  • Type Parameters:
    T - the agent class.
    All Implemented Interfaces:
    java.lang.Iterable<T>, java.util.Collection<T>
    Direct Known Subclasses:
    GroundedGameSystem, LotteryGameSystem, StructuredArgumentationSystem

    public class MultiAgentSystem<T extends Agent>
    extends java.lang.Object
    implements java.util.Collection<T>
    A multi-agent system is a collection of agents with some environment.
    Author:
    Matthias Thimm
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int EXECUTE_TILL_TERMINATION
      Indicates that the execution of this system's protocol should be repeated until it has terminated.
    • Constructor Summary

      Constructors 
      Constructor 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.
    • Method Summary

      Modifier and Type Method 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)  
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, spliterator, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Field Detail

      • EXECUTE_TILL_TERMINATION

        public static final int EXECUTE_TILL_TERMINATION
        Indicates that the execution of this system's protocol should be repeated until it has terminated.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MultiAgentSystem

        public MultiAgentSystem​(Environment environment)
        Creates a new empty multi-agent system with the given environment.
        Parameters:
        environment - some environment.
      • MultiAgentSystem

        public MultiAgentSystem​(Environment environment,
                                java.util.Collection<? extends T> agents)
        Creates a new multi-agent system with the given collection of agents.
        Parameters:
        agents - a collection of agents.
        environment - some environment.
    • Method Detail

      • getEnvironment

        public Environment getEnvironment()
        Returns the environment of this multi-agent system.
        Returns:
        the environment of this multi-agent system.
      • execute

        public boolean execute​(AbstractProtocol protocol,
                               int numOfSteps)
                        throws ProtocolTerminatedException,
                               java.lang.IllegalArgumentException
        Executes the given protocol for the given number of steps. Set steps to Protocol.EXECUTE_TILL_TERMINATION to have the protocol executed till termination.
        Parameters:
        protocol - a protocol.
        numOfSteps - the number of steps to be executed.
        Returns:
        "true" if the protocol has terminated after executing the given number of steps.
        Throws:
        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.
      • add

        public boolean add​(T e)
        Specified by:
        add in interface java.util.Collection<T extends Agent>
      • addAll

        public boolean addAll​(java.util.Collection<? extends T> c)
        Specified by:
        addAll in interface java.util.Collection<T extends Agent>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<T extends Agent>
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<T extends Agent>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<T extends Agent>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<T extends Agent>
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.util.Collection<T extends Agent>
        Specified by:
        iterator in interface java.lang.Iterable<T extends Agent>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<T extends Agent>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<T extends Agent>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<T extends Agent>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<T extends Agent>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<T extends Agent>
      • toArray

        public <S> S[] toArray​(S[] a)
        Specified by:
        toArray in interface java.util.Collection<T extends Agent>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<T extends Agent>
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface java.util.Collection<T extends Agent>
        Overrides:
        equals in class java.lang.Object