edu.umass.cs.sase.query
Class State

java.lang.Object
  extended by edu.umass.cs.sase.query.State

public class State
extends java.lang.Object

This class represents a state from NFA.

Author:
haopeng

Constructor Summary
State(int order, java.lang.String tag, java.lang.String eventType, java.lang.String stateType)
           
State(java.lang.String nfaLine, int order)
          Constructs a state based on a line in the nfa file, and the order
 
Method Summary
 void addPredicate(java.lang.String pDescription)
          Adds a predicate to this state based on the given description.
 boolean canStartWithEvent(Event e)
           
 Edge[] getEdges()
           
 Edge getEdges(int order)
           
 java.lang.String getEventType()
           
 java.lang.String getNfaLine()
           
 int getOrder()
           
 java.lang.String getStateType()
           
 java.lang.String getTag()
           
 boolean isAfterNegation()
           
 boolean isBeforeNegation()
           
 boolean isEnding()
           
 boolean isKleeneClosure()
           
 boolean isNegation()
           
 boolean isStart()
           
 int parseEdgeNumber(java.lang.String predicateLeft)
          Judges the edge type, "take" or "begin"
 void parseEquation(java.lang.String equation)
          Parses the formulas in the query, e.g.: price > 100
 java.lang.String parseRightStateNumber(java.lang.String original)
          Parses the state number of the right operand
 void parseState(java.lang.String stateLine)
          Parses the description for state, e.g.: state = 1, type = normal/kleeneclosure/negation
 java.lang.String replaceLeftStateNumber(java.lang.String original)
          Used to replace the state number of the left operand
 java.lang.String replaceRightStateNumber(java.lang.String original)
          Used to replace the state number of the right operand
 void setAfterNegation(boolean isAfterNegation)
           
 void setBeforeNegation(boolean isBeforeNegation)
           
 void setEdges(Edge[] edges)
           
 void setEnding(boolean isEnding)
           
 void setEventType(java.lang.String eventType)
           
 void setKleeneClosure(boolean isKleeneClosure)
           
 void setNegation(boolean isNegation)
           
 void setNfaLine(java.lang.String nfaLine)
           
 void setOrder(int order)
           
 void setStart(boolean isStart)
           
 void setStateType(java.lang.String stateType)
           
 void setTag(java.lang.String tag)
           
 java.lang.String toString()
          Self description
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

State

public State(java.lang.String nfaLine,
             int order)
Constructs a state based on a line in the nfa file, and the order

Parameters:
nfaLine - the line in the nfa file
order - the order of this state

State

public State(int order,
             java.lang.String tag,
             java.lang.String eventType,
             java.lang.String stateType)
Method Detail

addPredicate

public void addPredicate(java.lang.String pDescription)
Adds a predicate to this state based on the given description.

Parameters:
pDescription -

replaceLeftStateNumber

public java.lang.String replaceLeftStateNumber(java.lang.String original)
Used to replace the state number of the left operand

Parameters:
original -
Returns:
the replaced string

replaceRightStateNumber

public java.lang.String replaceRightStateNumber(java.lang.String original)
Used to replace the state number of the right operand

Parameters:
original -
Returns:
the replaced string

parseRightStateNumber

public java.lang.String parseRightStateNumber(java.lang.String original)
Parses the state number of the right operand

Parameters:
original -
Returns:
the parsed state number

parseEdgeNumber

public int parseEdgeNumber(java.lang.String predicateLeft)
Judges the edge type, "take" or "begin"

Parameters:
predicateLeft -
Returns:
1 for "take", 0 for "begin"

parseState

public void parseState(java.lang.String stateLine)
Parses the description for state, e.g.: state = 1, type = normal/kleeneclosure/negation

Parameters:
stateLine - the description for this state

parseEquation

public void parseEquation(java.lang.String equation)
Parses the formulas in the query, e.g.: price > 100

Parameters:
equation - the formula string

toString

public java.lang.String toString()
Self description

Overrides:
toString in class java.lang.Object

canStartWithEvent

public boolean canStartWithEvent(Event e)
                          throws net.sourceforge.jeval.EvaluationException
Throws:
net.sourceforge.jeval.EvaluationException

getEventType

public java.lang.String getEventType()
Returns:
the eventType

setEventType

public void setEventType(java.lang.String eventType)
Parameters:
eventType - the eventType to set

getOrder

public int getOrder()
Returns:
the order

setOrder

public void setOrder(int order)
Parameters:
order - the order to set

isStart

public boolean isStart()
Returns:
the isStart

setStart

public void setStart(boolean isStart)
Parameters:
isStart - the isStart to set

isEnding

public boolean isEnding()
Returns:
the isEnding

setEnding

public void setEnding(boolean isEnding)
Parameters:
isEnding - the isEnding to set

isKleeneClosure

public boolean isKleeneClosure()
Returns:
the isKleeneClosure

setKleeneClosure

public void setKleeneClosure(boolean isKleeneClosure)
Parameters:
isKleeneClosure - the isKleeneClosure to set

getNfaLine

public java.lang.String getNfaLine()
Returns:
the nfaLine

setNfaLine

public void setNfaLine(java.lang.String nfaLine)
Parameters:
nfaLine - the nfaLine to set

getStateType

public java.lang.String getStateType()
Returns:
the stateType

setStateType

public void setStateType(java.lang.String stateType)
Parameters:
stateType - the stateType to set

getEdges

public Edge[] getEdges()
Returns:
the edges

getEdges

public Edge getEdges(int order)

setEdges

public void setEdges(Edge[] edges)
Parameters:
edges - the edges to set

isNegation

public boolean isNegation()
Returns:
the isNegation

setNegation

public void setNegation(boolean isNegation)
Parameters:
isNegation - the isNegation to set

isBeforeNegation

public boolean isBeforeNegation()
Returns:
the isBeforeNegation

setBeforeNegation

public void setBeforeNegation(boolean isBeforeNegation)
Parameters:
isBeforeNegation - the isBeforeNegation to set

isAfterNegation

public boolean isAfterNegation()
Returns:
the isAfterNegation

setAfterNegation

public void setAfterNegation(boolean isAfterNegation)
Parameters:
isAfterNegation - the isAfterNegation to set

getTag

public java.lang.String getTag()
Returns:
the tag

setTag

public void setTag(java.lang.String tag)
Parameters:
tag - the tag to set