org.cip4.jdflib.core
Class KElement.SingleAttributeComparator

java.lang.Object
  extended by org.cip4.jdflib.core.KElement.SingleAttributeComparator
All Implemented Interfaces:
java.util.Comparator<KElement>
Enclosing class:
KElement

public static class KElement.SingleAttributeComparator
extends java.lang.Object
implements java.util.Comparator<KElement>

sorts according to the value of one attribute
if the attribute is numeric, compare numerically, else lexical comparison is done

Author:
prosirai

Field Summary
private  java.lang.String attName
           
private  int invert
           
 
Constructor Summary
KElement.SingleAttributeComparator(java.lang.String pAttName, boolean pInvert)
          if the attribute is numeric, compare numerically, else lexical comparison is done
 
Method Summary
 int compare(KElement o1, KElement o2)
           
 
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

attName

private final java.lang.String attName

invert

private final int invert
Constructor Detail

KElement.SingleAttributeComparator

public KElement.SingleAttributeComparator(java.lang.String pAttName,
                                          boolean pInvert)
if the attribute is numeric, compare numerically, else lexical comparison is done

Parameters:
pAttName - the attribute to use for comparing
pInvert - if true, sort backwards
Method Detail

compare

public int compare(KElement o1,
                   KElement o2)
Specified by:
compare in interface java.util.Comparator<KElement>
Parameters:
o1 -
o2 -
Returns:
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)