com.karneim.util.collection.set
Class SAutomaton.StatePro

java.lang.Object
  extended by com.karneim.util.collection.set.SAutomaton.StatePro
All Implemented Interfaces:
IStatePro
Enclosing class:
SAutomaton

protected class SAutomaton.StatePro
extends java.lang.Object
implements IStatePro


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.karneim.util.collection.set.IStatePro
IStatePro.IChangeListener, IStatePro.ITransition, IStatePro.IVisitListener
 
Field Summary
protected  java.util.LinkedList changeListeners
           
protected  AutomatonSet_String.SState state
           
protected  Automaton.IStateChangedListener stateChangedListener
           
protected  Automaton.IStateVisitedListener stateVisitedListener
           
protected  java.util.LinkedList visitListeners
           
 
Constructor Summary
protected SAutomaton.StatePro(AutomatonSet_String.SState state)
           
 
Method Summary
 void addChangeListener(IStatePro.IChangeListener listener)
           
 IStatePro.ITransition addTransition(ISet_char charSet, IStatePro toState)
          Adds a new transition to this state.
 void addVisitListener(IStatePro.IVisitListener listener)
           
protected  void finalize()
           
 StateProSet getAllReachableStates()
          Returns all states that are reachable from this state through it's transitions and so on.
 IStatePro.ITransition[] getAllTransitions()
          returns all transitions (normal and epsilon transitions) of this state.
 IStatePro.ITransition[] getETransitions()
           
 int getStateNumber()
           
 IStatePro.ITransition[] getTransitions()
           
 boolean isFinal()
           
protected  SAutomaton parent()
           
 void removeAllTransitions()
           
 boolean removeChangeListener(IStatePro.IChangeListener listener)
           
 boolean removeTransition(IStatePro.ITransition transition)
          Removes the specified transition from this state.
 boolean removeVisitListener(IStatePro.IVisitListener listener)
           
 void setFinal(boolean isFinal)
          Makes this state final or non final.
 java.lang.String toString()
           
 IState visit()
          Visits this state with an epsilon transition and returns its epsilon closure.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

stateVisitedListener

protected final Automaton.IStateVisitedListener stateVisitedListener

stateChangedListener

protected final Automaton.IStateChangedListener stateChangedListener

visitListeners

protected java.util.LinkedList visitListeners

changeListeners

protected java.util.LinkedList changeListeners

state

protected final AutomatonSet_String.SState state
Constructor Detail

SAutomaton.StatePro

protected SAutomaton.StatePro(AutomatonSet_String.SState state)
Method Detail

addVisitListener

public void addVisitListener(IStatePro.IVisitListener listener)
Specified by:
addVisitListener in interface IStatePro

removeVisitListener

public boolean removeVisitListener(IStatePro.IVisitListener listener)
Specified by:
removeVisitListener in interface IStatePro

addChangeListener

public void addChangeListener(IStatePro.IChangeListener listener)
Specified by:
addChangeListener in interface IStatePro

removeChangeListener

public boolean removeChangeListener(IStatePro.IChangeListener listener)
Specified by:
removeChangeListener in interface IStatePro

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

parent

protected SAutomaton parent()

isFinal

public boolean isFinal()
Specified by:
isFinal in interface IStatePro
Returns:
true if the state is a final state else false

setFinal

public void setFinal(boolean isFinal)
Description copied from interface: IStatePro
Makes this state final or non final.

Specified by:
setFinal in interface IStatePro

visit

public IState visit()
Description copied from interface: IStatePro
Visits this state with an epsilon transition and returns its epsilon closure.

Specified by:
visit in interface IStatePro
Returns:
the epsilon closure of this state

addTransition

public IStatePro.ITransition addTransition(ISet_char charSet,
                                           IStatePro toState)
Description copied from interface: IStatePro
Adds a new transition to this state. The transition is defined by it's character set charSet and it's destionation state toState, so that you can transit from this state to the destination state only with a character contained in charSet. There is only one exception, if charSet is null, an epsilon transition will be added, which means that there are no chars needed to get to the destinationState toState; in other words a state that has an epsilon transition can get through this epsilon transition to the destination state toState without any char, so that we can say that toState melts into the state.

Specified by:
addTransition in interface IStatePro
Parameters:
charSet - the characters for this transition
toState - the destination state where to transit to
Returns:
the new transition

removeTransition

public boolean removeTransition(IStatePro.ITransition transition)
Description copied from interface: IStatePro
Removes the specified transition from this state.
important: the specified transition must be a transition created via this state's addTransition method, otherwise an IllegalArgumentException is thrown

Specified by:
removeTransition in interface IStatePro
Returns:
true if transition was a transition of this state else false

removeAllTransitions

public void removeAllTransitions()
Specified by:
removeAllTransitions in interface IStatePro

getAllReachableStates

public StateProSet getAllReachableStates()
Description copied from interface: IStatePro
Returns all states that are reachable from this state through it's transitions and so on.
important: this state is only element of the returned set, if it is an element of a loop

Specified by:
getAllReachableStates in interface IStatePro
Returns:
all reachable states as a set

getTransitions

public IStatePro.ITransition[] getTransitions()
Specified by:
getTransitions in interface IStatePro

getETransitions

public IStatePro.ITransition[] getETransitions()
Specified by:
getETransitions in interface IStatePro

getAllTransitions

public IStatePro.ITransition[] getAllTransitions()
returns all transitions (normal and epsilon transitions) of this state. the result array contains first all epsilon transitions and then all normal transitions

Specified by:
getAllTransitions in interface IStatePro

getStateNumber

public int getStateNumber()
Specified by:
getStateNumber in interface IStatePro

toString

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