Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 18684 invoked from network); 10 Mar 2005 18:48:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 10 Mar 2005 18:48:28 -0000 Received: (qmail 82897 invoked by uid 500); 10 Mar 2005 18:48:27 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 82859 invoked by uid 500); 10 Mar 2005 18:48:26 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 82844 invoked by uid 99); 10 Mar 2005 18:48:26 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of yseeley@gmail.com designates 64.233.170.197 as permitted sender) Received: from rproxy.gmail.com (HELO rproxy.gmail.com) (64.233.170.197) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 10 Mar 2005 10:48:26 -0800 Received: by rproxy.gmail.com with SMTP id b11so648493rne for ; Thu, 10 Mar 2005 10:48:21 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=Y67u1mDE6H65QEjX/KRTst894r+rb/5g+oa3qjuZ6tBUqBuKXWgN2zxW7npYwHHErNbJ3cVdJWbs3MXRz2sySrfyn79hLqsTyGbLQfavp037rXT1amf34mdFeeMDW+CtMLt4F0HQPurGqhV+DCvGuPKxNxnGIUSU9qfS6YGudqE= Received: by 10.38.59.39 with SMTP id h39mr1092989rna; Thu, 10 Mar 2005 10:48:21 -0800 (PST) Received: by 10.38.12.53 with HTTP; Thu, 10 Mar 2005 10:48:21 -0800 (PST) Message-ID: Date: Thu, 10 Mar 2005 13:48:21 -0500 From: Yonik Seeley Reply-To: Yonik Seeley To: java-dev@lucene.apache.org Subject: Re: subclasses of abstract Query class are not implementing all methods In-Reply-To: <423073BF.4000202@apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <423073BF.4000202@apache.org> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Great idea. I am also planning on doing some caching based on query objects, and I hadn't realized that these weren't implemented. In the meantime, I guess I can cache an Object that contains a Query, and traverse the query tree myself to implement missing .hashCode() or .equals() functionality. -Yonik On Thu, 10 Mar 2005 17:20:15 +0100, Bernhard Messer wrote: > Hi, > > I would like to cache query objects in a hash map. My implementation > failed, because not all of the Query classes are implementing the > necessary method: "public int hashCode()". The same counts for the > "public boolean equals (Object o)", "public String toString(String > fieldName)" and "public String toString()". To force all subclasses of > Query to implement this 4 methods, i would like to make them abstract > within the base class and implement the missing ones in the subclasses. > So in Query class itself, it would look: > > public abstract String toString(String field); > public abstract String toString(); > public abstract int hashCode(); > public abstract boolean equals(Object o); > > I think this would make the API cleaner and more usable. > > Thoughts ??? > > Bernhard > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-dev-help@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org