Package net.emustudio.edigen.passes
Class GroupVisitor
- java.lang.Object
-
- net.emustudio.edigen.Visitor
-
- net.emustudio.edigen.passes.GroupVisitor
-
public class GroupVisitor extends Visitor
Groups sibling masks or patterns containing the same bit sequences into one node.All children of the original nodes will be attached to the grouped node.
Expectation of a tree at input, e.g:
Rule Mask (111) Pattern (110) Variant Mask (111) Pattern (111) VariantExpectation of the tree at output:
Rule Mask (111) Pattern (110) Variant Pattern (111) Variant
-
-
Constructor Summary
Constructors Constructor Description GroupVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidvisit(Mask mask)If the current task is to save bits, saves them and returns the control; otherwise groups the mask's children and thus continues the traversal.voidvisit(Pattern pattern)If the current task is to save bits, saves them and returns the control; otherwise groups the pattern's children and thus continues the traversal.voidvisit(Rule rule)Groups the rule recursively.
-
-
-
Method Detail
-
visit
public void visit(Rule rule) throws SemanticException
Groups the rule recursively.- Overrides:
visitin classVisitor- Parameters:
rule- the rule node- Throws:
SemanticException- never
-
visit
public void visit(Mask mask) throws SemanticException
If the current task is to save bits, saves them and returns the control; otherwise groups the mask's children and thus continues the traversal.- Overrides:
visitin classVisitor- Parameters:
mask- the mask node- Throws:
SemanticException- never
-
visit
public void visit(Pattern pattern) throws SemanticException
If the current task is to save bits, saves them and returns the control; otherwise groups the pattern's children and thus continues the traversal.- Overrides:
visitin classVisitor- Parameters:
pattern- the pattern node- Throws:
SemanticException- never
-
-