|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.util.pq.ArrayIntNodePQ
Implements a priority queue for nodes based on a array with bucket lists. The priority values must be less than a maximal-value which must be provided to the constructor. Certain operations have time-complexity dependend on this value. The priority values of the nodes must be non-negative. While the priority queue is used, the graph must not change.
Constructor Summary | |
ArrayIntNodePQ(Graph _graph,
DataProvider _initValues)
Returns a new Priority-Queue initialized with all nodes of the graph. |
|
ArrayIntNodePQ(Graph _graph,
int maxSize)
Returns an empty Priority-Queue. |
|
ArrayIntNodePQ(Graph _graph,
NodeMap _valueMap,
int maxSize)
Returns an empty Priority-Queue. |
Method Summary | |
void |
add(Node n,
int value)
Insertes a node into the queue. |
void |
changePriority(Node n,
int value)
Changes the value of a node in the queue to a certain value. |
void |
clear()
Removes all entries from the queue. |
boolean |
contains(Node n)
Returns whether or not the given node is contained within this queue. |
void |
decreasePriority(Node n,
int value)
Decreases the value of a node in the queue to a certain value. |
void |
dispose()
Disposes this queue. |
protected YList |
getList(int value)
Returns the list for a given slot. |
Node |
getMin()
Returns the node with the minimal value in the queue. |
int |
getPriority(Node v)
Returns the current priority of the given node. |
void |
increasePriority(Node n,
int value)
Increases the value of a node in the queue to a certain value. |
boolean |
isEmpty()
Returns whether or not this queue is empty. |
void |
remove(Node n)
Removes a node from the priority queue. |
Node |
removeMin()
Removes the node with the minimal value from the queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ArrayIntNodePQ(Graph _graph, int maxSize)
_graph
- the graph which contains the nodesmaxSize
- the maximum value of a node in the priority queuepublic ArrayIntNodePQ(Graph _graph, DataProvider _initValues)
_graph
- the graph which contains the nodes_initValues
- the initial priority values of the nodes.public ArrayIntNodePQ(Graph _graph, NodeMap _valueMap, int maxSize)
NodeMap
as argument
which is used to store the priority values.
_graph
- the graph which contains the nodes_valueMap
- here the priority values are storedmaxSize
- the maximum value of a node in the priority queueMethod Detail |
public void clear()
clear
in interface IntNodePQ
O(maxSize)
public boolean isEmpty()
isEmpty
in interface IntNodePQ
O(1)
public boolean contains(Node n)
contains
in interface IntNodePQ
O(1)
public void add(Node n, int value)
add
in interface IntNodePQ
O(1)
public void remove(Node n)
public Node getMin()
getMin
in interface IntNodePQ
O(1)
public void decreasePriority(Node n, int value)
decreasePriority
in interface IntNodePQ
O(1)
n
- a node in the priotity queue.value
- the new priority value of the node.public void increasePriority(Node n, int value)
n
- a node in the priotity queue.value
- the new priority value of the node.public void changePriority(Node n, int value)
n
- a node in the priotity queue.value
- the new priority value of the node.public Node removeMin()
ArrayIntNodePQ.remove(Node)
.
removeMin
in interface IntNodePQ
public int getPriority(Node v)
IntNodePQ
getPriority
in interface IntNodePQ
public void dispose()
IntNodePQ
dispose
in interface IntNodePQ
protected YList getList(int value)
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |