74 if (this instanceof LogicConstantNode) { 75 LogicConstantNode logicConstantNode = (LogicConstantNode) this; 76 return !logicConstantNode.getValue(); 77 } 78 79 return false; 80 } 81 82 /** 83 * Determines what this condition implies about the other. 84 * 85 * <ul> 86 * <li>If negate(this, thisNegated) => other, returns {@link TriState#TRUE}</li> 87 * <li>If negate(this, thisNegated) => !other, returns {@link TriState#FALSE}</li> 88 * </ul> 89 * 90 * @param thisNegated whether this condition should be considered as false. 91 * @param other the other condition. 92 */ 93 public TriState implies(boolean thisNegated, LogicNode other) { 94 return TriState.UNKNOWN; 95 } 96 } | 74 if (this instanceof LogicConstantNode) { 75 LogicConstantNode logicConstantNode = (LogicConstantNode) this; 76 return !logicConstantNode.getValue(); 77 } 78 79 return false; 80 } 81 82 /** 83 * Determines what this condition implies about the other. 84 * 85 * <ul> 86 * <li>If negate(this, thisNegated) => other, returns {@link TriState#TRUE}</li> 87 * <li>If negate(this, thisNegated) => !other, returns {@link TriState#FALSE}</li> 88 * </ul> 89 * 90 * @param thisNegated whether this condition should be considered as false. 91 * @param other the other condition. 92 */ 93 public TriState implies(boolean thisNegated, LogicNode other) { 94 if (this == other) { 95 return TriState.get(!thisNegated); 96 } 97 if (other instanceof LogicNegationNode) { 98 return flip(this.implies(thisNegated, ((LogicNegationNode) other).getValue())); 99 } 100 return TriState.UNKNOWN; 101 } 102 103 private static TriState flip(TriState triState) { 104 return triState.isUnknown() 105 ? triState 106 : TriState.get(!triState.toBoolean()); 107 } 108 } |