public abstract class DuplicateStatesFastLookupPriorityQueue
extends java.lang.Object
implements nl.tue.astar.util.FastLookupPriorityQueue
FastLookupPriorityQueue
that allows adding
multiple Record
objects that point to the same state (i.e.
Head
). It does not support the methods contains(Record)
though. Most code taken from AbstractFastLookupPriorityQueue
, but it
seemed better to not subclass it, as we don't need some fields.Modifier and Type | Field and Description |
---|---|
protected nl.tue.astar.Record[] |
queue
Priority queue represented as a balanced binary heap: the two children of
queue[n] are queue[2*n+1] and queue[2*(n+1)].
|
protected int |
size
The number of elements in the priority queue.
|
Constructor and Description |
---|
DuplicateStatesFastLookupPriorityQueue(int initialCapacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(nl.tue.astar.Record newE) |
nl.tue.astar.Record |
contains(nl.tue.astar.Record newRec)
Checks if the queue contains a record pointing to the same state as the
given record.
|
int |
getMaxCost() |
protected abstract boolean |
isBetter(nl.tue.astar.Record r1,
nl.tue.astar.Record r2) |
boolean |
isEmpty() |
nl.tue.astar.Record |
peek() |
nl.tue.astar.Record |
poll() |
void |
setMaxCost(int maxCost) |
int |
size() |
java.lang.String |
toString() |
protected nl.tue.astar.Record[] queue
protected int size
public DuplicateStatesFastLookupPriorityQueue(int initialCapacity)
public void setMaxCost(int maxCost)
setMaxCost
in interface nl.tue.astar.util.FastLookupPriorityQueue
public int getMaxCost()
getMaxCost
in interface nl.tue.astar.util.FastLookupPriorityQueue
public java.lang.String toString()
toString
in class java.lang.Object
protected abstract boolean isBetter(nl.tue.astar.Record r1, nl.tue.astar.Record r2)
public boolean add(nl.tue.astar.Record newE)
add
in interface nl.tue.astar.util.FastLookupPriorityQueue
public boolean isEmpty()
isEmpty
in interface nl.tue.astar.util.FastLookupPriorityQueue
public nl.tue.astar.Record contains(nl.tue.astar.Record newRec)
nl.tue.astar.util.FastLookupPriorityQueue
contains
in interface nl.tue.astar.util.FastLookupPriorityQueue
public nl.tue.astar.Record peek()
peek
in interface nl.tue.astar.util.FastLookupPriorityQueue
public int size()
size
in interface nl.tue.astar.util.FastLookupPriorityQueue
public nl.tue.astar.Record poll()
poll
in interface nl.tue.astar.util.FastLookupPriorityQueue