org.kahina.core.breakpoint
Class TreeAutomatonRule

java.lang.Object
  extended by org.kahina.core.breakpoint.TreeAutomatonRule

public class TreeAutomatonRule
extends Object

Encodes a rule within a TreeAutomaton.

A rule states that the automaton is to annotate with some assignedLabel every node where

  1. the children's annotations include a given set of integers, the requiredChildAnnotations
  2. the node matches a given tree node pattern, the pattern


Field Summary
static boolean verbose
           
 
Constructor Summary
TreeAutomatonRule()
          Class contructor.
 
Method Summary
 int getAssignedLabel()
          Gets the annotation that is added to nodes to which the rule applies.
 TreeNodePattern getPattern()
          Gets the tree node pattern required for the rule to apply.
 Set<Integer> getRequiredChildAnnotations()
          Gets the set of child annotations required for the rule to apply.
 boolean ruleApplies(TreeAutomaton aut, int nodeID)
          Check whether this rule applies to a tree node in an automaton at the current state.
 void setAssignedLabel(int assignedLabel)
          Sets the annotation to be added to nodes to which the rule applies.
 void setPattern(TreeNodePattern pattern)
          Changes the tree node pattern required for the rule to apply.
 void setRequiredChildAnnotations(Set<Integer> requiredChildAnnotations)
          Changes the set of child annotations required for the rule to apply.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

verbose

public static boolean verbose
Constructor Detail

TreeAutomatonRule

public TreeAutomatonRule()
Class contructor. The default rule matches anything and annotates nothing.

Method Detail

ruleApplies

public boolean ruleApplies(TreeAutomaton aut,
                           int nodeID)
Check whether this rule applies to a tree node in an automaton at the current state.

Parameters:
aut - the automaton that is to be checked (monitoring some tree structure)
nodeID - the tree node to be checked
Returns:
true if this rule applies, false otherwise

toString

public String toString()
Overrides:
toString in class Object

setRequiredChildAnnotations

public void setRequiredChildAnnotations(Set<Integer> requiredChildAnnotations)
Changes the set of child annotations required for the rule to apply.

Parameters:
requiredChildAnnotations - a set of integers representing required child annotations

getRequiredChildAnnotations

public Set<Integer> getRequiredChildAnnotations()
Gets the set of child annotations required for the rule to apply.

Returns:
a set of integers representing the required child annotations

setPattern

public void setPattern(TreeNodePattern pattern)
Changes the tree node pattern required for the rule to apply.

Parameters:
pattern - a tree node pattern defining when the rule is to apply

getPattern

public TreeNodePattern getPattern()
Gets the tree node pattern required for the rule to apply.

Returns:
pattern a tree node pattern defining when the rule applies

setAssignedLabel

public void setAssignedLabel(int assignedLabel)
Sets the annotation to be added to nodes to which the rule applies.

Parameters:
assignedLabel - a stateID a matching node is to be annotated with

getAssignedLabel

public int getAssignedLabel()
Gets the annotation that is added to nodes to which the rule applies.

Returns:
the stateID that matching nodes are annotated with