Package cmion.storage
Class WorldModel
- java.lang.Object
-
- ion.Meta.Element
-
- cmion.architecture.CmionComponent
-
- cmion.storage.CmionStorageContainer
-
- cmion.storage.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 Summary
Fields Modifier and Type Field Description static java.lang.StringAGENT_TYPE_NAMEstatic java.lang.StringOBJECT_TYPE_NAME-
Fields inherited from class cmion.storage.CmionStorageContainer
persistentProperties
-
Fields inherited from class cmion.architecture.CmionComponent
architecture
-
-
Constructor Summary
Constructors Constructor Description WorldModel(IArchitecture architecture, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CmionStorageContainergetAgent(java.lang.String name)returns the agent storage container with the specified name or null if it does not exist in this world modeljava.util.ArrayList<java.lang.String>getAgentNames()returns a list of the names of all agentsCmionStorageContainergetObject(java.lang.String name)returns the object storage container with the specified name or null if it does not exist in this world modeljava.util.ArrayList<java.lang.String>getObjectNames()returns a list of the names of all objectsbooleanhasAgent(java.lang.String name)returns whether the world model has an agent of the specified namebooleanhasObject(java.lang.String name)returns whether the world model has an object of the specified namevoidloadInitFile(java.lang.String initFile)Load the initial contents for the world model from the specified fileprotected java.io.InputStreamopenInitFile(java.lang.String initFileName)voidrequestAddAgent(java.lang.String name)request adding an agent to the world modelvoidrequestAddAgent(java.lang.String name, java.util.HashMap<java.lang.String,java.lang.Object> initialProperties)request adding an agent to the world modelvoidrequestAddAgent(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 modelvoidrequestAddObject(java.lang.String name)request adding an object to the world modelvoidrequestAddObject(java.lang.String name, java.util.HashMap<java.lang.String,java.lang.Object> initialProperties)request adding an object to the world modelvoidrequestAddObject(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 modelvoidrequestRemoveAgent(java.lang.String name)request removing an agent from the world modelvoidrequestRemoveObject(java.lang.String name)request removing an object from the world model-
Methods inherited from class cmion.storage.CmionStorageContainer
getContainerName, getContainerType, getParentContainer, getPropertyNames, getPropertyNames, getPropertyValue, getSubContainer, getSubContainerNames, getSubContainerNames, getTopContainer, hasProperty, hasProperty, hasSubContainer, hasSubContainer, isPropertyPersistent, registerEventHandlerWithSubContainers, registerHandlers, requestAddSubContainer, requestAddSubContainer, requestAddSubContainer, requestRemoveProperty, requestRemoveSubContainer, requestSetProperty, requestSetProperty, toString
-
Methods inherited from class cmion.architecture.CmionComponent
getArchitecture, isConnected, onDestroy, raise
-
-
-
-
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.ExceptionLoad the initial contents for the world model from the specified file- Throws:
java.lang.Exception
-
-