de.lmu.ifi.dbs.elki.utilities.datastructures.heap
Class IntegerPriorityObject<O>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.datastructures.heap.IntegerPriorityObject<O>
Type Parameters:
O - Stored object type.
All Implemented Interfaces:
PairInterface<Integer,O>, Comparable<IntegerPriorityObject<?>>

public class IntegerPriorityObject<O>
extends Object
implements PairInterface<Integer,O>, Comparable<IntegerPriorityObject<?>>

Object for a priority queue with integer priority. Can be used in the UpdatableHeap, since hashcode and equality use the stored objects only, not the priority.


Field Summary
private  O object
          Stored object.
(package private)  int priority
          Priority.
 
Constructor Summary
IntegerPriorityObject(int priority, O object)
          Constructor.
 
Method Summary
 int compareTo(IntegerPriorityObject<?> o)
           
 boolean equals(Object obj)
           
 Integer getFirst()
          Get the first object - note: this may cause autoboxing, use pair.first for native pairs!
 O getObject()
          Get the stored object payload
 int getPriority()
          Get the priority.
 O getSecond()
          Get the second object - note: this may cause autoboxing, use pair.second for native pairs!
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

priority

int priority
Priority.


object

private O object
Stored object. Private; since changing this will break an UpdatableHeaps Hash Map!

Constructor Detail

IntegerPriorityObject

public IntegerPriorityObject(int priority,
                             O object)
Constructor.

Parameters:
priority - Priority
object - Payload
Method Detail

getPriority

public int getPriority()
Get the priority.

Returns:
Priority

getObject

public O getObject()
Get the stored object payload

Returns:
object data

getFirst

public Integer getFirst()
Description copied from interface: PairInterface
Get the first object - note: this may cause autoboxing, use pair.first for native pairs!

Specified by:
getFirst in interface PairInterface<Integer,O>
Returns:
First object

getSecond

public O getSecond()
Description copied from interface: PairInterface
Get the second object - note: this may cause autoboxing, use pair.second for native pairs!

Specified by:
getSecond in interface PairInterface<Integer,O>
Returns:
Second object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

compareTo

public int compareTo(IntegerPriorityObject<?> o)
Specified by:
compareTo in interface Comparable<IntegerPriorityObject<?>>

Release 0.4.0 (2011-09-20_1324)