public class ElementList extends LabeledList
Red (cxh) |
Red (cxh) |
Constructor and Description |
---|
ElementList(java.lang.String descriptor,
Graph graph)
Construct an empty element list.
|
ElementList(java.lang.String descriptor,
Graph graph,
int elementCount)
Construct an empty element list with enough storage allocated for the
specified number of elements.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancelWeight(Element element)
Disassociate the given element from its weight information.
|
boolean |
changeWeight(Element element)
Given an element in this list, check if the weight has
changed (since the element was added to the graph or was
last validated, whichever is more recent), and if so,
change the current mapping of a weight to the element or
remove the element from the set of unweighted elements.
|
void |
clear()
Clear all of the elements in this list.
|
boolean |
containsWeight(java.lang.Object weight)
Test if the specified object is an element weight in this
list.
|
Element |
element(java.lang.Object weight)
Return an element in this list that has a specified weight.
|
java.util.Collection |
elements()
Return all the elements in this list in the form of an unmodifiable
collection.
|
java.util.Collection |
elements(java.lang.Object weight)
Return all the elements in this graph that have a specified weight.
|
void |
registerWeight(Element element)
Associate a graph element to its weight given the relevant mapping of
weights to elements, and the set of unweighted elements of the same
type (nodes or edges).
|
boolean |
remove(Element element)
Remove an element from this list if it exists in the list.
|
boolean |
validateWeight(Element element,
java.lang.Object oldWeight)
Validate the weight of a given graph element, given the previous
weight of that element.
|
add, add, addAll, addAll, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, label, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray, toString, toString
public ElementList(java.lang.String descriptor, Graph graph)
descriptor
- A one-word description of the type of elements
that are to be stored in this list.graph
- The graph associated with this element list.public ElementList(java.lang.String descriptor, Graph graph, int elementCount)
descriptor
- A one-word description of the type of elements
that are to be stored in this list.graph
- The graph associated with this element list.elementCount
- The number of elements.public boolean cancelWeight(Element element)
element
- The element.public boolean changeWeight(Element element)
element
- The graph element.public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.List
clear
in class LabeledList
public boolean containsWeight(java.lang.Object weight)
equals
method. If the specified
weight is null, return false.weight
- The element weight to be tested.public Element element(java.lang.Object weight)
weight
- The specified weight.GraphWeightException
- If the specified weight
is not an element weight in this list or if the specified weight
is null but the list does not contain any unweighted edges.public java.util.Collection elements()
public java.util.Collection elements(java.lang.Object weight)
Element
.weight
- The specified weight.public void registerWeight(Element element)
element
- The element.public boolean remove(Element element)
element
- The element to be removed.public boolean validateWeight(Element element, java.lang.Object oldWeight)
element
- The element.oldWeight
- The previous weight (null if the element was
previously unweighted).