|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.graph.Element
public abstract class Element
A base class for graph elements (nodes and edges). A graph element consists of an optional weight (an arbitrary object that is associated with the element). We say that an element is unweighted if it does not have an assigned weight. It is an error to attempt to access the weight of an unweighted element. Element weights must be non-null objects.
Edge
,
Node
Red (cxh) |
Red (cxh) |
Field Summary | |
---|---|
protected java.lang.Object |
_weight
The weight that is associated with the element if the element is weighted. |
Constructor Summary | |
---|---|
Element()
Construct an unweighted element. |
|
Element(java.lang.Object weight)
Construct an element with a given weight. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object _weight
Constructor Detail |
---|
public Element()
public Element(java.lang.Object weight)
weight
- The given weight.
java.lang.IllegalArgumentException
- If the specified weight is
null
.Method Detail |
---|
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()
Graph.validEdgeWeight(Object)
,
Graph.validNodeWeight(Object)
,
Graph.validateWeight(Node)
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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |