Class 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)
             Variant
     

    Expectation 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
      void visit​(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.
      void visit​(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.
      void visit​(Rule rule)
      Groups the rule recursively.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GroupVisitor

        public GroupVisitor()
    • Method Detail

      • 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:
        visit in class Visitor
        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:
        visit in class Visitor
        Parameters:
        pattern - the pattern node
        Throws:
        SemanticException - never