swarm.activity
Interface Activity

All Known Subinterfaces:
ForEachActivity, ScheduleActivity, SwarmActivity
All Known Implementing Classes:
ActivityImpl, ScheduleActivityImpl, ForEachActivityImpl

public abstract interface Activity
extends DefinedObjectS, DefinedObject, DropS, Drop

A level of processing by the interpreter of an action type.. A object of type Activity implements the processing of actions within an action plan. Each subtype of action plan has a corresponding subtype of Activity that implements processing of its respective type of plan. The Activity types are part of the virtual processing machinery of an action plan interpreter. All the important elements of this machinery, including their current state of processing, are exposed to aid in development of general-purpose tools such as debuggers. Except for applications that need to create and run their own reflective activities, direct use of activity types by a modeling application should be rare. A new activity object is created by each activateIn: message sent to an action type. activateIn: initializes a new activity object and prepares it for processing, but does not itself execute any actions. Subsequent messages, such as run, must be used to initiate processing within an activity. If an activity is activated to run under a swarm context, the owning swarm itself controls all processing within the subactivity. An Activity type holds a tree of currently running, or a potentially runnable, subactivities. Each activity object represents a state of processing within a single action plan. The structure is a tree because multiple activities could be running or eligible to run at the same time. This occurs whenever two activities are specified as concurrent, either because are being performed by concurrent actions in some other plan, or because they were started for autonomous execution under the same swarm. When parallel processing machinery is present, each activity could also be advancing its own state independent of those of any other activity. The current implementation supports only a single serial processor. Under serial execution, only one activity may be active at one time. This means that the current state of processing may be represented by a single stack of current activities that traces a path to a single leaf of the runnable activity tree. When running in serial mode, messages are available to obtain the currently running leaf activity or useful context information such as the current time available from it.


Method Summary
 Object getAction()
          Get action containing parameter bindings for the local activity.
 Object getActionType()
          Get action type of action being performed by activity.
 Object getControllingActivity()
          Return activity that issued current run request on top-level activity.
 Object getCurrentSubactivity()
          Get running subactivity or next subactivity to run.
 SymbolImpl getHoldType()
          The getHoldType returns a code for the particular hold constraint under which an activity is currently holding (HoldStart or HoldEnd).
 Object getOwnerActivity()
          Return activity under which this activity is running.
 ScheduleActivityImpl getScheduleActivity()
          Return most immediately containing Schedule activity.
 boolean getSerialMode()
          Return indicator for serial execution mode.
 SymbolImpl getStatus()
          The getStatus message returns one of the following codes for the current run status of a particular activity: Initialized, Running, Stopped, Holding, Released, Terminated, Completed.
 Object getSubactivities()
          Return set of subactivities pending to be run.
 SwarmActivityImpl getSwarmActivity()
          Return most immediately containing Swarm activity.
 Object getTopLevelActivity()
          Return top of activity tree running the local activity.
 SymbolImpl next()
          The next executes actions within a single compound action while skipping over all processing of any complete action plans executed by those actions.
 SymbolImpl run()
          The run message continue processing of an activity from any state in which its execution has been suspended.
 void setOwnerActivity(Object ownerActivity)
          Change owner from one swarm activity to another.
 Object setSerialMode(boolean serialMode)
          Set serial execution mode.
 SymbolImpl step()
          The step message executes a single action within a tree of activities.
 Object stop()
          The stop message causes the a currently running tree of activities to stop further processing and return a Stopped status.
 void terminate()
          Terminate also stops a running tree of activities, but sets all activities within the tree to a status of Completed whenever the tree is next run.
 
Methods inherited from interface swarm.defobj.DefinedObject
compare, describe, describeID, getDisplayName, getTypeName, getZone, perform, perform$with, perform$with$with, perform$with$with$with, respondsTo, setDisplayName, xfprint, xfprintid, xprint, xprintid
 
Methods inherited from interface swarm.defobj.Drop
drop
 

Method Detail

run

public SymbolImpl run()
The run message continue processing of an activity from any state in which its execution has been suspended. An error is raised if the activity is already running. run returns either a Stopped or Completed status that the activity has when it is no longer eligible to be run further.

stop

public Object stop()
The stop message causes the a currently running tree of activities to stop further processing and return a Stopped status.

terminate

public void terminate()
Terminate also stops a running tree of activities, but sets all activities within the tree to a status of Completed whenever the tree is next run. terminate may be used on either a running or stopped tree of activities. It is the standard way to terminate schedule that is endlessly repeating under the RepeatInterval option.

next

public SymbolImpl next()
The next executes actions within a single compound action while skipping over all processing of any complete action plans executed by those actions.

step

public SymbolImpl step()
The step message executes a single action within a tree of activities.

getStatus

public SymbolImpl getStatus()
The getStatus message returns one of the following codes for the current run status of a particular activity: Initialized, Running, Stopped, Holding, Released, Terminated, Completed.

getHoldType

public SymbolImpl getHoldType()
The getHoldType returns a code for the particular hold constraint under which an activity is currently holding (HoldStart or HoldEnd). It returns nil if the basic status of the activity is not Holding. (.. Currently no hold constraints other than merging within a swarm are supported, and this message always returns nil.)

getAction

public Object getAction()
Get action containing parameter bindings for the local activity.

getActionType

public Object getActionType()
Get action type of action being performed by activity.

setOwnerActivity

public void setOwnerActivity(Object ownerActivity)
Change owner from one swarm activity to another.

getOwnerActivity

public Object getOwnerActivity()
Return activity under which this activity is running.

getSubactivities

public Object getSubactivities()
Return set of subactivities pending to be run.

getControllingActivity

public Object getControllingActivity()
Return activity that issued current run request on top-level activity.

getTopLevelActivity

public Object getTopLevelActivity()
Return top of activity tree running the local activity.

getSwarmActivity

public SwarmActivityImpl getSwarmActivity()
Return most immediately containing Swarm activity.

getScheduleActivity

public ScheduleActivityImpl getScheduleActivity()
Return most immediately containing Schedule activity.

setSerialMode

public Object setSerialMode(boolean serialMode)
Set serial execution mode.

getSerialMode

public boolean getSerialMode()
Return indicator for serial execution mode.

getCurrentSubactivity

public Object getCurrentSubactivity()
Get running subactivity or next subactivity to run.