multivalent

Class VObject

public abstract class VObject extends Object

java.lang.Objects with a name and attributes. Superclass of Behavior and Node. Attributes are generally java.lang.Strings, but VObjects that are not to be written to a hub can store any java.lang.Object as the value. Most getters optionally take a second value, a default that's returned if the attribute does not exist or cannot be interpreted as the requested type, rather than throwing an exception in that case.

Also validate, statistics.

Version: $Revision: 1.6 $ $Date: 2003/06/02 05:11:39 $

Field Summary
protected Map<String,Object>attr_
All Behaviors and Nodes have attributes, that is, a set (possibly empty) of key, value pairs.
Method Summary
Iterator<Entry<String,Object>>attrEntrySetIterator()
Iterator<String>attrKeysIterator()
booleancheckRep()
Checks "representation invariant" (see MIT SE), and returns true iff object is valid, which should be always
voidclearAttributes()
StringgetAttr(String key)
StringgetAttr(String key, String default_)
Same as getAttr, except if no such key, then return default_.
Map<String,Object>getAttributes()
Needed for scripting, testing and moving from ESISNode to real node, but not for general use.
MultivalentgetGlobal()
Convenience method to global state in class Multivalent.
abstract StringgetName()
ObjectgetValue(String key)
Return attribute value that might not be of type String.
booleanhasAttributes()
DOM2.
voidputAttr(String key, Object val)
If val == null, remove attribute.
ObjectremoveAttr(String key)
Returns old value of key.
voidsetAttributes(Map<String,Object> attrs)

Field Detail

attr_

protected Map<String,Object> attr_
All Behaviors and Nodes have attributes, that is, a set (possibly empty) of key, value pairs. Attributes keys must be Strings, and are canonicalized to all lowercase. Values must be Strings. By default, attributes are kept in a CHashMap, which ignores that case of the key; if a java.util.HashMap is desired, create the object with one.

Method Detail

attrEntrySetIterator

public final Iterator<Entry<String,Object>> attrEntrySetIterator()

attrKeysIterator

public final Iterator<String> attrKeysIterator()

checkRep

public boolean checkRep()
Checks "representation invariant" (see MIT SE), and returns true iff object is valid, which should be always.

clearAttributes

public final void clearAttributes()

getAttr

public final String getAttr(String key)

getAttr

public final String getAttr(String key, String default_)
Same as getAttr, except if no such key, then return default_.

getAttributes

public final Map<String,Object> getAttributes()
Needed for scripting, testing and moving from ESISNode to real node, but not for general use.

getGlobal

public Multivalent getGlobal()
Convenience method to global state in class Multivalent.

getName

public abstract String getName()

getValue

public final Object getValue(String key)
Return attribute value that might not be of type String.

hasAttributes

public boolean hasAttributes()
DOM2.

putAttr

public final void putAttr(String key, Object val)
If val == null, remove attribute.

removeAttr

public final Object removeAttr(String key)
Returns old value of key.

setAttributes

public final void setAttributes(Map<String,Object> attrs)