org.apache.commons.collections.comparators

Class TransformingComparator

Implemented Interfaces:
Comparator

public class TransformingComparator
extends java.lang.Object
implements Comparator

Decorates another Comparator with transformation behavior. That is, the return value from the transform operation will be passed to the decorated Comparator#compare method.

See Also:
Transformer, ComparableComparator

Field Summary

protected Comparator
decorated
protected Transformer
transformer

Constructor Summary

TransformingComparator(Transformer transformer)
Constructs an instance with the given Transformer and a ComparableComparator.
TransformingComparator(Transformer transformer, Comparator decorated)
Constructs an instance with the given Transformer and Comparator

Method Summary

int
compare(Object o1, Object o2)
Returns the result of comparing the values from the transform operation.

Field Details

decorated

protected Comparator decorated

transformer

protected Transformer transformer

Constructor Details

TransformingComparator

public TransformingComparator(Transformer transformer)
Constructs an instance with the given Transformer and a ComparableComparator.
Parameters:
transformer - what will transform the instance.

TransformingComparator

public TransformingComparator(Transformer transformer,
                              Comparator decorated)
Constructs an instance with the given Transformer and Comparator
Parameters:
decorated - the decorated Comparator

Method Details

compare

public int compare(Object o1,
                   Object o2)
Returns the result of comparing the values from the transform operation.
Returns:
the result of comparing the values from the transform operation

Copyright © 2001-2004 Apache Software Foundation. Documenation generated ${TODAY}.