Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.graph.decorators
Class GlobalStringLabeller

    java.lang.Object
      edu.uci.ics.jung.graph.decorators.StringLabeller
          edu.uci.ics.jung.graph.decorators.GlobalStringLabeller

All Implemented Interfaces:
  VertexStringer

public class GlobalStringLabeller
extends StringLabeller

The GlobalStringLabeller applies labels to all vertices in a series of graphs. That is, rather than storing one instance per graph, it stores one instance globally that maps from vertex ID to label.

Author:
  danyelf

Nested Class Summary

Nested classes inherited from class edu.uci.ics.jung.graph.decorators.StringLabeller
`StringLabeller.UniqueLabelException`

Field Summary
`protected static GlobalStringLabeller` | `instance`

Fields inherited from class edu.uci.ics.jung.graph.decorators.StringLabeller
`DEFAULT_STRING_LABELER_KEY, graph, labelToVertex, vertexToLabel`

Constructor Summary
`protected` | `GlobalStringLabeller()`

Method Summary
`static StringLabeller` | `getInstance()`
`String` | `getLabel(ArchetypeVertex v)` Gets the String label associated with a particular Vertex.
`static StringLabeller` | `getLabeller(Graph g)` Gets a labeller associated with this graph.
`static boolean` | `hasStringLabeller(Graph g)` Checks if a labeller--any labeller--is associated with this graph.
`static boolean` | `hasStringLabeller(Graph g, Object key)` Checks for a labeller attached to a particular key in the graph.
`void` | `setLabel(Vertex v, String l)` Associates a Vertex with a Label, overrwriting any previous labels on this vertex or vertices equal to it.
`static StringLabeller` | `setLabellerTo(Graph g)` Sets the default StringLabeller of this graph to be a ToStringLabeller.
`static StringLabeller` | `setLabellerTo(Graph g, 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
`assignDefaultLabels, clear, getGraph, getLabeller, getVertex, removeLabel`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### instance

    protected static GlobalStringLabeller instance

Constructor Detail

### GlobalStringLabeller

    protected GlobalStringLabeller()

Method Detail

### setLabellerTo

    public static StringLabeller setLabellerTo(Graph g,
                                               Object key)

  Sets the StringLabeller of this graph, at this key, to be a ToStringLabeller.

### getInstance

    public static StringLabeller getInstance()

  Returns:
    a `GlobalStringLabeller` instance

### getLabeller

    public static StringLabeller getLabeller(Graph g)

  Description copied from class: `StringLabeller`
  Gets a labeller associated with this graph. If no Labeller is associated, creates one and returns it. This method is the same as getLabeller with a key argument, but uses the DEFAULT_STRING_LABELER_KEY as its UserData key. param g The Graph to check.

### setLabellerTo

    public static StringLabeller setLabellerTo(Graph g)

  Sets the default StringLabeller of this graph to be a ToStringLabeller.

### hasStringLabeller

    public static boolean hasStringLabeller(Graph g)

  Checks if a labeller--any labeller--is associated with this graph.

  Parameters:
    `g` - The graph to check.

### hasStringLabeller

    public static boolean hasStringLabeller(Graph g,
                                            Object key)

  Checks for a labeller attached to a particular key in the graph. Useful for creating more than one Labeller for a particular Graph.

  Parameters:
    `g` - the Graph
    `key` - the UserData key to which it is attached
  Returns:
    true if the graph has this labeller.

### getLabel

    public String getLabel(ArchetypeVertex v)

  Gets the String label associated with a particular Vertex.

  Specified by:
    `getLabel` in interface `VertexStringer`
  Overrides:
    `getLabel` in class `StringLabeller`
  Parameters:
    `v` - a Vertex
  Returns:
    the label associated with that vertex If the vertex is not in the graph, throws a FatalException

### setLabel

    public void setLabel(Vertex v,
                         String l)
                  throws StringLabeller.UniqueLabelException

  Associates a Vertex with a Label, overrwriting any previous labels on this vertex or vertices equal to it.

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD