net.nexttext.behaviour.control
Class Descend

java.lang.Object
  extended by net.nexttext.behaviour.AbstractAction
      extended by net.nexttext.behaviour.control.Descend
All Implemented Interfaces:
Action

public class Descend
extends AbstractAction

Perform the given action on the TextObject's descendants.

The given action is not performed on the TextObject passed to the behave method, but rather on its descendants. The number of levels to descend can be specified upon construction. If the TextObject has no descendants at the appropriate level, then nothing is done.


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.nexttext.behaviour.Action
Action.ActionResult
 
Constructor Summary
Descend(Action descendantAction)
           
Descend(Action descendantAction, int depth)
          Construct a new Descend action with the given action and depth.
 
Method Summary
 Action.ActionResult behave(TextObject to)
          Apply the given action to the TextObject's descendants.
 void complete(TextObject to)
          End this action for this object.
 
Methods inherited from class net.nexttext.behaviour.AbstractAction
behave, behave, getDisplayName, getRequiredProperties, makeBehaviour, properties, setDisplayName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Descend

public Descend(Action descendantAction)

Descend

public Descend(Action descendantAction,
               int depth)
Construct a new Descend action with the given action and depth.

Parameters:
depth - is a non-negative integer indicating the number of levels to descend in the TextObject hierarchy to get the TextObjects to be acted on.
Method Detail

behave

public Action.ActionResult behave(TextObject to)
Apply the given action to the TextObject's descendants.

The results of the action calls are combined using the method described in Action.ActionResult.

Specified by:
behave in interface Action
Overrides:
behave in class AbstractAction

complete

public void complete(TextObject to)
End this action for this object.

Specified by:
complete in interface Action
Overrides:
complete in class AbstractAction