Framework Professional Edition Package


com.prosyst.util.asm
Class Transition

java.lang.Object
  extended by com.prosyst.util.asm.Transition

public class Transition
extends java.lang.Object

The Transition object specifies a rule how the state of the ASM is changed. It specifies initial state and target state. There may be special transitions that has only target state and they are possible at any time. Those transition are named 'internal' transitions. The transition can be guarded by a 'guard condition'. It will allow or disallow the execution of the transition.

Author:
Valentin Valchev (v_valchev@prosyst.bg)

Constructor Summary
Transition()
          Creates an empty, but invalid transition.
Transition(java.lang.String name, java.lang.String toState)
          Creates an internal transition with specified name, and target state.
Transition(java.lang.String name, java.lang.String fromState, java.lang.String toState)
          Creates a regular transition with the specified name, that will move to the target state if the current state is equal to the source state.
Transition(java.lang.String name, java.lang.String fromState, java.lang.String toState, org.osgi.framework.Filter filter)
          Creates a regular transition with the specified name, that will move to the target state if the current state is equal to the source state.
 
Method Summary
 org.osgi.framework.Filter getFilter()
          Retrieves the guard condition of the transition
 java.lang.String getFromState()
          Retrieves the source state
 java.lang.String getName()
          Retrieves the name of the transition
 java.lang.String getToState()
          Retrieves the target state
 void setFilter(org.osgi.framework.Filter filter)
          Sets the guard condition of the transition
 void setFromState(java.lang.String fromState)
          Sets the source state
 void setName(java.lang.String name)
          Sets the name of the transition
 void setToState(java.lang.String toState)
          Sets the target state
 boolean testGuardCondition(StateMachine context)
          Validates the guard condition according the guard condition.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Transition

public Transition()
Creates an empty, but invalid transition. To make it valid, the "toState" and the "name" properties must be set. This constructor is added just because to be Java Bean compatible.


Transition

public Transition(java.lang.String name,
                  java.lang.String toState)
Creates an internal transition with specified name, and target state. You can still make it regular transition if you specify a source state. The name is used in the StateMachineListener.executing(String, StateMachine)method.

Parameters:
name - the name of transition
toState - the target state

Transition

public Transition(java.lang.String name,
                  java.lang.String fromState,
                  java.lang.String toState)
Creates a regular transition with the specified name, that will move to the target state if the current state is equal to the source state.

Parameters:
name - the name of the transition
fromState - the source state that ASM should be, in order to start the execution of the transition
toState - the target state that ASM would have, when the transition is completed.

Transition

public Transition(java.lang.String name,
                  java.lang.String fromState,
                  java.lang.String toState,
                  org.osgi.framework.Filter filter)
Creates a regular transition with the specified name, that will move to the target state if the current state is equal to the source state. Additionally, that transition has a guard condition attached.

Parameters:
name - the name of the transition
fromState - the source state that ASM should be, in order to start the execution of the transition
toState - the target state that ASM would have, when the transition is completed.
filter - the filter, specifying the guard condition. The state machine matches the filter to it's properties.
Method Detail

getFromState

public java.lang.String getFromState()
Retrieves the source state

Returns:
Returns the fromState.

setFromState

public void setFromState(java.lang.String fromState)
Sets the source state

Parameters:
fromState - The fromState to set.

getToState

public java.lang.String getToState()
Retrieves the target state

Returns:
Returns the toState.

setToState

public void setToState(java.lang.String toState)
Sets the target state

Parameters:
toState - The toState to set.

getName

public java.lang.String getName()
Retrieves the name of the transition

Returns:
Returns the name.

setName

public void setName(java.lang.String name)
Sets the name of the transition

Parameters:
name - The name to set.

getFilter

public org.osgi.framework.Filter getFilter()
Retrieves the guard condition of the transition

Returns:
Returns the filter.

setFilter

public void setFilter(org.osgi.framework.Filter filter)
Sets the guard condition of the transition

Parameters:
filter - The filter to set.

testGuardCondition

public boolean testGuardCondition(StateMachine context)
Validates the guard condition according the guard condition.

Parameters:
context - the state machine
Returns:
If guard condition is not set, this method will always return true. Otherwise will return the result of the Filter.match() method.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved