See ComparatorChain in [collections]. The chain uses the second comparator if the first returns zero (equal), it uses the third comparator if the first and second return zero.
Stephen ----- Original Message ----- From: "Inger, Matthew" <[EMAIL PROTECTED]> > Not really. It doesn't make sense to chain comparalators with > operations like and/or. Comparators are for comparing objects, and > returning one of three values: > Less Than > Equal To > Greater Than > > There's no way to logically chain these together. Chaining only > makes sense with boolean values (ie. two possible outcomes). > > > -----Original Message----- > From: Edelson, Justin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 18, 2004 4:21 PM > To: Jakarta Commons Developers List > Subject: RE: [lang] Equalator? > > > The one thing I can do with an Equalator that I don't see how to do (in > a meaningful way) with Comparators is chain them. I've implemented a > ChainedOrEqualator that contains a list of Equalators. If one returns > true, then the ChainedOrEqualator returns true. Likewise, there's a > ChainedAndEqualator. > > Am I missing a way to do this with Comparators? > > -----Original Message----- > From: Chuck Daniels [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 11, 2004 8:55 PM > To: Jakarta Commons Developers List > Subject: RE: [lang] Equalator? > > > I suggest you simply implement the Comparator interface since it is a > "superset" of your suggested Equalator interface. Therefore, I would > implement your MetaphoneEqualator as EncodingComparator. The class name > prefix is changed from Metaphone to Encoding since you are not actually > comparing Metaphones, but rather two encodings produced by a single > Metaphone. More generally, you are actually comparing two encodings > produced by a single Encoder: > > ... > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
