From 97af4be638e371a2f693bde2798fc233a143f3f9 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Sun, 29 Apr 2007 17:47:50 +0000 Subject: Merged in support for derived properties. --- .../java/com/amazon/carbonado/qe/AbstractQuery.java | 6 ++++++ src/main/java/com/amazon/carbonado/qe/EmptyQuery.java | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'src/main/java/com/amazon/carbonado/qe') 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 implements Query, 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 extends AbstractQuery { 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"); } -- cgit v1.2.3