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 inExtrinsicMinPQimplementations.- 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 booleanequals(Object o)inthashCode()(package private) Titem()Returns the item.(package private) doublepriority()Returns the priority value.(package private) voidsetPriority(double priority)Reassigns the priority value for this pair.StringtoString()
-
-
-
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.
-
-