Package cmion.storage

Class WorldModel


  • public class WorldModel
    extends CmionStorageContainer
    a specific subclass of cmion storage container with convenience methods added for handling "agent" and "object" sub containers.
    • Field Detail

      • AGENT_TYPE_NAME

        public static java.lang.String AGENT_TYPE_NAME
      • OBJECT_TYPE_NAME

        public static java.lang.String OBJECT_TYPE_NAME
    • Constructor Detail

      • WorldModel

        public WorldModel​(IArchitecture architecture,
                          java.lang.String name)
    • Method Detail

      • requestAddAgent

        public void requestAddAgent​(java.lang.String name)
        request adding an agent to the world model
      • requestAddAgent

        public void requestAddAgent​(java.lang.String name,
                                    java.util.HashMap<java.lang.String,​java.lang.Object> initialProperties)
        request adding an agent to the world model
      • requestAddAgent

        public void requestAddAgent​(java.lang.String name,
                                    java.util.HashMap<java.lang.String,​java.lang.Object> initialProperties,
                                    java.util.HashSet<java.lang.String> persistentProperties)
        request adding an agent to the world model
      • requestRemoveAgent

        public void requestRemoveAgent​(java.lang.String name)
        request removing an agent from the world model
      • requestAddObject

        public void requestAddObject​(java.lang.String name)
        request adding an object to the world model
      • requestAddObject

        public void requestAddObject​(java.lang.String name,
                                     java.util.HashMap<java.lang.String,​java.lang.Object> initialProperties)
        request adding an object to the world model
      • requestAddObject

        public void requestAddObject​(java.lang.String name,
                                     java.util.HashMap<java.lang.String,​java.lang.Object> initialProperties,
                                     java.util.HashSet<java.lang.String> persistentProperties)
        request adding an object to the world model
      • requestRemoveObject

        public void requestRemoveObject​(java.lang.String name)
        request removing an object from the world model
      • hasAgent

        public boolean hasAgent​(java.lang.String name)
        returns whether the world model has an agent of the specified name
      • hasObject

        public boolean hasObject​(java.lang.String name)
        returns whether the world model has an object of the specified name
      • getAgentNames

        public java.util.ArrayList<java.lang.String> getAgentNames()
        returns a list of the names of all agents
      • getObjectNames

        public java.util.ArrayList<java.lang.String> getObjectNames()
        returns a list of the names of all objects
      • getAgent

        public CmionStorageContainer getAgent​(java.lang.String name)
        returns the agent storage container with the specified name or null if it does not exist in this world model
      • getObject

        public CmionStorageContainer getObject​(java.lang.String name)
        returns the object storage container with the specified name or null if it does not exist in this world model
      • openInitFile

        protected java.io.InputStream openInitFile​(java.lang.String initFileName)
                                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • loadInitFile

        public void loadInitFile​(java.lang.String initFile)
                          throws java.lang.Exception
        Load the initial contents for the world model from the specified file
        Throws:
        java.lang.Exception