viper.descriptors.attributes
Interface AttributeValue

All Superinterfaces:
Measurable
All Known Subinterfaces:
ExtendedAttributeValue
All Known Implementing Classes:
Attribute_circle.CircleValue, Attribute_ellipse.EllipseValue, Attribute_number.NumberValue, viper.descriptors.attributes.Attribute_polygon.AbstractPolygonValue

public interface AttributeValue
extends Measurable

All Attributes operate on Attribute values. Some may also implement Composable. These objects should implement clone, hashCode, toString and equals in addition to the methods proscribed by Measurable. Note that they should be immutable. This will make everything quicker, as there is far more cloning going on than I would like.

Author:
davidm

Nested Class Summary
 
Nested classes inherited from class viper.descriptors.attributes.Measurable
Measurable.Difference
 
Method Summary
 AttributeValue setValue(org.w3c.dom.Element el)
          Returns a new copy of the object set to the data the xml-dom element represents.
 AttributeValue setValue(java.lang.String S)
          Returns a new copy of the object with the data the String represents.
 org.w3c.dom.Element toXML(org.w3c.dom.Document doc)
          Returns an xml element for this object.
 boolean validate(AttributeValue v)
          Checks to make sure that the value can be set.
 
Methods inherited from interface viper.descriptors.attributes.Measurable
getDifference, getDifference, getType
 

Method Detail

toXML

public org.w3c.dom.Element toXML(org.w3c.dom.Document doc)
Returns an xml element for this object. It should be in the namespace Attribute.DEFAULT_NAMESPACE_QUALIFIER with a qualified name in the form Attribute.DEFAULT_NAMESPACE_QUALIFIER:type.

Parameters:
doc - The root for the element.
Returns:
New DOM element for this data.

setValue

public AttributeValue setValue(java.lang.String S)
                        throws java.lang.IllegalArgumentException
Returns a new copy of the object with the data the String represents. Useful for old GTF format. The following should be true: a.equals (a.setValue (a.toString())) Should try to use XML format whenever possible.

Parameters:
S - String representation of this type of value.
Returns:
the parsed value
Throws:
java.lang.IllegalArgumentException - If the data is ill-formed

setValue

public AttributeValue setValue(org.w3c.dom.Element el)
                        throws java.lang.IllegalArgumentException
Returns a new copy of the object set to the data the xml-dom element represents.

Parameters:
el - DOM Node to parse
Returns:
the parsed value
Throws:
java.lang.IllegalArgumentException - If the data is ill-formed

validate

public boolean validate(AttributeValue v)
Checks to make sure that the value can be set.

Parameters:
v - the value to check against this archetype
Returns:
true iff the prototype can take this value.