⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
org.apache.commons.collections.comparators

Class TransformingComparator

java.lang.Object
|
+--org.apache.commons.collections.comparators.TransformingComparator

All 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 compare method.

Since:
Commons Collections 2.0 (?)
See Also:
org.apache.commons.collections.Transformer
org.apache.commons.collections.comparators.ComparableComparator

Field Summary

Comparator

decorated

Decorates another Comparator with transformation behavior.

Transformer

transformer

Constructor Summary

TransformingComparator(Transformer transformer)

Constructs an instance with the given Transformer and a ComparableComparator 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

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

Since:
Commons Collections 2.0 (?)
See Also:
org.apache.commons.collections.Transformer
org.apache.commons.collections.comparators.ComparableComparator

transformer

protected Transformer transformer

Constructor Details

TransformingComparator

public TransformingComparator(Transformer transformer, Comparator decorated)

Constructs an instance with the given Transformer and Comparator

Parameters:
transformer - what will transform the arguments to #compare compare
decorated - the decorated Comparator

TransformingComparator

public TransformingComparator(Transformer transformer)

Constructs an instance with the given Transformer and a ComparableComparator ComparableComparator. compare compare

Parameters:
transformer - what will transform the arguments to

Method Details

compare

public int compare(Object o1, Object o2)

Returns the result of comparing the values from the transform operation.

Parameters:
o1
o2
Returns:
the result of comparing the values from the transform operation