|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.graph.LabeledList
ptolemy.graph.ElementList
public class ElementList
A list of graph elements. This class manages the storage and weight information associated with a list of unique graph elements. This class is normally for use internally within graph classes.
Red (cxh) |
Red (cxh) |
Field Summary | |
---|---|
private java.lang.String |
_descriptor
|
private static java.util.Collection |
_emptyCollection
|
private Graph |
_graph
|
private java.util.HashSet |
_unweightedSet
|
private java.util.HashMap |
_weightMap
|
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class ptolemy.graph.LabeledList |
---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.String _descriptor
private Graph _graph
private static final java.util.Collection _emptyCollection
private java.util.HashSet _unweightedSet
private java.util.HashMap _weightMap
Constructor Detail |
---|
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.Method Detail |
---|
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).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |