de.ls5.jlearn.shared
Class StateImpl

java.lang.Object
  extended by de.ls5.jlearn.shared.StateImpl
All Implemented Interfaces:
State, Serializable

public class StateImpl
extends Object
implements State

Author:
merten
See Also:
Serialized Form

Constructor Summary
protected StateImpl(int sigma, Automaton owner, int id)
           
 
Method Summary
 boolean equals(Object obj)
           
 Alphabet getAlphabet()
          Return the complete Alphabet to be considered at this state, including eventual local alphabet symbols.
 int getId()
          Retrieve the id of this state.
 Symbol[] getInputSymbols()
          Return all input-symbols for which a transition exists.
 Symbol getOutput()
          Return output-symbol associated with this state.
 Symbol[] getOutputSymbols()
          Return all output-symbols connected with existing transitions.
 Automaton getOwner()
          Return the Automaton this state is part of.
 StateImpl getParent()
           
 Symbol getParentSymbol()
           
 List<Symbol> getPathFromRoot()
           
 int getRootDistance()
           
 State[] getSuccessorStates()
          Return all states reached by transitions of this state.
 Symbol getTransitionOutput(Symbol letter)
          Get output-symbol of the transition triggered by the supplied input-symbol
 State getTransitionState(Symbol letter)
          Get state the transition triggered by the supplied input-symbol leads to.
 int hashCode()
           
 boolean isWellDefined()
          Determine if for every Symbol of the input-Alphabet a transition exists.
protected  void setId(int id)
           
 boolean setOutput(Symbol output)
          Set output-symbol for this state as e.g. used in Moore automata.
 void setParent(StateImpl parent, Symbol symbol)
           
 boolean setTransition(Symbol input, State newstate, Symbol output)
          Create a transition for a given input-symbol, leading into the supplied successor state and prodcing the supplied output-symbol.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateImpl

protected StateImpl(int sigma,
                    Automaton owner,
                    int id)
Method Detail

getOwner

public Automaton getOwner()
Description copied from interface: State
Return the Automaton this state is part of.

Specified by:
getOwner in interface State
Returns:
Automaton this state is part of

getParent

public StateImpl getParent()

getParentSymbol

public Symbol getParentSymbol()

setParent

public void setParent(StateImpl parent,
                      Symbol symbol)

getRootDistance

public int getRootDistance()

getPathFromRoot

public List<Symbol> getPathFromRoot()

isWellDefined

public boolean isWellDefined()
Description copied from interface: State
Determine if for every Symbol of the input-Alphabet a transition exists.

Specified by:
isWellDefined in interface State
Returns:
true if there is a transition for every input-symbol, false otherwise

getTransitionOutput

public Symbol getTransitionOutput(Symbol letter)
Description copied from interface: State
Get output-symbol of the transition triggered by the supplied input-symbol

Specified by:
getTransitionOutput in interface State
Parameters:
letter - input-symbol
Returns:
output-symbol for triggered transition

getInputSymbols

public Symbol[] getInputSymbols()
Description copied from interface: State
Return all input-symbols for which a transition exists.

Specified by:
getInputSymbols in interface State
Returns:
array of input-symbols

getOutputSymbols

public Symbol[] getOutputSymbols()
Description copied from interface: State
Return all output-symbols connected with existing transitions.

Specified by:
getOutputSymbols in interface State
Returns:
array of output-symbols

getTransitionState

public State getTransitionState(Symbol letter)
Description copied from interface: State
Get state the transition triggered by the supplied input-symbol leads to.

Specified by:
getTransitionState in interface State
Parameters:
letter - input-symbol
Returns:
state reached by triggered transition

getSuccessorStates

public State[] getSuccessorStates()
Description copied from interface: State
Return all states reached by transitions of this state.

Specified by:
getSuccessorStates in interface State
Returns:
array of successor states.

setTransition

public boolean setTransition(Symbol input,
                             State newstate,
                             Symbol output)
Description copied from interface: State
Create a transition for a given input-symbol, leading into the supplied successor state and prodcing the supplied output-symbol.

Specified by:
setTransition in interface State
Parameters:
input - input-symbol
newstate - state the transition leads into
output - output-symbol produced by transition
Returns:
true if transition was created, false otherwise

setOutput

public boolean setOutput(Symbol output)
Description copied from interface: State
Set output-symbol for this state as e.g. used in Moore automata.

Specified by:
setOutput in interface State
Parameters:
output - output-symbol of this state
Returns:
true if output was set, false otherwise

getOutput

public Symbol getOutput()
Description copied from interface: State
Return output-symbol associated with this state.

Specified by:
getOutput in interface State
Returns:
output-symbol of this state

getAlphabet

public Alphabet getAlphabet()
Description copied from interface: State
Return the complete Alphabet to be considered at this state, including eventual local alphabet symbols.

Specified by:
getAlphabet in interface State
Returns:
Alphabet to be considered at this state

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getId

public int getId()
Description copied from interface: State
Retrieve the id of this state. The id is assigned by the Automaton upon creation of the state. Usually, the initial state will have id 0.

Specified by:
getId in interface State
Returns:
assigned id of state

setId

protected void setId(int id)


Copyright © 2011. All Rights Reserved.