Interface SmartGeneralPriorityQueue<E,K extends Comparable<K>>
-
- Type Parameters:
E- element class.K- key class.
- All Superinterfaces:
Collection<E>,Iterable<E>,SmartCollection<E>,SmartPriorityQueue<E>
- All Known Implementing Classes:
BackedGeneralPriorityQueue
public interface SmartGeneralPriorityQueue<E,K extends Comparable<K>> extends SmartPriorityQueue<E>
A generalized priority queue which allows storing arbitrary elements that don't have to be comparable, neither by their natural ordering nor by a providedComparator. Instead, keys can be assigned to the elements explicitly.Since this interface extends the
SmartCollection(and thus also theCollection) interface, it has to provide theSmartCollection.referencedAdd(Object)andCollection.add(Object)methods with no additional key parameters. This is handled by using a default key, which is implicitly used for all elements inserted using the above methods. Initially, the default key isnull, whereas thenullkey is by convention larger than any non-nullkey. The default key for consequent insertions can be changed by callingsetDefaultKey(Comparable).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ElementReferenceadd(E elem, K key)Inserts an element with the specified key.voidchangeKey(ElementReference ref, K newKey)Changes the key of an element in the priority key.voidsetDefaultKey(K defaultKey)Sets the default key, which is used for elements that are inserted with no explicit key specified.-
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
-
Methods inherited from interface net.automatalib.common.smartcollection.SmartCollection
addAll, addAll, choose, chooseRef, deepClear, find, get, quickClear, referencedAdd, referenceIterator, references, remove, remove, replace
-
Methods inherited from interface net.automatalib.common.smartcollection.SmartPriorityQueue
extractMin, peekMin
-
-
-
-
Method Detail
-
add
ElementReference add(E elem, K key)
Inserts an element with the specified key.- Parameters:
elem- the element to insert.key- the key for this element.- Returns:
- the reference to the inserted element.
-
setDefaultKey
void setDefaultKey(K defaultKey)
Sets the default key, which is used for elements that are inserted with no explicit key specified.- Parameters:
defaultKey- the new default key.
-
changeKey
void changeKey(ElementReference ref, K newKey)
Changes the key of an element in the priority key.- Parameters:
ref- reference to the element whose key is to be changed.newKey- the new key of this element.
-
-