|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.nexttext.behaviour.AbstractBehaviour
public abstract class AbstractBehaviour
AbstractBehaviours act on a list of TextObjects, and are included in the simulation.
The TextObjects to act on are stored in a list internal to the Behaviour. To include an AbstractBehaviour in the simulation, it is added to the book, which calls the behaveAll() method, triggering the behaviour to call actions on each of its TextObjects. Subclasses of AbstractBehaviour differ in how they implement the behaveAll() method.
Constructor Summary | |
---|---|
AbstractBehaviour()
|
Method Summary | |
---|---|
void |
addObject(TextObject to)
Add a TextObject to this Behaviour's list of objects to act on. |
abstract void |
behaveAll()
Behave on every TextObject in the list. |
java.lang.String |
getDisplayName()
Returns the display name of this instance. |
void |
removeObject(TextObject to)
Stop this behaviour from acting on a TextObject. |
void |
setDisplayName(java.lang.String name)
Sets the display name of this Action instance to the specified string. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractBehaviour()
Method Detail |
---|
public void setDisplayName(java.lang.String name)
public java.lang.String getDisplayName()
public abstract void behaveAll()
This method is called as part of the simulation, and when a behaviour has been added to the Book. Different subclasses will implement this method in different ways.
public void addObject(TextObject to)
Each Action requires a specific set of properties in TextObjects that it acts on. These properties are added to the TextObjects when they are added to a behaviour for each Action which is a part of that behaviour. Subclasses of AbstractBehaviour have to be sure to perform this necessary step, by overriding this method, (but don't forget to call super.addObject()). Behaviour provides a good example of how to do this.
If the TextObject is already in the set, nothing will be done, a single remove will still remove the object from the list.
public void removeObject(TextObject to)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |