org.deduced
Class PropertyValueCollectionComparator

java.lang.Object
  extended by org.deduced.PropertyValueCollectionComparator
All Implemented Interfaces:
java.util.Comparator<PropertyCollection<?,?>>

public class PropertyValueCollectionComparator
extends java.lang.Object
implements java.util.Comparator<PropertyCollection<?,?>>

PropertyValueCollectionComparator is used to compare two property collections based on a value they contain.

Author:
Steve McDuff

Field Summary
private  java.lang.Object propertyKey
          the key of the property to compare
 
Constructor Summary
PropertyValueCollectionComparator()
          PropertyValueCollectionComparator Constructor
 
Method Summary
 int compare(PropertyCollection<?,?> o1, PropertyCollection<?,?> o2)
          (non-Javadoc)
private  int compareComparableObjects(java.lang.Object propertyValue1, java.lang.Object propertyValue2)
          compare Comparable Objects
 java.lang.Object getPropertyKey()
          get the key of the property to compare
 void setPropertyKey(java.lang.Object setPropertyKey)
          set the key of the property to compare
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

propertyKey

private java.lang.Object propertyKey
the key of the property to compare

Constructor Detail

PropertyValueCollectionComparator

public PropertyValueCollectionComparator()
PropertyValueCollectionComparator Constructor

Method Detail

setPropertyKey

public void setPropertyKey(java.lang.Object setPropertyKey)
set the key of the property to compare

Parameters:
setPropertyKey - the key of the property to compare

getPropertyKey

public java.lang.Object getPropertyKey()
get the key of the property to compare

Returns:
the key of the property to compare

compare

public int compare(PropertyCollection<?,?> o1,
                   PropertyCollection<?,?> o2)
(non-Javadoc)

Specified by:
compare in interface java.util.Comparator<PropertyCollection<?,?>>
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)

compareComparableObjects

private int compareComparableObjects(java.lang.Object propertyValue1,
                                     java.lang.Object propertyValue2)
compare Comparable Objects

Parameters:
propertyValue1 - first comparable value
propertyValue2 - second comparable value
Returns:
the comparison delta