Package minpq
Class PriorityNode<T>
- java.lang.Object
-
- minpq.PriorityNode<T>
-
- Type Parameters:
T
- the type of element represented by this node.
class PriorityNode<T> extends Object
Represents the item-priority pair for use inExtrinsicMinPQ
implementations.- See Also:
ExtrinsicMinPQ
-
-
Constructor Summary
Constructors Constructor Description PriorityNode(T item, double priority)
Constructs a pair with the given item and priority.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
int
hashCode()
(package private) T
item()
Returns the item.(package private) double
priority()
Returns the priority value.(package private) void
setPriority(double priority)
Reassigns the priority value for this pair.String
toString()
-
-
-
Field Detail
-
item
private final T item
-
priority
private double priority
-
-
Constructor Detail
-
PriorityNode
PriorityNode(T item, double priority)
Constructs a pair with the given item and priority.- Parameters:
item
- the item in this pair.priority
- the priority value associated with the item.
-
-
Method Detail
-
item
T item()
Returns the item.- Returns:
- the item.
-
priority
double priority()
Returns the priority value.- Returns:
- the priority value.
-
setPriority
void setPriority(double priority)
Reassigns the priority value for this pair.- Parameters:
priority
- the priority value to be assigned.
-
-