Ejemplo n.º 1
0
 /**
  * Return true if the supplied expression "contradicts" this expression. If the supplied
  * expression is not of the same type, then it cannot contradict it. If the names are different
  * then there can be no contradiction.
  *
  * <p>Contradiction occurs if the value is different.
  *
  * @param o Expression to examine for contradiction.
  */
 public boolean contradicts(Expression o) {
   if (!(o instanceof KVExpression)) return (false);
   KVExpression other = (KVExpression) o;
   if (getName().compareTo(other.getName()) != 0) return (false);
   if (val.compareTo(other.getValue()) == 0) return (false);
   return (true);
 }
Ejemplo n.º 2
0
 /**
  * Indicates whether some other KVExpression is "equal to this one.
  *
  * @param o the reference object with which to compare.
  * @return <code>true</code> if this object is the same as the o argument; <code>false</code>
  *     otherwise.
  * @see #hashCode()
  */
 public boolean equals(Object o) {
   if (o == this) return (true);
   if (!(o instanceof KVExpression)) return (false);
   KVExpression other = (KVExpression) o;
   if (getName().compareTo(other.getName()) != 0 || val.compareTo(other.getValue()) != 0)
     return (false);
   return (true);
 }