Enterprise Information Portal APIs

com.ibm.mm.sdk.common
Interface dkSort


public interface dkSort


Method Summary
 int compare(java.lang.Object first, java.lang.Object second)
          Compares an object with another.
 boolean equals(java.lang.Object first, java.lang.Object second)
          Compares an object with another for equality.
 java.lang.Object getKey(java.lang.Object anObject)
          Extract the key of a given object.
 boolean greaterThan(java.lang.Object first, java.lang.Object second)
          Compares an object if it is greater than another.
 boolean lessThan(java.lang.Object first, java.lang.Object second)
          Compares an object if it is less than another.
 void sort(java.lang.Object[] arrayOfObjects, boolean order)
          Sorts an array of objects based on their keys using the one of the above comparison functions.
 

Method Detail

getKey

public java.lang.Object getKey(java.lang.Object anObject)
                        throws DKUsageError
Extract the key of a given object. Returns an object which is the key.
Parameters:
anObject - the object which the key will be extracted.
Returns:
an object which is the key of the given object.
Throws:
DKUsageError - the given object is not of the right type or structure.

compare

public int compare(java.lang.Object first,
                   java.lang.Object second)
            throws DKUsageError
Compares an object with another. Returns a number less than zero if the first object is smaller than the second, zero if they are equals, and greater than zero if the first object is greater than the other.
Parameters:
first - the first object to compare.
second - the second object to compare.
Returns:
an integer less than zero if first is less than the second, zero if first is equal to second, or an integer greater than zero if first is greater than the second.
Throws:
DKUsageError - the objects are not of the right type or structure.

lessThan

public boolean lessThan(java.lang.Object first,
                        java.lang.Object second)
                 throws DKUsageError
Compares an object if it is less than another. Returns true if the first object is less than the second.
Parameters:
first - the first object to compare.
second - the second object to compare.
Returns:
true if the first object is less than second.
Throws:
DKUsageError - the objects are not of the right type or structure.
See Also:
getKey(java.lang.Object)

greaterThan

public boolean greaterThan(java.lang.Object first,
                           java.lang.Object second)
                    throws DKUsageError
Compares an object if it is greater than another. Returns true if the first object is greater than the second.
Parameters:
first - the first object to compare.
second - the second object to compare.
Returns:
true if the first object is greater than the second.
Throws:
DKUsageError - the objects are not of the right type or structure.
See Also:
getKey(java.lang.Object)

equals

public boolean equals(java.lang.Object first,
                      java.lang.Object second)
               throws DKUsageError
Compares an object with another for equality. Returns true if the first object is equals to the second.
Parameters:
first - the first object to compare.
second - the second object to compare.
Returns:
true if the first object is equals to the second.
Throws:
DKUsageError - the objects are not of the right type or structure.
See Also:
getKey(java.lang.Object)

sort

public void sort(java.lang.Object[] arrayOfObjects,
                 boolean order)
          throws DKUsageError
Sorts an array of objects based on their keys using the one of the above comparison functions. The key is obtained from each object using the above getKey method. It returns the same array with the objects sorted in the specified order.
Parameters:
arrayOfObjects - an array of object to be sorted.
order - the desired order, true = ascending, false = descending.
Throws:
DKUsageError - the objects are not of the right type or structure.
See Also:
getKey(java.lang.Object)

EIP Java APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.