gsim.core
Interface DefinitionEnvironment

All Superinterfaces:
java.io.Serializable

public interface DefinitionEnvironment
extends java.io.Serializable

The DefinitionEnvironment is a wrapper for the actual gsim environment managing agents and objects. The wrapped object can be a local or remote reference.

The DefinitionEnvironment and its related interfaces (e.g. AgentIF, AgentClassIF provides convenience method for the gsim environment that eases its use as a programming model and hides some of the ugly things necessary to maintain a consistent state of the frame and instance hierarchies in the background.

Note: Names are unique identifiers. When creating single objects or agents, it must be made sure that the name does not exist yet.

Author:
Stephan

Field Summary
static int RAND_ATT_AND_WEIGHT
          Constant for creating random attributes and weights (weights are only for fuzzy matching utility) during instanciation using a normal distribution.
static int RAND_ATT_AND_WEIGHT_UNIFORM
          Constant for creating random attributes and weights (weights are only for fuzzy matching utility) during instanciation using a uniform distribution.
static int RAND_ATT_ONLY
          Constant for creating only random attributes during instanciation using a normal distribution.
static int RAND_ATT_ONLY_UNIFORM
          Constant for creating random attributes during instanciation using a uniform distribution.
static int RAND_NONE
          Constant specifying that no attributes should be varied during instanciation.
static int RAND_WEIGHT_ONLY
          Constant for creating random weights (only for fuzzy matching utility) during instanciation using a normal distribution.
static int RAND_WEIGHT_ONLY_UNIFORM
          Constant for creating random weights (only for fuzzy matching utility) during instanciation using a uniform distribution.
 
Method Summary
 AgentClassIF createAgentClass(java.lang.String name, java.lang.String parentName)
          Creates an AgentClass.
 AgentClassIF createAgentClass(java.lang.String name, java.lang.String parentName, int order)
          Creates an AgentClass and sets the execution order, i.e.
 ObjectClassIF createObjectClass(java.lang.String name, java.lang.String parent)
          Creates an ObjectClass.
 ObjectInstanceIF createObjectInstance(java.lang.String name, ObjectClassIF parent)
          Instanciates an object.
 void destroy()
          Method required for memory management.
 gsim.def.InheritanceHierarchy[] exportAgentHierarchy()
          Returns a tree with the agents (frames and instances) in the inheritance order.
 gsim.def.InheritanceHierarchy[] exportObjectHierarchy()
          Returns a tree with the objects (frames and instances) in the inheritance order.
 AgentInstanceIF getAgent(java.lang.String name)
          Returns an agent from the environment.
 AgentClassIF getAgentClass(java.lang.String name)
          Return a particular agent class.
 AgentClassIF[] getAgentClasses(java.lang.String parent)
          Return agent classes.
 java.lang.String[] getAgentNames(java.lang.String parent)
           
 AgentInstanceIF[] getAgents(java.lang.String parent)
          Returns a list of agent instances.
 AgentInstanceIF[] getAgents(java.lang.String parent, int offset, int count)
          Returns a list of agent instances of a particular type.
 ObjectClassIF getObjectClass(java.lang.String name)
          Return a particular object class.
 ObjectClassIF[] getObjectClasses(java.lang.String parent)
          Return object classes.
 ObjectInstanceIF[] getObjects(java.lang.String parent)
           
 AgentClassIF getTopAgentClass()
          Return the generic root (the system object from which all agent classes must inherit their properties)
 ObjectClassIF getTopObjectClass()
          Return the top level object class from which all objects must inherit.
 AgentInstanceIF instanciateAgent(AgentClassIF parent, java.lang.String name)
          Instanciate a single agent.
 AgentInstanceIF[] instanciateAgents(AgentClassIF parent, java.lang.String prefix, int method, double standardVariation, int count)
          Creates a list of agents.
 void instanciateAgents2(AgentClassIF parent, java.lang.String prefix, int method, double svar, int count)
          Creates a list of agents, but does not return them to the caller.
 void removeAgentInstances()
          Clears the environment from agents.
 

Field Detail

RAND_ATT_AND_WEIGHT

static final int RAND_ATT_AND_WEIGHT
Constant for creating random attributes and weights (weights are only for fuzzy matching utility) during instanciation using a normal distribution.

See Also:
Constant Field Values

RAND_ATT_AND_WEIGHT_UNIFORM

static final int RAND_ATT_AND_WEIGHT_UNIFORM
Constant for creating random attributes and weights (weights are only for fuzzy matching utility) during instanciation using a uniform distribution.

See Also:
Constant Field Values

RAND_ATT_ONLY

static final int RAND_ATT_ONLY
Constant for creating only random attributes during instanciation using a normal distribution.

See Also:
Constant Field Values

RAND_ATT_ONLY_UNIFORM

static final int RAND_ATT_ONLY_UNIFORM
Constant for creating random attributes during instanciation using a uniform distribution.

See Also:
Constant Field Values

RAND_NONE

static final int RAND_NONE
Constant specifying that no attributes should be varied during instanciation.

See Also:
Constant Field Values

RAND_WEIGHT_ONLY

static final int RAND_WEIGHT_ONLY
Constant for creating random weights (only for fuzzy matching utility) during instanciation using a normal distribution.

See Also:
Constant Field Values

RAND_WEIGHT_ONLY_UNIFORM

static final int RAND_WEIGHT_ONLY_UNIFORM
Constant for creating random weights (only for fuzzy matching utility) during instanciation using a uniform distribution.

See Also:
Constant Field Values
Method Detail

createAgentClass

AgentClassIF createAgentClass(java.lang.String name,
                              java.lang.String parentName)
                              throws gsim.def.GSimDefException
Creates an AgentClass.

Parameters:
name - name of the agent type
parentName - name of parent agent type (null if this is the top frame)
Returns:
AgentClassIF
Throws:
gsim.def.GSimDefException

createAgentClass

AgentClassIF createAgentClass(java.lang.String name,
                              java.lang.String parentName,
                              int order)
                              throws gsim.def.GSimDefException
Creates an AgentClass and sets the execution order, i.e. the position in which this agent is executed.

Parameters:
name - name of the agent type
parentName - name of parent agent type (null if this is the top frame)
order - execution order position
Returns:
AgentClassIF
Throws:
gsim.def.GSimDefException

createObjectClass

ObjectClassIF createObjectClass(java.lang.String name,
                                java.lang.String parent)
                                throws gsim.def.GSimDefException
Creates an ObjectClass.

Parameters:
name - name of the object type
parent - parent of the object type (nulli if partent is top frame)
Returns:
ObjectClassIF
Throws:
gsim.def.GSimDefException

createObjectInstance

ObjectInstanceIF createObjectInstance(java.lang.String name,
                                      ObjectClassIF parent)
                                      throws gsim.def.GSimDefException
Instanciates an object.

Parameters:
name - name of the object
parent - the frame from which the instance is created
Returns:
ObjectInstanceIF
Throws:
gsim.def.GSimDefException

destroy

void destroy()
Method required for memory management. In remote mode, it will remove the server objects.


exportAgentHierarchy

gsim.def.InheritanceHierarchy[] exportAgentHierarchy()
                                                     throws gsim.def.GSimDefException
Returns a tree with the agents (frames and instances) in the inheritance order.

Returns:
InheritanceHierarchy the agent hierarchy
Throws:
gsim.def.GSimDefException

exportObjectHierarchy

gsim.def.InheritanceHierarchy[] exportObjectHierarchy()
                                                      throws gsim.def.GSimDefException
Returns a tree with the objects (frames and instances) in the inheritance order.

Returns:
InheritanceHierarchy the object hierarchy
Throws:
gsim.def.GSimDefException

getAgent

AgentInstanceIF getAgent(java.lang.String name)
                         throws gsim.def.GSimDefException
Returns an agent from the environment.

Parameters:
name - name of the agent
Returns:
AgentInstanceIF
Throws:
gsim.def.GSimDefException

getAgentClass

AgentClassIF getAgentClass(java.lang.String name)
                           throws gsim.def.GSimDefException
Return a particular agent class.

Parameters:
name - name of the agent class
Returns:
AgentClassIF
Throws:
gsim.def.GSimDefException

getAgentClasses

AgentClassIF[] getAgentClasses(java.lang.String parent)
                               throws gsim.def.GSimDefException
Return agent classes. If parent is null, all subclasses are returned.

Parameters:
parent - a parent frame
Returns:
List of AgentClassIF
Throws:
gsim.def.GSimDefException

getAgentNames

java.lang.String[] getAgentNames(java.lang.String parent)
                                 throws gsim.def.GSimDefException
Throws:
gsim.def.GSimDefException

getAgents

AgentInstanceIF[] getAgents(java.lang.String parent)
                            throws gsim.def.GSimDefException
Returns a list of agent instances. All instances of lower levels of the frame hierarchy are returned. If very many agents are expected, use method getAgents(String parent, int offset, int count)

Parameters:
parent - a parent frame (if null, all agents are returned)
Returns:
List of AgentInstanceIF
Throws:
gsim.def.GSimDefException

getAgents

AgentInstanceIF[] getAgents(java.lang.String parent,
                            int offset,
                            int count)
                            throws gsim.def.GSimDefException
Returns a list of agent instances of a particular type. All instances of lower levels of the frame hierarchy are returned. The offset and count should be used when the number of agents in the simulation is very large.

Parameters:
parent - a parent frame (if null, all agents are returned)
offset - offset
count - number of agents to retrieve
Returns:
List of AgentInstanceIF
Throws:
gsim.def.GSimDefException

getObjectClass

ObjectClassIF getObjectClass(java.lang.String name)
                             throws gsim.def.GSimDefException
Return a particular object class.

Parameters:
name - the name of the object class
Returns:
ObjectClassIF
Throws:
gsim.def.GSimDefException

getObjectClasses

ObjectClassIF[] getObjectClasses(java.lang.String parent)
                                 throws gsim.def.GSimDefException
Return object classes. If parent is null, all subclasses are returned.

Parameters:
parent - the parent class
Returns:
ObjectClassIF[]
Throws:
gsim.def.GSimDefException

getObjects

ObjectInstanceIF[] getObjects(java.lang.String parent)
                              throws gsim.def.GSimDefException
Parameters:
parent -
Returns:
list of ObjectInstanceIF
Throws:
gsim.def.GSimDefException

getTopAgentClass

AgentClassIF getTopAgentClass()
                              throws gsim.def.GSimDefException
Return the generic root (the system object from which all agent classes must inherit their properties)

Returns:
AgentClassIF
Throws:
gsim.def.GSimDefException

getTopObjectClass

ObjectClassIF getTopObjectClass()
                                throws gsim.def.GSimDefException
Return the top level object class from which all objects must inherit.

Returns:
ObjectClassIF
Throws:
gsim.def.GSimDefException

instanciateAgent

AgentInstanceIF instanciateAgent(AgentClassIF parent,
                                 java.lang.String name)
                                 throws gsim.def.GSimDefException
Instanciate a single agent.

Parameters:
parent - the frame from which the agent is created
name - name of the agent (must be unique)
Returns:
AgentInstanceIF
Throws:
gsim.def.GSimDefException

instanciateAgents

AgentInstanceIF[] instanciateAgents(AgentClassIF parent,
                                    java.lang.String prefix,
                                    int method,
                                    double standardVariation,
                                    int count)
                                    throws gsim.def.GSimDefException
Creates a list of agents.

Parameters:
parent - the frame from which the agent is created
prefix - common name prefix, to which a running number will be appended
method - method constant defining what to do with the attributes (e.g. vary randomly)
standardVariation - standard variation (only needed if method is based on normal distribution)
count - number of agents to instanciate
Returns:
List of AgentInstanceIF
Throws:
gsim.def.GSimDefException

instanciateAgents2

void instanciateAgents2(AgentClassIF parent,
                        java.lang.String prefix,
                        int method,
                        double svar,
                        int count)
                        throws gsim.def.GSimDefException
Creates a list of agents, but does not return them to the caller. This method should be used when large numbers are created (typically in distributed mode), which can be too much for a single node.

Parameters:
parent - the frame from which the agent is created
prefix - common name prefix, to which a running number will be appended
method - method constant defining what to do with the attributes (e.g. vary randomly)
svar - standard variation (only needed if method is based on normal distribution)
count - number of agents to instanciate
Throws:
gsim.def.GSimDefException

removeAgentInstances

void removeAgentInstances()
Clears the environment from agents.