edu.uci.ics.jung.utils
Interface UserDataContainer

All Superinterfaces:
Cloneable
All Known Subinterfaces:
ArchetypeEdge, ArchetypeGraph, ArchetypeVertex, DirectedEdge, DirectedGraph, Edge, Element, Graph, GraphCollapser.CollapsedEdge, GraphCollapser.CollapsedVertex, Hyperedge, Hypergraph, Hypervertex, KPartiteGraph, UndirectedEdge, UndirectedGraph, Vertex
All Known Implementing Classes:
AbstractArchetypeEdge, AbstractArchetypeGraph, AbstractArchetypeVertex, AbstractElement, AbstractHyperedge, AbstractHyperUnitBPG, AbstractHypervertex, AbstractSparseEdge, AbstractSparseGraph, AbstractSparseVertex, BipartiteEdge, BipartiteGraph, BipartiteGraphCollapser.CollapsedBipartiteEdge, BipartiteGraphCollapser.CollapsedBipartiteVertex, BipartiteVertex, CollectionHyperedge, CollectionHypervertex, DefaultUserData, DirectedSparseEdge, DirectedSparseGraph, DirectedSparseVertex, GraphCollapser.CollapsedSparseVertex, GraphCollapser.DirectedCollapsedEdge, GraphCollapser.UndirectedCollapsedEdge, HyperedgeBPG, HypergraphBPG, HypervertexBPG, KPartiteSparseGraph, LazySparseVertex, LeanSparseVertex, ListHyperedge, ListHypervertex, SetHyperedge, SetHypergraph, SetHypervertex, SimpleDirectedSparseVertex, SimpleSparseVertex, SimpleUndirectedSparseVertex, SparseGraph, SparseTree, SparseVertex, UndirectedSparseEdge, UndirectedSparseGraph, UndirectedSparseVertex, UnifiedUserData, UserData, UserDataDelegate

public interface UserDataContainer
extends Cloneable

The generic interface for storing UserData. All graphs, vertices, and edges implement this interface and can therefore store custom local data.

Author:
Joshua O'Madadhain, Scott White, Danyel Fisher

Nested Class Summary
static interface UserDataContainer.CopyAction
          Decides what to do when a user datum is copied.
 
Method Summary
 void addUserDatum(Object key, Object datum, UserDataContainer.CopyAction copyAct)
          Adds the specified data with the specified key to this object's user data repository, with the specified CopyAction.
 Object clone()
           
 boolean containsUserDatumKey(Object key)
          Reports whether key is a key of this user data container.
 Object getUserDatum(Object key)
          Retrieves the object in this object's user data repository to which key refers.
 UserDataContainer.CopyAction getUserDatumCopyAction(Object key)
          Retrieves the CopyAction for the object stored in this object's user data repository to which key refers.
 Iterator getUserDatumKeyIterator()
          Provides an iterator over this object's user data repository key set.
 void importUserData(UserDataContainer udc)
          Takes the user data stored in udc and copies it to this object's user data repository, respecting each datum's CopyAction.
 Object removeUserDatum(Object key)
          Retrieves the object in this object's user data repository to which key refers, and removes it from the repository.
 void setUserDatum(Object key, Object datum, UserDataContainer.CopyAction copyAct)
          If key refers to an existing user datum in this object's repository, that datum is replaced by the specified datum.
 

Method Detail

clone

Object clone()
             throws CloneNotSupportedException
Throws:
CloneNotSupportedException

addUserDatum

void addUserDatum(Object key,
                  Object datum,
                  UserDataContainer.CopyAction copyAct)
Adds the specified data with the specified key to this object's user data repository, with the specified CopyAction.

Parameters:
key - the key of the datum being added
datum - the datum being added
copyAct - the CopyAction of the datum being added

importUserData

void importUserData(UserDataContainer udc)
Takes the user data stored in udc and copies it to this object's user data repository, respecting each datum's CopyAction.

Parameters:
udc - the source of the user data to be copied into this container

getUserDatumKeyIterator

Iterator getUserDatumKeyIterator()
Provides an iterator over this object's user data repository key set.


getUserDatumCopyAction

UserDataContainer.CopyAction getUserDatumCopyAction(Object key)
Retrieves the CopyAction for the object stored in this object's user data repository to which key refers.

Parameters:
key - the key of the datum whose CopyAction is requested
Returns:
CopyAction the requested CopyAction

getUserDatum

Object getUserDatum(Object key)
Retrieves the object in this object's user data repository to which key refers.

Parameters:
key - the key of the datum to retrieve
Returns:
Object the datum retrieved

setUserDatum

void setUserDatum(Object key,
                  Object datum,
                  UserDataContainer.CopyAction copyAct)
If key refers to an existing user datum in this object's repository, that datum is replaced by the specified datum. Otherwise this is equivalent to addUserDatum(key, data, copyAct).

Parameters:
key - the key of the datum being added/modified
datum - the replacement/new datum
copyAct - the CopyAction for the new (key, datum) pair

removeUserDatum

Object removeUserDatum(Object key)
Retrieves the object in this object's user data repository to which key refers, and removes it from the repository.

Parameters:
key - the key of the datum to be removed
Returns:
Object the datum removed

containsUserDatumKey

boolean containsUserDatumKey(Object key)
Reports whether key is a key of this user data container.

Parameters:
key - the key to be queried
Returns:
true if key is present in this user data container