public abstract class Element
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Object |
_weight
The weight that is associated with the element if the element is
weighted.
|
| Constructor and Description |
|---|
Element()
Construct an unweighted element.
|
Element(java.lang.Object weight)
Construct an element with a given weight.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
descriptor()
A one-word description of the type of this graph element.
|
java.lang.Object |
getWeight()
Return the weight that has been associated with this element.
|
boolean |
hasWeight()
Return
true if and only if this is a weighted element. |
void |
removeWeight()
Make the element unweighted.
|
void |
setWeight(java.lang.Object weight)
Set or change the weight of an element.
|
protected java.lang.Object _weight
public Element()
public Element(java.lang.Object weight)
weight - The given weight.java.lang.IllegalArgumentException - If the specified weight is
null.public java.lang.String descriptor()
public final java.lang.Object getWeight()
java.lang.IllegalStateException - If this is an unweighted element.setWeight(Object)public final boolean hasWeight()
true if and only if this is a weighted element.public final void removeWeight()
public final void setWeight(java.lang.Object weight)
weight - The new weight.java.lang.IllegalArgumentException - If the object that is passed as
argument is null.Graph.validEdgeWeight(Object),
Graph.validNodeWeight(Object),
Graph.validateWeight(Node),
getWeight()