edu.uci.ics.jung.graph.decorators
Class ToStringLabeller

java.lang.Object
  extended byedu.uci.ics.jung.graph.decorators.StringLabeller
      extended byedu.uci.ics.jung.graph.decorators.ToStringLabeller

public class ToStringLabeller
extends StringLabeller

Labels vertices by their toString. This class functions as a drop-in replacement for the default StringLabeller method. This class does not guarantee unique labels; or even consistent ones; as a result, getVertexByLabel will always return NULL.

Author:
danyelf

Nested Class Summary
 
Nested classes inherited from class edu.uci.ics.jung.graph.decorators.StringLabeller
StringLabeller.UniqueLabelException
 
Field Summary
 
Fields inherited from class edu.uci.ics.jung.graph.decorators.StringLabeller
DEFAULT_STRING_LABELER_KEY
 
Method Summary
 void assignDefaultLabels(java.util.Set vertices, int offset)
          This method is not meaningful; it throws an IllegalArgumentException
 java.lang.String getLabel(Vertex v)
          Retunrs v.toString()
 Vertex getVertex(java.lang.String label)
          Always returns null: this impl doesn't keep a table, and so can't meaningfully address this.
 Vertex removeLabel(java.lang.String string)
          This method is not meaningful; it throws an IllegalArgumentException
 void setLabel(Vertex v, java.lang.String l)
          This method always throws an IllegalArgument exception: you cannot externally set the setstring method.
static StringLabeller setLabellerTo(Graph g)
          Sets the default StringLabeller of this graph to be a ToStringLabeller.
static StringLabeller setLabellerTo(Graph g, java.lang.Object key)
          Sets the StringLabeller of this graph, at this key, to be a ToStringLabeller.
 
Methods inherited from class edu.uci.ics.jung.graph.decorators.StringLabeller
clear, getGraph, getLabeller, getLabeller, hasStringLabeller, hasStringLabeller
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assignDefaultLabels

public void assignDefaultLabels(java.util.Set vertices,
                                int offset)
                         throws StringLabeller.UniqueLabelException
This method is not meaningful; it throws an IllegalArgumentException

Overrides:
assignDefaultLabels in class StringLabeller
Parameters:
vertices - The set of Vertices to label. All must be part of this graph.
offset - The starting value to number vertices from
Throws:
StringLabeller.UniqueLabelException - Is thrown if some other vertexc is already numbered.

removeLabel

public Vertex removeLabel(java.lang.String string)
This method is not meaningful; it throws an IllegalArgumentException

Overrides:
removeLabel in class StringLabeller
Parameters:
string -

setLabellerTo

public static StringLabeller setLabellerTo(Graph g,
                                           java.lang.Object key)
Sets the StringLabeller of this graph, at this key, to be a ToStringLabeller.


setLabellerTo

public static StringLabeller setLabellerTo(Graph g)
Sets the default StringLabeller of this graph to be a ToStringLabeller.


getLabel

public java.lang.String getLabel(Vertex v)
Retunrs v.toString()

Overrides:
getLabel in class StringLabeller
Parameters:
v - a Vertex inside the Graph.

getVertex

public Vertex getVertex(java.lang.String label)
Always returns null: this impl doesn't keep a table, and so can't meaningfully address this.

Overrides:
getVertex in class StringLabeller
Parameters:
label -

setLabel

public void setLabel(Vertex v,
                     java.lang.String l)
              throws StringLabeller.UniqueLabelException
This method always throws an IllegalArgument exception: you cannot externally set the setstring method.

Overrides:
setLabel in class StringLabeller
Parameters:
v - a Vertex in the labeller's graph
l - a Label to be associated with this vertex
Throws:
StringLabeller.UniqueLabelException - thrown if this label is already associated with some other vertex.