scratch.joshua.jung_2_0.decoration
Interface BidiDecoration<K,V>

All Superinterfaces:
Decoration<K,V>
All Known Subinterfaces:
SettableBidiDecoration<K,V>

public interface BidiDecoration<K,V>
extends Decoration<K,V>

An interface for read-only one-to-one decorations of arbitrary elements. (This is similar to classes such as StringLabeller in the JUNG 1.x libraries.) Constrains the decorations to be unique (that is, each decoration may be used by only one element, and therefore the decorations uniquely identify the elements and vice versa). If you want an unconstrained mapping from elements to decorations, see Decoration or SettableDecoration.

The behavior of implementations of this interface when a duplicate assignment is made (either two elements are assigned the same decoration, or one element is assigned to two decorations) is undefined. Implementors may choose to throw exceptions for either of these conditions, both, or neither.

The purpose of this interface is to provide a simple unifying mechanism for accessing element (meta)data, which may be variously stored in instance fields, auxiliary data structures such as Map instances, or the JUNG user data repository.

This interface is designed so as to be compatible with the BidiMap interface--that is, so that a BidiMap instance can serve as a Decoration.

Examples of ways to instantiate this interface include:

 BidiDecoration vertex_labels = new DualHashBidiMap();
 BidiDecoration edge_ids = 
      new BidiDecoration(BidiMap bm) 
      {
          public Integer get(Edge e) { return bm.get(e); }
          public Edge getKey(Integer i) { return bm.getKey(i); }
      };
 

Author:
Joshua O'Madadhain
See Also:
SettableDecoration, Decoration, SettableBidiDecoration

Method Summary
 K getKey(V value)
          Returns the key (element) associated with decoration value.
 
Methods inherited from interface scratch.joshua.jung_2_0.decoration.Decoration
get
 

Method Detail

getKey

K getKey(V value)
Returns the key (element) associated with decoration value.