Interface mjr.heap.Heapable
All Packages Class Hierarchy This Package Previous Next Index
Interface mjr.heap.Heapable
- public interface Heapable
- extends Object
An interface for keys in the heap. Allows the heap to make
comparisons to upheap or downheap.
- See Also:
- Heap
-
equalTo(Object)
- Determines if this key is equal to the other key.
-
greaterThan(Object)
- Determines if this key is greater than the other key.
-
lessThan(Object)
- Determines if this key is less than the other key.
greaterThan
public abstract boolean greaterThan(Object other)
- Determines if this key is greater than the other key.
For example, to compare keys that are subclasses of
Integer:
return (intValue() > ((Integer)other).intValue());
- Parameters:
- other - the key to compare this key to.
- Returns:
- true if this key is greater than the other key
lessThan
public abstract boolean lessThan(Object other)
- Determines if this key is less than the other key.
For example, to compare keys that are subclasses of
Integer:
return (intValue() < ((Integer)other).intValue());
- Parameters:
- other - the key to compare this key to.
- Returns:
- true if this key is less than the other key
equalTo
public abstract boolean equalTo(Object other)
- Determines if this key is equal to the other key.
For example, to compare keys that are subclasses of
Integer:
return (intValue() == ((Integer)other).intValue());
- Parameters:
- other - the key to compare this key to.
- Returns:
- true if this key is equal to the other key
All Packages Class Hierarchy This Package Previous Next Index