scratch.joshua.jung_2_0.decoration
Interface SettableDecoration<K,V>
- All Superinterfaces:
- Decoration<K,V>
- All Known Subinterfaces:
- SettableBidiDecoration<K,V>
public interface SettableDecoration<K,V>
- extends Decoration<K,V>
An interface for readable and writeable decorations of arbitrary elements.
(This is a generalization of interfaces such as NumberEdgeValue
in the JUNG 1.x libraries.) Does not place any constraints on the
uniqueness of decorations; if you want a one-to-one mapping from
elements to decorations, see BidiDecoration
or
SettableBidiDecoration
.
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 Map
interface--that is, so that a Map
instance can serve as a
SettableDecoration
.
Examples of ways to instantiate this interface include:
SettableDecoration vertex_stringer = new HashMap();
SettableDecoration edge_weight =
new Decoration()
{
public Integer get(MyEdge e) { return e.getWeight(); }
public void put(MyEdge e, Integer i) { e.setWeight(i); }
};
(The second example assumes that you have defined a class called MyEdge
that provides getWeight()
and setWeight
methods.)
- Author:
- Joshua O'Madadhain
- See Also:
Decoration
,
BidiDecoration
,
SettableBidiDecoration
Method Summary |
V |
put(K key,
V value)
|
Methods inherited from interface scratch.joshua.jung_2_0.decoration.Decoration |
get |
put
V put(K key,
V value)