public class DefaultUserData extends UserData implements UserDataFactory
n.setUserInfo ("3DData", new 3DData (
))
.
Later, to access this information, the call might be 3DData dd =
(3DData) n.getUserInfo("3DData").
UserDataContainer.CopyAction
Constructor and Description |
---|
DefaultUserData() |
Modifier and Type | Method and Description |
---|---|
void |
addUserDatum(java.lang.Object key,
java.lang.Object value,
UserDataContainer.CopyAction shared)
Adds user-level information to the node.
|
java.lang.Object |
clone()
This class actually clones by removing the reference to the copyAction
and userData
|
boolean |
containsUserDatumKey(java.lang.Object key)
Reports whether
key is a key of this user data container. |
UserDataContainer |
getInstance()
Returns a single
UserDataContainer instance. |
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.
|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface UserDataContainer
clone
in class UserData
java.lang.CloneNotSupportedException
public void addUserDatum(java.lang.Object key, java.lang.Object value, UserDataContainer.CopyAction shared)
addUserDatum
in interface UserDataContainer
key
- 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 UserDataContainer
udc
- The UserDataContainer whose user data is being importedpublic void setUserDatum(java.lang.Object key, java.lang.Object value, UserDataContainer.CopyAction shared)
removeUserDatum( key ); addUserDatum(key, value)
setUserDatum
in interface UserDataContainer
key
- value
- shared
- the CopyAction for the new (key, datum) pairpublic java.lang.Object getUserDatum(java.lang.Object key)
getUserDatum
in interface UserDataContainer
key
- public java.lang.Object removeUserDatum(java.lang.Object key)
removeUserDatum
in interface UserDataContainer
key
- public java.util.Iterator getUserDatumKeyIterator()
getUserDatumKeyIterator
in interface UserDataContainer
public boolean containsUserDatumKey(java.lang.Object key)
UserDataContainer
key
is a key of this user data container.containsUserDatumKey
in interface UserDataContainer
key
- the key to be queriedkey
is present in this user data containerUserDataContainer.containsUserDatumKey(Object)
public UserDataContainer.CopyAction getUserDatumCopyAction(java.lang.Object key)
getUserDatumCopyAction
in interface UserDataContainer
key
- public UserDataContainer getInstance()
UserDataFactory
UserDataContainer
instance.
Depending on the architecture involved, this may be a singleton
instance, or a new instance may be generated each time the
method is called.getInstance
in interface UserDataFactory