Class CloneHelper


  • class CloneHelper
    extends java.lang.Object
    This class is mainly used for handling the cloning of an expression tree. Note this is the shallow copy of the tree. That means I do not modify or copy the expression other than these expressions: AND, OR, NOT, (), MULTI-AND, MULTI-OR. Since the CNF conversion only change the condition part of the tree.
    • Constructor Summary

      Constructors 
      Constructor Description
      CloneHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Expression changeBack​(java.lang.Boolean isMultiOr, Expression exp)
      This helper method is used to change the multiple expression into the binary form, respectively and return the root of the expression tree.
      static Expression modify​(Expression express)  
      static Expression shallowCopy​(Expression express)
      This method is used to copy the expression which happens at step four.
      • Methods inherited from class java.lang.Object

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

      • CloneHelper

        CloneHelper()
    • Method Detail

      • shallowCopy

        public static Expression shallowCopy​(Expression express)
        This method is used to copy the expression which happens at step four. I only copy the conditional expressions since the CNF only changes the conditional part.
        Parameters:
        express - the expression that will be copied.
        Returns:
        the copied expression.
      • changeBack

        public static Expression changeBack​(java.lang.Boolean isMultiOr,
                                            Expression exp)
        This helper method is used to change the multiple expression into the binary form, respectively and return the root of the expression tree.
        Parameters:
        isMultiOr - variable tells whether the expression is or.
        exp - the expression that needs to be converted.
        Returns:
        the root of the expression tree.