etomica.action.activity
Class ActivityGroupParallel

java.lang.Object
  extended by etomica.action.Activity
      extended by etomica.action.activity.ActivityGroupParallel
All Implemented Interfaces:
ActionGroup, ActivityGroup, IAction, Serializable

public class ActivityGroupParallel
extends Activity
implements ActivityGroup

Organizer of simulation actions to be executed in parallel, each on its own thread.

See Also:
Serialized Form

Field Summary
protected  IAction[] actions
           
protected  etomica.action.activity.ActivityGroupParallel.MyThread firstThread
           
protected  etomica.action.activity.ActivityGroupParallel.MyThread lastThread
           
protected  int numActions
           
 
Fields inherited from class etomica.action.Activity
haltRequested, isActive, pauseRequested
 
Constructor Summary
ActivityGroupParallel()
           
ActivityGroupParallel(IAction[] actions)
           
 
Method Summary
 void addAction(IAction newAction)
          Adds the given newAction to this group.
 IAction[] getAllActions()
          Returns all actions from this group.
 IAction[] getCompletedActions()
          Returns all actions from this group that have been completed.
 IAction[] getCurrentActions()
          Returns all actions from this group that are currently being performed.
 IAction[] getPendingActions()
          Returns all actions from this group that have not yet started.
 void halt()
          Request that the activity terminate as soon as safely possible.
 void pause()
          Requests that the Activity pause its execution.
 boolean removeAction(IAction action)
          Removes the given oldAction from the group.
protected  void run()
          Method defining the behavior of the activity.
 void setActions(IAction[] actions)
           
 void unPause()
          Removes activity from the paused state, resuming execution where it left off.
 
Methods inherited from class etomica.action.Activity
actionPerformed, doContinue, doWait, isActive, isPaused
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface etomica.action.IAction
actionPerformed
 

Field Detail

numActions

protected int numActions

actions

protected IAction[] actions

lastThread

protected etomica.action.activity.ActivityGroupParallel.MyThread lastThread

firstThread

protected etomica.action.activity.ActivityGroupParallel.MyThread firstThread
Constructor Detail

ActivityGroupParallel

public ActivityGroupParallel()

ActivityGroupParallel

public ActivityGroupParallel(IAction[] actions)
Method Detail

run

protected void run()
Description copied from class: Activity
Method defining the behavior of the activity. Implementation should ensure regular checking of doContinue() to permit any requests to pause or halt to be put in effect. If doContinue() returns false, run method should end activity.

Specified by:
run in class Activity

halt

public void halt()
Description copied from class: Activity
Request that the activity terminate as soon as safely possible. Causes calling thread to wait until the halt is in effect.

Overrides:
halt in class Activity

unPause

public void unPause()
Description copied from class: Activity
Removes activity from the paused state, resuming execution where it left off.

Overrides:
unPause in class Activity

pause

public void pause()
Description copied from class: Activity
Requests that the Activity pause its execution. The actual suspension of execution occurs only after activity notices the pause request. The calling thread is put in a wait state until the pause takes effect.

Overrides:
pause in class Activity

getAllActions

public IAction[] getAllActions()
Description copied from interface: ActionGroup
Returns all actions from this group.

Specified by:
getAllActions in interface ActionGroup

getCompletedActions

public IAction[] getCompletedActions()
Description copied from interface: ActivityGroup
Returns all actions from this group that have been completed.

Specified by:
getCompletedActions in interface ActivityGroup

getPendingActions

public IAction[] getPendingActions()
Description copied from interface: ActivityGroup
Returns all actions from this group that have not yet started.

Specified by:
getPendingActions in interface ActivityGroup

getCurrentActions

public IAction[] getCurrentActions()
Description copied from interface: ActivityGroup
Returns all actions from this group that are currently being performed.

Specified by:
getCurrentActions in interface ActivityGroup

setActions

public void setActions(IAction[] actions)

addAction

public void addAction(IAction newAction)
Description copied from interface: ActionGroup
Adds the given newAction to this group. This group should not already contain newAction.

Specified by:
addAction in interface ActionGroup

removeAction

public boolean removeAction(IAction action)
Description copied from interface: ActionGroup
Removes the given oldAction from the group. oldAction must currently be contained by this group.

Specified by:
removeAction in interface ActionGroup