|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectedu.uci.ics.jung.graph.decorators.StringLabeller
A StringLabeller applies a set of labels to a Graph. The Labeller, specifically, attaches itself to a Graph's UserData, and maintains an index of Strings that are labels. Note that the strings must be unique so that getVertex( label ) will work.
| Nested Class Summary | |
static class |
StringLabeller.UniqueLabelException
A minor class to store exceptions from duplicate labels in the Graph. |
| Field Summary | |
static java.lang.Object |
DEFAULT_STRING_LABELER_KEY
The key that hasLabeller() and getLabeller() use. |
| Method Summary | |
void |
assignDefaultLabels(java.util.Set vertices,
int offset)
Assigns textual labels to every vertex passed in. |
void |
clear()
Wipes the entire table. |
Graph |
getGraph()
Gets the graph associated with this StringLabeller |
java.lang.String |
getLabel(Vertex v)
Gets the String label associated with a particular Vertex. |
static StringLabeller |
getLabeller(Graph g)
Gets a labeller associated with this graph. |
static StringLabeller |
getLabeller(Graph g,
java.lang.Object key)
Returns a labeller attached to a particular key in the graph. |
Vertex |
getVertex(java.lang.String label)
Gets the Vertex from the graph associated with this label. |
static boolean |
hasStringLabeller(Graph g)
Checks if a labeller is associated with this graph. |
static boolean |
hasStringLabeller(Graph g,
java.lang.Object key)
Checks for a labeller attached to a particular key in the graph. |
Vertex |
removeLabel(java.lang.String string)
|
void |
setLabel(Vertex v,
java.lang.String l)
Associates a Vertex with a Label, overrwriting any previous labels on this vertex. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.Object DEFAULT_STRING_LABELER_KEY
| Method Detail |
public static StringLabeller getLabeller(Graph g)
public static boolean hasStringLabeller(Graph g)
g - The graph to check.
public static boolean hasStringLabeller(Graph g,
java.lang.Object key)
g - the Graphkey - the UserData key to which it is attached
public static StringLabeller getLabeller(Graph g,
java.lang.Object key)
g - the Graphkey - the UserData key to which it is attached
public Graph getGraph()
public java.lang.String getLabel(Vertex v)
v - a Vertex inside the Graph.
FatalException - if the Vertex is not in the Graph associated with this
Labeller.public Vertex getVertex(java.lang.String label)
label -
public void setLabel(Vertex v,
java.lang.String l)
throws StringLabeller.UniqueLabelException
v - a Vertex in the labeller's graphl - a Label to be associated with this vertex
FatalException - thrown if this vertex isn't in the Labeller's graph
StringLabeller.UniqueLabelException - thrown if this label is already associated with some other
vertex.
public void assignDefaultLabels(java.util.Set vertices,
int offset)
throws StringLabeller.UniqueLabelException
vertices - The set of Vertices to label. All must be part of this graph.offset - The starting value to number vertices from
StringLabeller.UniqueLabelException - Is thrown if some other vertexc is already numbered.
FatalException - if any Vertex is not part of the Graph.public Vertex removeLabel(java.lang.String string)
string - public void clear()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||