org.apache.shale.dialog.basic.config
Class AbstractState

java.lang.Object
  extended by org.apache.shale.dialog.basic.config.AbstractState
All Implemented Interfaces:
State
Direct Known Subclasses:
ActionStateImpl, SubdialogStateImpl, ViewStateImpl

public abstract class AbstractState
extends Object
implements State

Abstract base class for State definitions. Each state is owned by exactly one owning Dialog. While an application is running, Dialog (and the constituent States and other configuration information) is immutable, so that it may be shared by multiple simultaneous paths of execution.

Since:
1.0.4

Constructor Summary
AbstractState()
           
 
Method Summary
 void addTransition(Transition transition)
          Add the specified Transition to the Transitions owned by this State.
 Transition findTransition(String outcome)
          Return the Transition for the specified logical outcome, if any; otherwise, return null.
 Dialog getDialog()
          

Return the Dialog that owns this State.

 String getName()
          

Return the identifier of this State, which must be unique among the States owned by the same Dialog.

 Iterator getTransitionOutcomes()
          

Return an Iterator over the logical outcomes of local Transitions for this State.

 void removeTransition(Transition transition)
          Remove the specified Transition from the Transitions owned by this State, if it is currently registered.
 void setDialog(Dialog dialog)
          Set the Dialog that owns this State.
 void setName(String name)
          Set the identifier of this State, which must be unique among the States owned by the same Dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractState

public AbstractState()
Method Detail

getDialog

public Dialog getDialog()

Return the Dialog that owns this State.

Specified by:
getDialog in interface State
Returns:
The Dialog this State belongs to

getName

public String getName()

Return the identifier of this State, which must be unique among the States owned by the same Dialog.

Specified by:
getName in interface State
Returns:
The identifier for this State

getTransitionOutcomes

public Iterator getTransitionOutcomes()

Return an Iterator over the logical outcomes of local Transitions for this State. If there are no such Transitions, an empty Iterator is returned.

Specified by:
getTransitionOutcomes in interface State
Returns:
An Iterator over the logical outcomes of local Transitions for this State

findTransition

public Transition findTransition(String outcome)

Return the Transition for the specified logical outcome, if any; otherwise, return null.

Specified by:
findTransition in interface State
Parameters:
outcome - Logical outcome for which to return a Transition
Returns:
The matching Transition

addTransition

public void addTransition(Transition transition)
                   throws IllegalArgumentException

Add the specified Transition to the Transitions owned by this State.

Parameters:
transition - Transition to be added
Throws:
IllegalArgumentException - if the specified Transition cannot be added to this State

removeTransition

public void removeTransition(Transition transition)

Remove the specified Transition from the Transitions owned by this State, if it is currently registered. Otherwise, do nothing.

Parameters:
transition - Transition to be removed

setDialog

public void setDialog(Dialog dialog)

Set the Dialog that owns this State.

Parameters:
dialog - New owning Dialog

setName

public void setName(String name)

Set the identifier of this State, which must be unique among the States owned by the same Dialog.

Parameters:
name - New identifier


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.