Query.java
package edu.udel.cis.vsl.tass.dynamic.impl;
import edu.udel.cis.vsl.tass.dynamic.IF.value.ValueIF;
/**
* A query consists of an assumption p and a predicate q, both boolean-valued
* expressions. Two Query objects are equal iff theirs assumptions are equal and
* their predicates are equal.
*/
public class Query {
private ValueIF assumption;
private ValueIF predicate;
/**
* Creates new query. Query is immutable.
*/
Query(ValueIF assumption, ValueIF predicate) {
if (assumption == null)
throw new NullPointerException("Null assumption");
if (predicate == null)
throw new NullPointerException("null predicate");
this.assumption = assumption;
this.predicate = predicate;
}
public ValueIF assumption() {
return assumption;
}
public ValueIF predicate() {
return predicate;
}
public int hashCode() {
return assumption.hashCode() + predicate.hashCode();
}
public boolean equals(Object object) {
if (object instanceof Query) {
Query that = (Query) object;
return assumption.equals(that.assumption)
&& predicate.equals(that.predicate);
}
return false;
}
}