viper.descriptors.attributes
Class Attribute_svalue

java.lang.Object
  extended byviper.descriptors.attributes.AbstractAttribute
      extended byviper.descriptors.attributes.Attribute
          extended byviper.descriptors.attributes.Attribute_svalue
All Implemented Interfaces:
java.lang.Cloneable, Filterable

public class Attribute_svalue
extends Attribute

This Attribute describes a String of characters. This class implements various distance functions on strings, specifically edit (Levenshtein) and Hamming distances, as well as equality. For composition, it just sticks the two strings together, so it is not commutative.


Nested Class Summary
 
Nested classes inherited from class viper.filters.Filterable
Filterable.Rule
 
Field Summary
 
Fields inherited from class viper.descriptors.attributes.Attribute
composition, compositionTolerance, compositionType, errors, value
 
Constructor Summary
Attribute_svalue()
          Constructs a new static string-valued attribute.
Attribute_svalue(Attribute old)
          Copies the old attribute.
Attribute_svalue(boolean dynamic)
          Constructs a new string-values attribute.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this Attribute.
 Filterable.Rule convertRule(java.lang.String unparsedRule, java.util.List unparsedValues, ErrorWriter err)
          This converts a rule into the proper format for the data type.
 java.lang.String getType()
          Returns the Attribute type, eg lvalue or bbox.
 boolean isValidRule(java.lang.String ruleName)
          Tell if a name is a valid rule or not
 boolean possibleValueOf(java.lang.String S)
          Determines if this Attribute can take the value specified.
 
Methods inherited from class viper.descriptors.attributes.Attribute
compareTo, compose, crop, getCompositionType, getExtraConfig, getStaticValue, getValue, getValues, getValueToString, getXMLFormat, getXMLFormat, isCompositionType, isType, nullXML, nullXML, parseExtraConfig, passes, possibleValueOf, setCompositionType, setDefaultValue, setDefaultValue, setExtraConfig, setFrameSpan, setName, setOutputWidth, setStaticValue, setValue, setValue, setValue, setValue, setValue, toString
 
Methods inherited from class viper.descriptors.attributes.AbstractAttribute
getArchetype, getDefault, getExtraConfigInXML, getExtraConfigString, getName, isDynamic, loadAttributeType, named, named, parseAnInt, resetDefault, setArchetype, setArchetype, setArchetype, setDynamic
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attribute_svalue

public Attribute_svalue()
Constructs a new static string-valued attribute.


Attribute_svalue

public Attribute_svalue(boolean dynamic)
Constructs a new string-values attribute.

Parameters:
dynamic - if the attribute can take on different values over time

Attribute_svalue

public Attribute_svalue(Attribute old)
Copies the old attribute.

Parameters:
old - the old attribute
Method Detail

getType

public java.lang.String getType()
Description copied from class: AbstractAttribute
Returns the Attribute type, eg lvalue or bbox.

Overrides:
getType in class Attribute
Returns:
"svalue"

clone

public java.lang.Object clone()
Description copied from class: Attribute
Returns a clone of this Attribute.

Overrides:
clone in class Attribute
Returns:
a reference to a new Attribute with all the values of the original

possibleValueOf

public boolean possibleValueOf(java.lang.String S)
Description copied from class: Attribute
Determines if this Attribute can take the value specified. Relations are not yet supported.

Overrides:
possibleValueOf in class Attribute
Parameters:
S - the string to be tested
Returns:
whether or not the string is valid

isValidRule

public boolean isValidRule(java.lang.String ruleName)
Description copied from interface: Filterable
Tell if a name is a valid rule or not

Specified by:
isValidRule in interface Filterable
Overrides:
isValidRule in class Attribute
Returns:
true when it is "==" or "!="

convertRule

public Filterable.Rule convertRule(java.lang.String unparsedRule,
                                   java.util.List unparsedValues,
                                   ErrorWriter err)
                            throws BadDataException
Description copied from class: Attribute
This converts a rule into the proper format for the data type. Each subclass of this class must implement this function if they want to be able to use the rule-based filtering system.

Specified by:
convertRule in interface Filterable
Overrides:
convertRule in class Attribute
Parameters:
unparsedRule - the rule to convert
unparsedValues - the values
err - the error stream
Returns:
the rule for this attribute
Throws:
BadDataException - if there is an error in the rule or values