Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 50724 invoked from network); 14 Jan 2002 00:12:35 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 14 Jan 2002 00:12:35 -0000 Received: (qmail 27689 invoked by uid 97); 14 Jan 2002 00:12:18 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 27623 invoked by uid 97); 14 Jan 2002 00:12:16 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 27591 invoked from network); 14 Jan 2002 00:12:15 -0000 Message-Id: <200201140012.g0E0CE802261@mail008.syd.optusnet.com.au> Content-Type: text/plain; charset="utf-8" From: Peter Donald To: "Ant Developers List" Subject: Re: [SUBMIT] Selector API Implementation Date: Mon, 14 Jan 2002 10:05:42 +1100 X-Mailer: KMail [version 1.3.2] References: <005a01c19bd6$62e27740$a045d6d1@compaq> <200201130850.g0D8o1425038@mail012.syd.optusnet.com.au> <019401c19c74$3b945200$a045d6d1@compaq> In-Reply-To: <019401c19c74$3b945200$a045d6d1@compaq> X-Wisdom-Cookie: . MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Mon, 14 Jan 2002 07:52, Magesh Umasankar wrote: > > About the only modification I would make is to add an initialize or > > prepare > > > method to the FileSelector. > > Do we need an explicit method? Can't the no-arg constructor be used > for such things? no because it has to be after the setOperation and setValue has been called. > > That way in the selector you wouldn't keep having > > to do expensive string compares. You could instead do the compare once > > and cache it in a boolean variable. That should be much faster. > > I don't understand how we can cache these comparisons... > Any code to illsutrate? void initialize() { if (value == null) { throw new NullPointerException("value must not be null."); } this.equals = peration.equalsIgnoreCase("equals"); this.filebased = value.equalsIgnoreCase("file"); } Thus you have removed all the expensive string operations from isSelected which is called for every file. And also check once for value being null -- Cheers, Pete *------------------------------------------------* | You can't wake a person who is pretending | | to be asleep. -Navajo Proverb. | *------------------------------------------------* -- To unsubscribe, e-mail: For additional commands, e-mail: