story.dbcore.attributes
Class AttributeSet

java.lang.Object
  extended by story.dbcore.attributes.AttributeSet
All Implemented Interfaces:
java.io.Serializable

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

An object that represents a collection of all the attributes attached to a certain node. It conspicuously does not allow access to individual Attribute objects once they are given to it, but instead acts as a middleman for accessing them.

See Also:
Serialized Form

Constructor Summary
AttributeSet(GenericNode node, NodeConfig config)
          Constructor for attaching to a node
AttributeSet(LinkLabel linkLabel)
          Constructor for attaching to a link label.
 
Method Summary
 boolean attributeEquals(AttributeID ID, AttributeValue other, boolean overrideInheritance)
          Determine whether an attribute is equal to some constant value.
 boolean attributeGreaterThan(AttributeID ID, AttributeValue other, boolean overrideInheritance)
          Determine whether an attribute is greater than some constant value.
 boolean containsAttribute(AttributeID ID)
          Determines whether the set has an attribute of a certain name.
 void enableInheritance(Document doc, LinkProperties linkProperties)
          Set links to the Document and the LinkProperties objects in this AttributeSet so it can implement attribute inheritance.
 java.lang.Class getAttributeClass(AttributeID ID)
          Get an existing attribute (value)'s class.
 java.util.Iterator getAttributeIDs()
          Get an iterator over the AttributeIDs of all the attributes in the set.
 java.lang.Class getAttributeType(AttributeID ID)
          Get an existing attribute's type as a class.
 AttributeValue getAttributeValue(AttributeID ID, boolean overrideInheritance)
          Get an existing attribute's value.
 int getMaxAttributeLength(AttributeID ID)
          Returns the "maximum" length of the acceptable value for an attribute.
 void initLinkAttribute(AttributeID ID, Attribute attribute)
          Add a new attribute.
 boolean modified(AttributeID ID)
          Returns whether an attribute has been set(), i.e., modified from its default value.
 int numAttributes()
          Return the number of attributes.
 AttributeValue setAttribute(AttributeID ID, AttributeValue value)
          Set an existing attribute from a string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeSet

public AttributeSet(GenericNode node,
                    NodeConfig config)
             throws Scheherexception
Constructor for attaching to a node

Throws:
Scheherexception

AttributeSet

public AttributeSet(LinkLabel linkLabel)
Constructor for attaching to a link label. In this case attributes are registered and initialized at one through initLinkAttribute.

Method Detail

enableInheritance

public void enableInheritance(Document doc,
                              LinkProperties linkProperties)
Set links to the Document and the LinkProperties objects in this AttributeSet so it can implement attribute inheritance.


numAttributes

public int numAttributes()
Return the number of attributes.


initLinkAttribute

public void initLinkAttribute(AttributeID ID,
                              Attribute attribute)
                       throws Scheherexception
Add a new attribute.

Parameters:
ID - The name of the attribute.
attribute - The attribute object.
Throws:
Scheherexception

setAttribute

public AttributeValue setAttribute(AttributeID ID,
                                   AttributeValue value)
                            throws Scheherexception
Set an existing attribute from a string. (Attribute may parse the string to fit its semantic structure.)

Parameters:
ID - The AttributeID for the attribute.
value - The value to set.
Throws:
Scheherexception

getAttributeValue

public AttributeValue getAttributeValue(AttributeID ID,
                                        boolean overrideInheritance)
                                 throws Scheherexception
Get an existing attribute's value.

Parameters:
ID - The AttributeID for the attribute.
overrideInheritance - Set to true if you want to only check the node itself, but false if you want to allow the node to inherit the value from a neighborhing node (according to the rules set in LinkProperties).
Throws:
Scheherexception

getAttributeClass

public java.lang.Class getAttributeClass(AttributeID ID)
                                  throws Scheherexception
Get an existing attribute (value)'s class.

Parameters:
ID - The AttributeID for the attribute.
Throws:
Scheherexception

attributeEquals

public boolean attributeEquals(AttributeID ID,
                               AttributeValue other,
                               boolean overrideInheritance)
                        throws Scheherexception
Determine whether an attribute is equal to some constant value.

Throws:
Scheherexception

attributeGreaterThan

public boolean attributeGreaterThan(AttributeID ID,
                                    AttributeValue other,
                                    boolean overrideInheritance)
                             throws Scheherexception
Determine whether an attribute is greater than some constant value.

Throws:
Scheherexception

getAttributeType

public java.lang.Class getAttributeType(AttributeID ID)
                                 throws Scheherexception
Get an existing attribute's type as a class.

Parameters:
ID - The AttributeID for the attribute.
Throws:
Scheherexception

getMaxAttributeLength

public int getMaxAttributeLength(AttributeID ID)
                          throws Scheherexception
Returns the "maximum" length of the acceptable value for an attribute.

Throws:
Scheherexception

getAttributeIDs

public java.util.Iterator getAttributeIDs()
                                   throws Scheherexception
Get an iterator over the AttributeIDs of all the attributes in the set.

Throws:
Scheherexception

modified

public boolean modified(AttributeID ID)
                 throws Scheherexception
Returns whether an attribute has been set(), i.e., modified from its default value. Returns true even if it was set() to the same value as the original default value).

Parameters:
ID - The AttributeID for the attribute.
Throws:
Scheherexception

containsAttribute

public boolean containsAttribute(AttributeID ID)
                          throws Scheherexception
Determines whether the set has an attribute of a certain name.

Throws:
Scheherexception


Copyright © 2011 David K. Elson. All Rights Reserved.