gov.nasa.arc.brahms.common.rt
Class CreateAgentActivityCtx

java.lang.Object
  extended by gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
      extended by gov.nasa.arc.brahms.common.rt.ActivityCtx
          extended by gov.nasa.arc.brahms.common.rt.PrimitiveActivityCtx
              extended by gov.nasa.arc.brahms.common.rt.CreateAgentActivityCtx
All Implemented Interfaces:
IActivityCtx, IBrahmsObjectCtx, ICreateAgentActivityCtx, IPrimitiveActivityCtx, IRuntimeConstants, java.io.Serializable

public class CreateAgentActivityCtx
extends PrimitiveActivityCtx
implements ICreateAgentActivityCtx

The CreateAgentActivityCtx maintains the context of a create agent activity being or to be executed by an active instance. The context maintains the start and end times for an activity, the duration, priority, status, randomness, duration, resources, group membership, number of agents, destination variable, name and location of the destination agent(s), and when the creation is to take place.

Version:
6 July 2001
Author:
Ron van Hoof
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface gov.nasa.arc.brahms.common.rt.IRuntimeConstants
ABORTED, ACTIVE, ACTIVITY, AVAILABLE, COMPLETED, CONSEQUENCE, DETECTABLE, ENDED, ENGINE, EXTERNAL_AGENT, FROM, IMPASSED, INITIAL, INTERRUPTED, JAVA_PROPERTY, sABORTED, sACTIVE, sAVAILABLE, sCOMPLETED, sENDED, sIMPASSED, sINTERRUPTED, sUNAVAILABLE, TO, TRANSFER, UNAVAILABLE
 
Constructor Summary
CreateAgentActivityCtx(CreateAgentActivity act)
          Constructor, creates a new context for the specified CreateAgentActivity.
 
Method Summary
 void addBoundVariable(VariableCtx var)
          Adds the specified variable as a variable bound by this activity.
 void addMemberOf(ParameterCtx grp)
          Adds the specified group(s) (ParameterCtx) as a parent group for the created agent.
 java.util.Enumeration getBoundVariables()
          Returns a list of all the variables used by this activity.
 ParameterCtx getDestination()
          Returns the create agent's destination variable.
 ParameterCtx getDestinationLocation()
          Returns the location for the created agent.
 ParameterCtx getDestinationName()
          Returns the name for the created agent.
 java.util.Enumeration getMemberOf()
          Returns a list of all the groups (ParameterCtx).
 ParameterCtx getQuantity()
          Returns the number of agents created.
 ParameterCtx getWhen()
          Returns when the create agent action is to take place (start or end).
 void removeBoundVariable(VariableCtx var)
          Removes the specified variable as a variable bound by this activity.
 void removeMemberOf(ParameterCtx grp)
          Removes the specified group (ParameterCtx) as a parent of the created agent.
 void setDestination(ParameterCtx destination)
          Sets the create agent's destination variable.
 void setDestinationLocation(ParameterCtx destinationLocation)
          Sets the location for the created agent.
 void setDestinationName(ParameterCtx destinationName)
          Sets the name for the created agent.
 void setQuantity(ParameterCtx p)
          Sets the number of agents to be created.
 void setWhen(ParameterCtx when)
          Sets when the create agent action is to take place (start or end).
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.PrimitiveActivityCtx
addResource, getDuration, getElapsedTime, getMaxDuration, getMinDuration, getRandom, getResourceCount, getResources, removeResource, setDuration, setElapsedTime, setMaxDuration, setMinDuration, setRandom
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.ActivityCtx
getCompletionCause, getDisplayText, getParentFrame, getPerformedBy, getPriority, getReferencedBy, getState, getStatus, setCompletionCause, setDisplayText, setParentFrame, setPerformedBy, setPriority, setReferencedBy, setState, setState, setStatus, toString
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setContextFor, setEndTime, setID, setStartTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IPrimitiveActivityCtx
addResource, getDuration, getElapsedTime, getMaxDuration, getMinDuration, getRandom, getResourceCount, getResources, removeResource, setElapsedTime
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IActivityCtx
getCompletionCause, getDisplayText, getParentFrame, getPerformedBy, getPriority, getReferencedBy, getStatus, setCompletionCause, setDisplayText, setParentFrame, setPerformedBy, setReferencedBy, setStatus
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IBrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime
 

Constructor Detail

CreateAgentActivityCtx

public CreateAgentActivityCtx(CreateAgentActivity act)
Constructor, creates a new context for the specified CreateAgentActivity.

Parameters:
act - the CreateAgentActivity for which to create a context
Method Detail

addMemberOf

public void addMemberOf(ParameterCtx grp)
                 throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified group(s) (ParameterCtx) as a parent group for the created agent. The group is specified through a parameter context containing either the actual value (Group) or a reference to a variable containing the value.

Parameters:
grp - the group (ParameterCtx) the agent is to be a member of
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if grp is null

removeMemberOf

public void removeMemberOf(ParameterCtx grp)
                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified group (ParameterCtx) as a parent of the created agent. The group is specified through a parameter context containing either the actual value (Group) or a reference to a variable containing the value.

Parameters:
grp - the group to be removed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if grp is null, no groups are available, or the grp is not found

getMemberOf

public java.util.Enumeration getMemberOf()
                                  throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the groups (ParameterCtx).

Specified by:
getMemberOf in interface ICreateAgentActivityCtx
Returns:
Enumeration an enumeration of ParameterCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no groups

setQuantity

public void setQuantity(ParameterCtx p)
                 throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the number of agents to be created. The quantity is set through a parameter context containing either the actual value or a reference to a variable containing the quantity value.

Parameters:
p - the ParameterCtx defining the quantity
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null quantity is defined

getQuantity

public ParameterCtx getQuantity()
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the number of agents created. The quantity is set through a parameter context containing either the actual value or a reference to a variable containing the quantity value.

Specified by:
getQuantity in interface ICreateAgentActivityCtx
Returns:
ParameterCtx the quantity
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no quantity is defined

setWhen

public void setWhen(ParameterCtx when)
             throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets when the create agent action is to take place (start or end). The when value is set through a parameter context containing either the actual value (int) or a reference to a variable containing the when value.

Parameters:
when - the ParameterCtx defining the when the create agent action is to occur
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null when value is defined

getWhen

public ParameterCtx getWhen()
                     throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns when the create agent action is to take place (start or end). The when value is set through a parameter context containing either the actual value (int) or a reference to a variable containing the when value.

Specified by:
getWhen in interface ICreateAgentActivityCtx
Returns:
ParameterCtx the when value defining when the create agent action is to occur
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the when value is not defined

setDestination

public void setDestination(ParameterCtx destination)
                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the create agent's destination variable. The destination is specified through a parameter context containing either a reference to a variable containing the value.

Parameters:
destination - the ParameterCtx containing the destination
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null destination is specified

getDestination

public ParameterCtx getDestination()
                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the create agent's destination variable. The destination is specified through a parameter context containing a reference to a variable containing the value.

Specified by:
getDestination in interface ICreateAgentActivityCtx
Returns:
ParameterCtx the destination
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no destination is specified

setDestinationName

public void setDestinationName(ParameterCtx destinationName)
                        throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the name for the created agent. The destination name is specified through a parameter context containing either the actual value (String) or a reference to a variable containing the value.

Parameters:
destinationName - the ParameterCtx containing the destination name
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null destination name is specified

getDestinationName

public ParameterCtx getDestinationName()
                                throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the name for the created agent. The destination name is specified through a parameter context containing either the actual value (String) or a reference to a variable containing the value.

Specified by:
getDestinationName in interface ICreateAgentActivityCtx
Returns:
ParameterCtx the destination name
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no destination name is specified

setDestinationLocation

public void setDestinationLocation(ParameterCtx destinationLocation)
                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the location for the created agent. The destination location is specified a parameter context containing either the actual value (AreaCtx) or a reference to a variable containing the value.

Parameters:
destinationLocation - the ParameterCtx containing the destination location
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null destination location is specified

getDestinationLocation

public ParameterCtx getDestinationLocation()
                                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the location for the created agent. The destination location is specified through a parameter context containing either the actual value (AreaCtx) or a reference to a variable containing the value.

Specified by:
getDestinationLocation in interface ICreateAgentActivityCtx
Returns:
ParameterCtx the destination location
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no destination location is specified

addBoundVariable

public void addBoundVariable(VariableCtx var)
                      throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified variable as a variable bound by this activity.

Specified by:
addBoundVariable in interface ICreateAgentActivityCtx
Parameters:
var - the variable (VariableCtx) to be added
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if var is null

removeBoundVariable

public void removeBoundVariable(VariableCtx var)
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified variable as a variable bound by this activity.

Specified by:
removeBoundVariable in interface ICreateAgentActivityCtx
Parameters:
var - the variable (VariableCtx) to be removed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if variable is null, no variables are present, or the variable is not found

getBoundVariables

public java.util.Enumeration getBoundVariables()
                                        throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the variables used by this activity.

Specified by:
getBoundVariables in interface ICreateAgentActivityCtx
Returns:
Enumeration an enumeration of VariableCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no variables


Copyright © 1997-2012 All Rights Reserved.