org.dsmltools.util
Class DNLengthComparator

java.lang.Object
  extended by org.dsmltools.util.DNLengthComparator
All Implemented Interfaces:
java.util.Comparator

public class DNLengthComparator
extends java.lang.Object
implements java.util.Comparator

This class implements the Comparator interface for comparing LDAPEntry objects on the basis of length of DN.


Constructor Summary
DNLengthComparator(boolean xiSmallestFirst)
          Defines which way we are sorting.
 
Method Summary
 int compare(java.lang.Object xiO1, java.lang.Object xiO2)
          This method compares two Objects (which should be LDAPEntry objects) and returns -1, 0 or 1 depending on the relative length of their DNs.
 boolean equals(java.lang.Object xiO1, java.lang.Object xiO2)
          This method uses compare() to return a boolean if the LDAPEntries have DNs of equal length.
 
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
 

Constructor Detail

DNLengthComparator

public DNLengthComparator(boolean xiSmallestFirst)
Defines which way we are sorting.

Parameters:
xiSmallestFirst - Whether we sort smallest first or largest first.
Method Detail

compare

public int compare(java.lang.Object xiO1,
                   java.lang.Object xiO2)
This method compares two Objects (which should be LDAPEntry objects) and returns -1, 0 or 1 depending on the relative length of their DNs.

Specified by:
compare in interface java.util.Comparator
Parameters:
xiO1 - The first object
xiO2 - The second object
Returns:
0, 1 or -1 depending on relative DN length

equals

public boolean equals(java.lang.Object xiO1,
                      java.lang.Object xiO2)
This method uses compare() to return a boolean if the LDAPEntries have DNs of equal length.

Parameters:
xiO1 - The first object
xiO2 - The second object
Returns:
True if DNs have equal length, false otherwise.