diff options
Diffstat (limited to 'src/main/java/com/amazon/carbonado/qe')
-rw-r--r-- | src/main/java/com/amazon/carbonado/qe/AbstractQuery.java | 6 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/qe/EmptyQuery.java | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/qe/AbstractQuery.java b/src/main/java/com/amazon/carbonado/qe/AbstractQuery.java index 436c2c2..7639348 100644 --- a/src/main/java/com/amazon/carbonado/qe/AbstractQuery.java +++ b/src/main/java/com/amazon/carbonado/qe/AbstractQuery.java @@ -123,4 +123,10 @@ public abstract class AbstractQuery<S extends Storable> implements Query<S>, App }
return b.toString();
}
+
+ @Override
+ public abstract int hashCode();
+
+ @Override
+ public abstract boolean equals(Object obj);
}
diff --git a/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java b/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java index 161ad90..d9969c5 100644 --- a/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java +++ b/src/main/java/com/amazon/carbonado/qe/EmptyQuery.java @@ -273,6 +273,24 @@ public final class EmptyQuery<S extends Storable> extends AbstractQuery<S> { return false;
}
+ @Override
+ public int hashCode() {
+ return mFactory.hashCode() * 31 + mOrdering.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof EmptyQuery) {
+ EmptyQuery<?> other = (EmptyQuery<?>) obj;
+ return mFactory.equals(other.mFactory)
+ && mOrdering.equals(other.mOrdering);
+ }
+ return false;
+ }
+
private IllegalStateException error() {
return new IllegalStateException("Query doesn't have any parameters");
}
|