public class EdgeWeightLabeller extends java.lang.Object implements NumberEdgeValue
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
WEIGHT_DEFAULT_KEY
The UserData key that stores edge weights.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all weights stored by this decorator.
|
Graph |
getGraph()
Returns the graph associated with this particular
labeller.
|
static EdgeWeightLabeller |
getLabeller(Graph g)
Finds or creates an edge labeller for the graph, using
the default user data key.
|
static EdgeWeightLabeller |
getLabeller(Graph g,
java.lang.Object key)
Finds or creates an edge labeleller for the graph, using
the given userdata key.
|
java.lang.Number |
getNumber(ArchetypeEdge e) |
int |
getWeight(ArchetypeEdge e)
Gets the weight of a particualr edge.
|
static boolean |
hasWeightLabeller(Graph g)
Checks for an edge labeleller for the graph, using
the default user data key.
|
static boolean |
hasWeightLabeller(Graph g,
java.lang.Object key)
Checks an edge labeleller for the graph at the given key.
|
java.lang.Number |
removeWeight(ArchetypeEdge e)
Removes the weight stored by this decorator for the indicated edge
e ,
and returns the value of this weight (or null if there was no
such weight for this edge). |
void |
setNumber(ArchetypeEdge e,
java.lang.Number n) |
void |
setWeight(ArchetypeEdge e,
int i)
Sets an edge to this weight.
|
public static final java.lang.Object WEIGHT_DEFAULT_KEY
public static EdgeWeightLabeller getLabeller(Graph g)
g
- public static boolean hasWeightLabeller(Graph g)
g
- public static boolean hasWeightLabeller(Graph g, java.lang.Object key)
public static EdgeWeightLabeller getLabeller(Graph g, java.lang.Object key)
g
- public int getWeight(ArchetypeEdge e)
e
- an edge that has been weighted.public Graph getGraph()
public void setWeight(ArchetypeEdge e, int i)
e
- the edgei
- the weightif
- the edge is not part of the graphpublic java.lang.Number removeWeight(ArchetypeEdge e)
e
,
and returns the value of this weight (or null
if there was no
such weight for this edge).public void clear()
public java.lang.Number getNumber(ArchetypeEdge e)
getNumber
in interface NumberEdgeValue
e
- the edge to examineNumberEdgeValue.getNumber(edu.uci.ics.jung.graph.ArchetypeEdge)
public void setNumber(ArchetypeEdge e, java.lang.Number n)
setNumber
in interface NumberEdgeValue
e
- the edge whose value we're settingn
- the Number to which we're setting the edgeNumberEdgeValue.setNumber(edu.uci.ics.jung.graph.ArchetypeEdge, java.lang.Number)