uk.ac.ic.doc.scenebeans.activity
Interface Activity

All Known Implementing Classes:
ActivityBase

public interface Activity
extends Serializable

An Activity performs some simulation in repeated steps.


Method Summary
 void addAnimationListener(AnimationListener l)
          An AnimationEvent is posted to the event listeners when a finite activity completes or a periodic activity completes one period of simulation.
 ActivityRunner getActivityRunner()
          Returns the object that is responsible for calling the performActivity method of this activity.
 boolean isFinite()
          Returns true if this activity is finite, that is if it eventually runs to completion.
 void performActivity(double secs)
          Called periodically to perform the activity's behaviour.
 void removeAnimationListener(AnimationListener l)
          Removes an animation listener from the activity.
 void reset()
          Resets the activity so that it restarts its behaviour from its initial state.
 void setActivityRunner(ActivityRunner r)
          Sets the object that is responsible for calling the performActivity method of this activity.
 

Method Detail

isFinite

public boolean isFinite()
Returns true if this activity is finite, that is if it eventually runs to completion.
Returns:
true if the activity is finite, false otherwise.

setActivityRunner

public void setActivityRunner(ActivityRunner r)
Sets the object that is responsible for calling the performActivity method of this activity. This method is called by ActivityRunner objects when Activities are added to them.
Parameters:
r - The ActivityRunner that will run this activity.
Throws:
IllegalStateException - This activity already has an ActivityRunner

getActivityRunner

public ActivityRunner getActivityRunner()
Returns the object that is responsible for calling the performActivity method of this activity. An activity can be paused by removing it from its activity runner and resumed by adding it to its activity runner again.
Returns:
The ActivityRunner of this Activity.

addAnimationListener

public void addAnimationListener(AnimationListener l)
An AnimationEvent is posted to the event listeners when a finite activity completes or a periodic activity completes one period of simulation.
Parameters:
l - The listener to add.

removeAnimationListener

public void removeAnimationListener(AnimationListener l)
Removes an animation listener from the activity.
Parameters:
l - The listener to remove.

reset

public void reset()
Resets the activity so that it restarts its behaviour from its initial state.

performActivity

public void performActivity(double secs)
Called periodically to perform the activity's behaviour. The duration of the animation frame, in seconds.