| 1 | 
    
            
    
     | 
    
           | 
  
            
  
    | 2 | 
    
            
    
     | 
    
           | 
  
            
  
    | 3 | 
    
            
    
     | 
    
           | 
  
            
  
    | 4 | 
    
            
    
     | 
    
           | 
  
            
  
    | 5 | 
    
            
    
     | 
    
           | 
  
            
  
    | 6 | 
    
            
    
     | 
    
           | 
  
            
  
    | 7 | 
    
            
    
     | 
    
           | 
  
            
  
    | 8 | 
    
            
    
     | 
    
           | 
  
            
  
    | 9 | 
    
            
    
     | 
    
           | 
  
            
  
    | 10 | 
    
            
    
     | 
    
           | 
  
            
  
    | 11 | 
    
            
    
     | 
    
           | 
  
            
  
    | 12 | 
    
            
    
     | 
    
           | 
  
            
  
    | 13 | 
    
            
    
     | 
    
           | 
  
            
  
    | 14 | 
    
            
    
     | 
    
           | 
  
            
  
    | 15 | 
    
            
    
     | 
    
           | 
  
            
  
    | 16 | 
    
            
    
     | 
    
           | 
  
            
  
    | 17 | 
    
            
    
     | 
    
           | 
  
            
  
    | 18 | 
    
            
    
     | 
    
           | 
  
            
  
    | 19 | 
    
            
    
     | 
    
      package org.kuali.student.common.messagebuilder.booleanmessage.ast;     | 
  
            
  
    | 20 | 
    
            
    
     | 
    
           | 
  
            
  
    | 21 | 
    
            
    
     | 
    
      import java.util.ArrayList;     | 
  
            
  
    | 22 | 
    
            
    
     | 
    
      import java.util.List;     | 
  
            
  
    | 23 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 44 (44) | 
           Complexity: 10 | 
           Complexity Density: 0.32 | 
                        
            
        | 
    
  
  
    | 24 | 
    
            
    
     | 
    
      public class BooleanFunction {     | 
  
            
  
    | 25 | 
    
            
    
     | 
    
          private String booleanExpression;     | 
  
            
  
    | 26 | 
    
            
    
     | 
    
          private BinaryMessageTree ASTtree;     | 
  
            
  
    | 27 | 
    
            
    
     | 
    
          private BooleanNode root;     | 
  
            
  
    | 28 | 
    
            
    
     | 
    
          private ArrayList<String> funcVars = new ArrayList<String>();     | 
  
            
  
    | 29 | 
    
            
    
     | 
    
          private ArrayList<String> symbols = new ArrayList<String>();     | 
  
            
  
    | 30 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 3 (3) | 
           Complexity: 1 | 
           Complexity Density: 0.33 | 
                        
            
        | 
    
  
  
    | 31 | 
    
           0
    
     | 
    
           public BooleanFunction(String booleanExpression) {...     | 
  
            
  
    | 32 | 
    
            
    
     | 
    
                   | 
  
            
  
    | 33 | 
    
            
    
     | 
    
                   | 
  
            
  
    | 34 | 
    
           0
    
     | 
    
              ASTtree = new BinaryMessageTree();     | 
  
            
  
    | 35 | 
    
           0
    
     | 
    
              root = ASTtree.buildTree(booleanExpression);     | 
  
            
  
    | 36 | 
    
           0
    
     | 
    
              this.booleanExpression = booleanExpression;     | 
  
            
  
    | 37 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 38 | 
    
            
    
     | 
    
           | 
  
            
  
    | 39 | 
    
            
    
     | 
    
               | 
  
            
  
    | 40 | 
    
            
    
     | 
    
           | 
  
            
  
    | 41 | 
    
            
    
     | 
    
           | 
  
            
  
    | 42 | 
    
            
    
     | 
    
           | 
  
            
  
    | 43 | 
    
            
    
     | 
    
           | 
  
            
  
    | 44 | 
    
            
    
     | 
    
           | 
  
            
  
    | 45 | 
    
            
    
     | 
    
           | 
  
            
  
    | 46 | 
    
            
    
     | 
    
      @return     | 
  
            
  
    | 47 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 10 (10) | 
           Complexity: 3 | 
           Complexity Density: 0.38 | 
                        
            
        | 
    
  
  
    | 48 | 
    
           0
    
     | 
    
           public List<String> getVariables() {...     | 
  
            
  
    | 49 | 
    
           0
    
     | 
    
              ASTtree.traverseTreePostOrderDontSetNode(root, null);     | 
  
            
  
    | 50 | 
    
           0
    
     | 
    
              List<BooleanNode> treeNodes = ASTtree.getAllNodes();     | 
  
            
  
    | 51 | 
    
            
    
     | 
    
           | 
  
            
  
    | 52 | 
    
           0
    
     | 
    
              for (BooleanNode bnode : treeNodes) {     | 
  
            
  
    | 53 | 
    
           0
    
     | 
    
                  String label = bnode.getLabel();     | 
  
            
  
    | 54 | 
    
           0
    
     | 
    
                  if (label.equals("+") || label.equals("*")) {     | 
  
            
  
    | 55 | 
    
           0
    
     | 
    
                      continue;     | 
  
            
  
    | 56 | 
    
            
    
     | 
    
                  }     | 
  
            
  
    | 57 | 
    
           0
    
     | 
    
                  funcVars.add(label);     | 
  
            
  
    | 58 | 
    
            
    
     | 
    
              }     | 
  
            
  
    | 59 | 
    
           0
    
     | 
    
              return funcVars;     | 
  
            
  
    | 60 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 61 | 
    
            
    
     | 
    
           | 
  
            
  
    | 62 | 
    
            
    
     | 
    
               | 
  
            
  
    | 63 | 
    
            
    
     | 
    
           | 
  
            
  
    | 64 | 
    
            
    
     | 
    
           | 
  
            
  
    | 65 | 
    
            
    
     | 
    
           | 
  
            
  
    | 66 | 
    
            
    
     | 
    
           | 
  
            
  
    | 67 | 
    
            
    
     | 
    
           | 
  
            
  
    | 68 | 
    
            
    
     | 
    
           | 
  
            
  
    | 69 | 
    
            
    
     | 
    
      @return     | 
  
            
  
    | 70 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 28 (28) | 
           Complexity: 6 | 
           Complexity Density: 0.3 | 
                        
            
        | 
    
  
  
    | 71 | 
    
           0
    
     | 
    
           public List<String> getSymbols() {...     | 
  
            
  
    | 72 | 
    
           0
    
     | 
    
              String workString = null;     | 
  
            
  
    | 73 | 
    
            
    
     | 
    
                   | 
  
            
  
    | 74 | 
    
           0
    
     | 
    
              this.booleanExpression = (booleanExpression == null ? null : booleanExpression.replaceAll("\\s+", ""));     | 
  
            
  
    | 75 | 
    
            
    
     | 
    
           | 
  
            
  
    | 76 | 
    
           0
    
     | 
    
              workString = this.booleanExpression;     | 
  
            
  
    | 77 | 
    
            
    
     | 
    
           | 
  
            
  
    | 78 | 
    
           0
    
     | 
    
              while (workString != null && workString.length() > 0) {     | 
  
            
  
    | 79 | 
    
           0
    
     | 
    
                  String propositionKeyPattern = "^[A-Z][0-9]*";     | 
  
            
  
    | 80 | 
    
           0
    
     | 
    
                  String restOfFunctionString = null;     | 
  
            
  
    | 81 | 
    
           0
    
     | 
    
                  String theSymbol = null;     | 
  
            
  
    | 82 | 
    
           0
    
     | 
    
                  int restOfFunctionStringStartIndex = 0;     | 
  
            
  
    | 83 | 
    
           0
    
     | 
    
                  if (workString.matches(propositionKeyPattern + ".*")) {     | 
  
            
  
    | 84 | 
    
           0
    
     | 
    
                      restOfFunctionString = workString.replaceFirst(propositionKeyPattern, "");     | 
  
            
  
    | 85 | 
    
           0
    
     | 
    
                      restOfFunctionStringStartIndex = workString.indexOf(restOfFunctionString);     | 
  
            
  
    | 86 | 
    
           0
    
     | 
    
                      if (restOfFunctionStringStartIndex <= 0) {     | 
  
            
  
    | 87 | 
    
           0
    
     | 
    
                          theSymbol = workString;     | 
  
            
  
    | 88 | 
    
           0
    
     | 
    
                          workString = "";     | 
  
            
  
    | 89 | 
    
            
    
     | 
    
                      } else {     | 
  
            
  
    | 90 | 
    
           0
    
     | 
    
                          theSymbol = workString.substring(0, restOfFunctionStringStartIndex);     | 
  
            
  
    | 91 | 
    
           0
    
     | 
    
                          workString = restOfFunctionString;     | 
  
            
  
    | 92 | 
    
            
    
     | 
    
                      }     | 
  
            
  
    | 93 | 
    
            
    
     | 
    
                  } else {     | 
  
            
  
    | 94 | 
    
           0
    
     | 
    
                      theSymbol = workString.substring(0, 1);     | 
  
            
  
    | 95 | 
    
           0
    
     | 
    
                      workString = workString.substring(1, workString.length());     | 
  
            
  
    | 96 | 
    
            
    
     | 
    
                  }     | 
  
            
  
    | 97 | 
    
           0
    
     | 
    
                  symbols.add(theSymbol);     | 
  
            
  
    | 98 | 
    
            
    
     | 
    
              }     | 
  
            
  
    | 99 | 
    
           0
    
     | 
    
              return symbols;     | 
  
            
  
    | 100 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 101 | 
    
            
    
     | 
    
      }     |