com.mhhe.clrs2e
Class DynamicSetElement.Helper

java.lang.Object
  |
  +--com.mhhe.clrs2e.DynamicSetElement.Helper
Enclosing class:
DynamicSetElement

public static class DynamicSetElement.Helper
extends java.lang.Object

Inner class to define static helper methods.


Constructor Summary
DynamicSetElement.Helper()
           
 
Method Summary
static com.mhhe.clrs2e.DynamicSetElement cast(java.lang.Object o)
          Casts an object to DynamicSetElement, throwing a ClassCastException if the object fails to implement the DynamicSetElement interface.
static int compareTo(com.mhhe.clrs2e.DynamicSetElement e, java.lang.Object o)
          Compares a DynamicSetElement to another object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicSetElement.Helper

public DynamicSetElement.Helper()
Method Detail

compareTo

public static int compareTo(com.mhhe.clrs2e.DynamicSetElement e,
                            java.lang.Object o)
Compares a DynamicSetElement to another object. If the other object is also a DynamicSetElement, the keys of both are compared. If the other object is not a DynamicSetElement object but does implement Comparable, then the key of of the DynamicSetElement is compared to the other object. Otherwise, the other object does not implement Comparable, and a ClassCastException is thrown.

Parameters:
e - The DynamicSetElement.
o - The other object.
Returns:
A negative integer if e is less; 0 if the objects are equal; a positive integer if e is greater.
Throws:
java.lang.ClassCastException - if o does not implement Comparable.

cast

public static com.mhhe.clrs2e.DynamicSetElement cast(java.lang.Object o)
Casts an object to DynamicSetElement, throwing a ClassCastException if the object fails to implement the DynamicSetElement interface.

Parameters:
o - The object.
Returns:
The object o, but cast as a DynamicSetElement.
Throws:
java.lang.ClassCastException - if o does not implement the DynamicSetElement interface.