1 19 20 25 26 package soot.jimple.toolkits.annotation.arraycheck; 27 28 import soot.toolkits.graph.*; 29 30 class BoolValue 31 { 32 private boolean isRectangular; 33 34 private static BoolValue trueValue = new BoolValue(true); 35 private static BoolValue falseValue = new BoolValue(false); 36 37 public BoolValue(boolean v) 38 { 39 isRectangular = v; 40 } 41 42 public static BoolValue v(boolean v) 43 { 44 if (v) 45 return trueValue; 46 else 47 return falseValue; 48 } 49 50 public boolean getValue() 51 { 52 return isRectangular; 53 } 54 55 public boolean or(BoolValue other) 56 { 57 if (other.getValue()) 58 isRectangular = true; 59 60 return isRectangular; 61 } 62 63 public boolean or(boolean other) 64 { 65 if (other) 66 isRectangular = true; 67 return isRectangular; 68 } 69 70 public boolean and(BoolValue other) 71 { 72 if (!other.getValue()) 73 isRectangular = false; 74 75 return isRectangular; 76 } 77 78 public boolean and(boolean other) 79 { 80 if (!other) 81 isRectangular = false; 82 83 return isRectangular; 84 } 85 86 public int hashCode() 87 { 88 if (isRectangular) 89 return 1; 90 else 91 return 0; 92 } 93 94 public boolean equals(Object other) 95 { 96 if (other instanceof BoolValue) 97 { 98 return isRectangular == ((BoolValue)other).getValue(); 99 } 100 101 return false; 102 } 103 104 public String toString() 105 { 106 return "["+isRectangular+"]"; 107 } 108 } 109 110 111 | Popular Tags |