|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectedu.uci.ics.jung.utils.UserData
Represents custom user- and system-level information to extend the definition of a node. This is the easiest way to extend the class without subclassing. This works as a dictionary in order to help ensure that there are possibilities for extending user information to a variety of different sorts of data. (Each provider of information can register their own enhanced information without interfering with other providers.) Some suggested uses of UserData include
n.setUserInfo ("3DData", new 3DData (
)).
Later, to access this information, the call might be 3DData dd =
(3DData) n.getUserInfo("3DData").
| Nested Class Summary |
| Nested classes inherited from class edu.uci.ics.jung.utils.UserDataContainer |
UserDataContainer.CopyAction |
| Field Summary | |
static UserDataContainer.CopyAction |
CLONE
A CopyAction that clones UserData--that is, it uses the Java clone()call to clone the object. |
static UserDataContainer.CopyAction |
REMOVE
Causes the userdata not to be copied over, and instead returns null. |
static UserDataContainer.CopyAction |
SHARED
A CopyAction that links UserData--that is, points to the original data. |
| Constructor Summary | |
UserData()
|
|
| Method Summary | |
void |
addUserDatum(java.lang.Object key,
java.lang.Object value,
UserDataContainer.CopyAction shared)
Adds user-level information to the node. |
boolean |
containsUserDatumKey(java.lang.Object key)
Reports whether key is a key of this user data container. |
java.lang.Object |
getUserDatum(java.lang.Object key)
Returns UserInfo (if known) for this key, or null if not known. |
UserDataContainer.CopyAction |
getUserDatumCopyAction(java.lang.Object key)
Returns the CopyAction associated with this key. |
java.util.Iterator |
getUserDatumKeyIterator()
Iterates through the keys to all registered data. |
void |
importUserData(UserDataContainer udc)
Uses the CopyAction to determine how each of the user datum elements in udc should be carried over to the this UserDataContiner |
java.lang.Object |
removeUserDatum(java.lang.Object key)
Removes the Datum (if known) for this key, and returns it. |
void |
setUserDatum(java.lang.Object key,
java.lang.Object value,
UserDataContainer.CopyAction shared)
Changes the user-level information to the object. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final UserDataContainer.CopyAction CLONE
clone()call to clone the object. Throws
a CloneNotSupportedException if clone isn't allowed.
public static final UserDataContainer.CopyAction SHARED
String s = "X";
String t = s;
s = "Y";
System.out.pritnln( t ); // will still contain X.
public static final UserDataContainer.CopyAction REMOVE
| Constructor Detail |
public UserData()
| Method Detail |
public void addUserDatum(java.lang.Object key,
java.lang.Object value,
UserDataContainer.CopyAction shared)
addUserDatum in interface UserDataContainerkey - A unique (per type, not per node) key into the informationvalue - The extended information associated with the nodeshared - the CopyAction of the datum being addedpublic void importUserData(UserDataContainer udc)
importUserData in interface UserDataContainerudc - The UserDataContainer whose user data is being imported
public void setUserDatum(java.lang.Object key,
java.lang.Object value,
UserDataContainer.CopyAction shared)
removeUserDatum( key ); addUserDatum(key, value)
setUserDatum in interface UserDataContainerkey - value - shared - the CopyAction for the new (key, datum) pairpublic java.lang.Object getUserDatum(java.lang.Object key)
getUserDatum in interface UserDataContainerkey -
public java.lang.Object removeUserDatum(java.lang.Object key)
removeUserDatum in interface UserDataContainerkey -
public java.util.Iterator getUserDatumKeyIterator()
getUserDatumKeyIterator in interface UserDataContainerpublic boolean containsUserDatumKey(java.lang.Object key)
UserDataContainerkey is a key of this user data container.
containsUserDatumKey in interface UserDataContainerkey - the key to be queried
key is present in this user data containerUserDataContainer.containsUserDatumKey(Object)public UserDataContainer.CopyAction getUserDatumCopyAction(java.lang.Object key)
getUserDatumCopyAction in interface UserDataContainerkey -
public java.lang.String toString()
Object.toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||