cwi.GraphXML.Elements
Class AttributeProperties

java.lang.Object
  extended by cwi.GraphXML.Elements.AttributeProperties
All Implemented Interfaces:
java.io.Serializable

public class AttributeProperties
extends java.lang.Object
implements java.io.Serializable

This class contains all the properties which are defined for a specific node as attributes and which are not explicitly used elsewhere. Examples are isDirected, preferredLayout, etc.

Which attributes are allowed and which are not is defined in the DTD, and the core parser should control that. This class simply collects all those properties and stores them in hash tables, so that the semantic part of the parser could use them.

There is a naming convention here: if an attribute is of the form "isXYZ", where "X" is a capital letter, then the value should be "true" or "false" and the value is stored as a Boolean. All other properties values are stored as strings.

Some attributes, defined in the DTD, have a semantic value which influences the way the parser works. Example is the "isMetanode" attribute for a node. These attributes are handled separately by the parser. This class includes a static array of strings which lists those attributes which are not handled by this class.

Author:
Ivan Herman
See Also:
Serialized Form

Field Summary
static java.lang.String[] notHandledAttributes
           
 
Constructor Summary
AttributeProperties()
           
 
Method Summary
static AttributeProperties create(org.w3c.dom.Node node)
          Create a new instance of attribute properties, extracting the attributes from the node.
 java.lang.Boolean deleteBooleanAttribute(java.lang.String key)
          Delete a boolean attribute, if defined
 java.lang.String deleteStringAttribute(java.lang.String key)
          Delete a String attribute, if defined
 java.lang.Boolean getBooleanAttribute(java.lang.String key)
          Get a boolean attribute, if defined.
 java.util.Iterator getBooleanKeys()
          Return an iterator for the boolean attributes
 java.lang.String getStringAttribute(java.lang.String key)
          Get a string attribute, if defined.
 java.util.Iterator getStringKeys()
          Return an iterator for the string attributes
 boolean isBooleanAttributeDefined(java.lang.String key)
           
 boolean isEmpty()
          Just a shorthand to see if there are attributes at all...
 boolean isStringAttributeDefined(java.lang.String key)
           
 java.lang.String toString()
          Overrides inherited method, good for debug...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

notHandledAttributes

public static final java.lang.String[] notHandledAttributes
Constructor Detail

AttributeProperties

public AttributeProperties()
Method Detail

getBooleanAttribute

public java.lang.Boolean getBooleanAttribute(java.lang.String key)
Get a boolean attribute, if defined.

Parameters:
key - attribute key
Returns:
the stored attribute, if any, null otherwise.

deleteBooleanAttribute

public java.lang.Boolean deleteBooleanAttribute(java.lang.String key)
Delete a boolean attribute, if defined

Parameters:
key - attribute key
Returns:
the previous stored value, if defined, null otherwise

getBooleanKeys

public java.util.Iterator getBooleanKeys()
Return an iterator for the boolean attributes

Returns:
the iterator

isBooleanAttributeDefined

public boolean isBooleanAttributeDefined(java.lang.String key)

getStringAttribute

public java.lang.String getStringAttribute(java.lang.String key)
Get a string attribute, if defined.

Parameters:
key - attribute key
Returns:
the stored attribute, if any, null otherwise.

deleteStringAttribute

public java.lang.String deleteStringAttribute(java.lang.String key)
Delete a String attribute, if defined

Parameters:
key - attribute key
Returns:
the previous stored value, if defined, null otherwise

getStringKeys

public java.util.Iterator getStringKeys()
Return an iterator for the string attributes

Returns:
the iterator

isStringAttributeDefined

public boolean isStringAttributeDefined(java.lang.String key)

isEmpty

public boolean isEmpty()
Just a shorthand to see if there are attributes at all...


toString

public java.lang.String toString()
Overrides inherited method, good for debug...

Overrides:
toString in class java.lang.Object

create

public static AttributeProperties create(org.w3c.dom.Node node)
Create a new instance of attribute properties, extracting the attributes from the node. If there are no attributes at all, the return value is null