|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.kahina.core.breakpoint.TreeAutomaton
public class TreeAutomaton
Implements a tree automaton as used for tree pattern matching by Kahina's breakpoint system.
This special kind of bottom-up tree automaton operates on a tree it is monitoring.
It does not only annotate a static tree to determine whether it matches the encoded pattern,
but is also able to adapt to changes to the tree without recalculating everything,
if the component controlling changes in the tree structure (usually a subclass of KahinaTreeBehavior) announces the changes.
A tree automaton is usually compiled from a KahinaBreakpoint, which contains
If the associated breakpoint is active, the automaton will dispatch a KahinaTreeMatchEvent to its KahinaController as soon as the encoded pattern is found in the tree it monitors.
| Constructor Summary | |
|---|---|
TreeAutomaton(KahinaBreakpoint bp)
Class constructor specifying the breakpoint to be associated with the new automaton. |
|
| Method Summary | |
|---|---|
boolean |
annotate(int nodeID,
int stateID)
Annotates a single node in the tree with some state ID and checks whether this resulted in a change. |
Set<Integer> |
getAnnotations(int nodeID)
Retrieves the current annotations for a single tree node. |
Set<Integer> |
getChildAnnotations(int nodeID)
Retrieves the current annotations for all the children of a single tree node. |
KahinaController |
getController()
Gets the controller this automaton is informing about matches. |
void |
process(int nodeID)
Annotates a tree node with all possible labels according to the rules and recursively reannotates parents if it triggers a change in annotation. |
void |
setConstellationMatch(boolean constellationMatch)
Determine whether the automaton reports matches directly above new nodes twice. |
void |
setController(KahinaController ctrl)
Sets the controller this automaton is to inform about matches. |
void |
setTree(KahinaTree tree)
Sets or changes the tree this automaton is monitoring. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TreeAutomaton(KahinaBreakpoint bp)
KahinaBreakpoint when compiled.
bp - the breakpoint object to be associated with the new automaton| Method Detail |
|---|
public void setTree(KahinaTree tree)
tree - the tree model to be monitored by this automatonpublic void setConstellationMatch(boolean constellationMatch)
false, which is suitable in most contexts.
constellationMatch - true for extra reports, false to suppress thempublic KahinaController getController()
public void setController(KahinaController ctrl)
null, a controller must be determined for the breakpoint system to work.
ctrl - the controller this automaton is to inform about matchespublic void process(int nodeID)
nodeID - the node to be (re)annotated by the automaton
public boolean annotate(int nodeID,
int stateID)
nodeID - the node to be annotatedstateID - the state ID the node is to be annotated with
public Set<Integer> getAnnotations(int nodeID)
nodeID - addresses the node whose annotations we want to get
public Set<Integer> getChildAnnotations(int nodeID)
nodeID - addresses the node whose children's annotations we want to get
public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||