|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectProtocolLearner.FSAutomaton
public class FSAutomaton
Abstract Finite State Automaton class. It provides basic operations to populate and manipulate finite state automaton. This is an extended version of the FSA since it allows sequences of output messages to be associated with the input sequences.
Constructor Summary | |
---|---|
FSAutomaton()
Constructor. |
Method Summary | |
---|---|
boolean |
addOuputSymbol(int srcState,
int dstState,
java.lang.String inSymbol,
java.util.ArrayList<java.lang.String> outSymbols)
Add an output message to an array of output message sequences for the particular input on a given state |
int |
addState()
Adds a new state to the set of states |
int |
addTransition(int srcState,
FSATransition transition)
Add a transition object to the automaton |
int |
addTransition(int srcState,
java.lang.String intputSymbol,
int dstState)
Adds a next transition function to the automaton |
int |
addTransition(int srcState,
java.lang.String inputSymbol,
int dstState,
java.util.ArrayList<java.lang.String> outputSymbols)
Adds a next transition function to the automaton |
boolean |
checkIfStatesAreIdentical(int stateID1,
int stateID2)
Function compares two states based on their transitions and colors of their children. |
boolean |
checkOutputMsg(int srcState,
java.lang.String input,
java.util.ArrayList<java.lang.String> output)
Check if the output strings of the given input symbol in the automaton math to the output symbols of the given input |
int |
checkTransition(int srcState,
java.lang.String input)
Checks if a transition exists from a states based on the certain input |
int |
getInitStateIndex()
Returns the index of the initial state |
java.awt.Color |
getStateColor(int stateID)
Returns the color of the state |
int |
getStateHeight(int stateID)
Returns the height of the state |
java.util.HashMap<java.lang.Integer,java.awt.Color> |
getStates()
Returns all states in the automaton |
java.util.ArrayList<java.lang.Integer> |
getStatesWithSpecHeight(int height)
Returns the array list of states with a particular height |
java.util.Set<java.lang.Integer> |
getStatesWithTrans()
Returns the list of states that have transitions |
java.util.ArrayList<FSATransition> |
getStateTransition(int stateID)
Returns the set of transition functions for a state. |
boolean |
removeSubtree(int subtreeStateID)
A recursive function to remove a subtree from a FSA |
boolean |
removeTransitionFromState(int stateID,
int dstStateID)
A function that remove a specific transition for some input from a state |
boolean |
setStateColor(int stateID,
java.awt.Color c)
Modifies the color of a particular state |
boolean |
setStateHeight(int stateID,
int height)
Sets the height of the state to a specific value |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FSAutomaton()
Method Detail |
---|
public int getInitStateIndex()
public int addState()
public int addTransition(int srcState, java.lang.String intputSymbol, int dstState)
srcState
- Source stateinputSymbol
- Input symboldstState
- Destination state
public int addTransition(int srcState, java.lang.String inputSymbol, int dstState, java.util.ArrayList<java.lang.String> outputSymbols)
srcState
- source state IDinputSymbol
- input symboldstState
- destination stateoutputSymbols
- A list of output symbols associated with the input
public int checkTransition(int srcState, java.lang.String input)
srcState
- Source state IDinput
- Input string to be searched for in the set of transitions of the state
public boolean checkOutputMsg(int srcState, java.lang.String input, java.util.ArrayList<java.lang.String> output)
src
- State Source state IDinput
- Input symboloutput
- Output message sequence
public boolean addOuputSymbol(int srcState, int dstState, java.lang.String inSymbol, java.util.ArrayList<java.lang.String> outSymbols)
srcState
- Source state IDdstState
- Destination state IDinSymbol
- Input symboloutSymbols
- Output message sequence
public java.util.HashMap<java.lang.Integer,java.awt.Color> getStates()
public boolean setStateColor(int stateID, java.awt.Color c)
State
- ID
public java.util.Set<java.lang.Integer> getStatesWithTrans()
public java.util.ArrayList<FSATransition> getStateTransition(int stateID)
This method returns null if no state ID is present in the automaton.
stateID
- Unique state identifier
FSAutomaton
public java.awt.Color getStateColor(int stateID)
statID
- Unique state ID
public boolean setStateHeight(int stateID, int height)
stateID
- Unique state IDheight
- New state height
public int getStateHeight(int stateID)
stateID
- Unique state ID
public java.util.ArrayList<java.lang.Integer> getStatesWithSpecHeight(int height)
height
- Height to be searched for among all states
public boolean checkIfStatesAreIdentical(int stateID1, int stateID2)
stateID1
- The first unique state IDstateID2
- The second unique state ID
public boolean removeSubtree(int subtreeStateID)
substreeStateID
- Unique state ID of the subtree
public boolean removeTransitionFromState(int stateID, int dstStateID)
stateID
- Unique state ID for the state of which transition should be removeddstStateID
- Unique state ID of the destination state of the transition
public int addTransition(int srcState, FSATransition transition)
transition
- A new transition object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |