com.cra.bnet.engine
Class StateEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.cra.bnet.engine.StateEvent
All Implemented Interfaces:
Serializable

public class StateEvent
extends EventObject

A state-related event.

See Also:
Serialized Form

Nested Class Summary
static class StateEvent.StateEventType
          Type of state event.
 
Field Summary
static StateEvent.StateEventType STATE_ADDED
          The state added event type.
static StateEvent.StateEventType STATE_NAME_CHANGED
          The state name changed event type.
static StateEvent.StateEventType STATE_REMOVED
          The state removed event type.
static StateEvent.StateEventType STATE_REORDERED
          The state reordered event type.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
StateEvent(DiscreteNode node, String name, int index, StateEvent.StateEventType type)
          Creates a new state added, state removed, or state reordered StateEvent using the specified node, state name, state index, and event type.
StateEvent(DiscreteNode node, String oldStateName, String newStateName, int index)
          Creates a new state name changed StateEvent using the specified node, old state name, new state name, and state index.
 
Method Summary
 int getIndex()
          Returns the index of the state.
 String getNewName()
          Returns the new state name.
 DiscreteNode getNode()
          Returns the node this event occurred on.
 String getOldName()
          Returns the old state name.
 StateEvent.StateEventType getType()
          Returns the type of this state event.
 String toString()
          Returns a string representation of this state event.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATE_ADDED

public static final StateEvent.StateEventType STATE_ADDED
The state added event type.


STATE_REMOVED

public static final StateEvent.StateEventType STATE_REMOVED
The state removed event type.


STATE_NAME_CHANGED

public static final StateEvent.StateEventType STATE_NAME_CHANGED
The state name changed event type.


STATE_REORDERED

public static final StateEvent.StateEventType STATE_REORDERED
The state reordered event type.

Constructor Detail

StateEvent

public StateEvent(DiscreteNode node,
                  String name,
                  int index,
                  StateEvent.StateEventType type)
Creates a new state added, state removed, or state reordered StateEvent using the specified node, state name, state index, and event type. The event type can only be either STATE_ADDED, STATE_REMOVED, or STATE_REORDERED.

Parameters:
node - node the event occurred on.
name - name of the state.
index - index of the state.
type - either STATE_ADDED, STATE_REMOVED, or STATE_REORDERED.

StateEvent

public StateEvent(DiscreteNode node,
                  String oldStateName,
                  String newStateName,
                  int index)
Creates a new state name changed StateEvent using the specified node, old state name, new state name, and state index.

Parameters:
node - node the event occurred on.
oldStateName - old state name.
newStateName - new state name.
index - index of the state.
Method Detail

getIndex

public int getIndex()
Returns the index of the state. This method returns the following for the different types of events:

Returns:
index of the state.

getNewName

public String getNewName()
Returns the new state name. This method returns the following for the different types of events:

Returns:
the new state name.

getNode

public DiscreteNode getNode()
Returns the node this event occurred on.

Returns:
the node this event occurred on.

getOldName

public String getOldName()
Returns the old state name. This method returns the following for the different types of events:

Returns:
the old state name.

getType

public StateEvent.StateEventType getType()
Returns the type of this state event.

Returns:
the type of this state event.

toString

public String toString()
Returns a string representation of this state event.

Overrides:
toString in class EventObject
Returns:
a string representation of this state event.