|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object viper.descriptors.attributes.AbstractAttribute viper.descriptors.attributes.Attribute
This class is used to hold an attribute for a Descriptor
.
An Attribute is an aspect of an object that is being monitored in a given
video file. For example, Attributes of a text object would be a
bounding box
, the text, the color, etc.
Nested Class Summary |
Nested classes inherited from class viper.filters.Filterable |
Filterable.Rule |
Field Summary | |
protected boolean |
composition
This is true iff this Attribute is composed of several. |
protected double |
compositionTolerance
|
protected java.lang.String |
compositionType
|
protected boolean |
errors
|
protected java.lang.Object |
value
|
Constructor Summary | |
Attribute()
Create an empty Attribute. toString will return an empty String until more is known. |
|
Attribute(Attribute old)
Default copy constructor. |
|
Attribute(boolean dynamic)
Attributes for OBJECT type should use this constructor, with mobile set to true. |
Method Summary | |
java.lang.Object |
clone()
Returns a clone of this Attribute. |
int |
compareTo(java.lang.Object o)
Useful if arranging the set of Attributes using a linked list, I suppose. |
static Attribute |
compose(FrameSpan thisSpan,
Attribute thisAttribute,
FrameSpan otherSpan,
Attribute otherAttribute)
This composes two Attributes across a set of frames using the composeValues method. |
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. |
Attribute |
crop(FrameSpan newSpan,
FrameSpan oldSpan)
Get a copy with only the specified framespan filled in. |
java.lang.String |
getCompositionType()
Gets the composition type associated with this descriptor. |
java.util.Map |
getExtraConfig()
Gets the extra config information. |
AttributeValue |
getStaticValue()
Gets the value of this static attribute |
java.lang.String |
getType()
Returns the Attribute type, eg lvalue or bbox . |
AttributeValue |
getValue(FrameSpan span,
int frame)
Gets the value at a specific frame. |
java.util.Iterator |
getValues(FrameSpan span)
Gets an iterator over all values at all frames/times, returning ValueSpan objects. |
java.lang.String |
getValueToString()
Gets the string representation of the value. |
org.w3c.dom.Element |
getXMLFormat(org.w3c.dom.Document root)
Returns an XML formatted version of this data. |
org.w3c.dom.Element |
getXMLFormat(org.w3c.dom.Document root,
FrameSpan descriptorSpan)
Gets the xml representation of this attribute. |
boolean |
isCompositionType(java.lang.String s)
This allows attributes to define their own composition types in addition to the default ones. |
static boolean |
isType(java.lang.String str)
Determines if the specified string is a possible Attribute data type. |
boolean |
isValidRule(java.lang.String rule)
Tell if a name is a valid rule or not |
protected org.w3c.dom.Element |
nullXML(org.w3c.dom.Document root)
|
protected org.w3c.dom.Element |
nullXML(org.w3c.dom.Document root,
FrameSpan span)
|
java.util.Map |
parseExtraConfig(java.lang.String value)
Reads in the extended information string. |
boolean |
passes(Filterable.Rule rule)
Since dyanmic attributes need to evaluate rules multiple times, they have their own evaluation that evaluates the rule on the value returned by getValue for each of the frames. |
boolean |
possibleValueOf(org.w3c.dom.Element E)
Tests to see if the given DOM element is data that is valid for this attribute. |
boolean |
possibleValueOf(java.lang.String S)
Determines if this Attribute can take the value specified. |
void |
setCompositionType(java.lang.String s)
Sets the composition type of the attribute. |
protected void |
setDefaultValue(org.w3c.dom.Element defaultValue)
|
protected void |
setDefaultValue(java.lang.String defaultValue)
Some attributes may have a default value. |
void |
setExtraConfig(java.util.Map list)
Sets the extra config information. |
void |
setFrameSpan(FrameSpan newSpan,
FrameSpan oldSpan)
Changes the framespan of the attribute. |
void |
setName(java.lang.String S)
Sets the Attribute name. |
static void |
setOutputWidth(int W)
Sets the width to crop to when printing out attribute overviews. |
void |
setStaticValue(AttributeValue v)
Sets the value of this static attribute. |
void |
setValue(org.w3c.dom.Element el,
FrameSpan span)
Sets the value of the attribute from the given DOM node. |
void |
setValue(org.w3c.dom.Element el,
FrameSpan span,
DescVector neighbors)
Sets the value of the attribute from the given DOM node. |
void |
setValue(java.lang.String s)
Sets the attribute to the given string value. |
void |
setValue(java.lang.String s,
ErrorWriter err,
FrameSpan span)
Sets the Attribute to the value indicated by the String over a given FrameSpan. |
void |
setValue(java.lang.String s,
ErrorWriter err,
FrameSpan span,
DescVector neighbors)
Sets the value of this attribute, using the given string. |
java.lang.String |
toString()
Gets the string representation of static Attribute data or an individual frame of static data. |
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 |
Field Detail |
protected java.lang.Object value
protected boolean errors
protected boolean composition
protected java.lang.String compositionType
protected double compositionTolerance
Constructor Detail |
public Attribute()
public Attribute(boolean dynamic)
dynamic
- Descriptor that holds this Attribute is of type OBJECTpublic Attribute(Attribute old)
old
- the attribute to copyMethod Detail |
public void setName(java.lang.String S)
AbstractAttribute
setName
in class AbstractAttribute
S
- The new name.public static void setOutputWidth(int W)
W
- the number of characters to allow
for attribute summariespublic final void setCompositionType(java.lang.String s) throws ImproperMetricException
s
- the composition type to use - e.g. "none"
ImproperMetricException
public final java.lang.String getCompositionType()
public boolean isCompositionType(java.lang.String s)
s
- the name of composition type to test
public java.lang.String getType()
AbstractAttribute
lvalue
or bbox
.
getType
in class AbstractAttribute
public static final boolean isType(java.lang.String str)
str
- The string to be tested.
public final int compareTo(java.lang.Object o)
o
- the object to compare with this Attribute
java.lang.ClassCastException
public java.lang.Object clone()
clone
in class AbstractAttribute
public static Attribute compose(FrameSpan thisSpan, Attribute thisAttribute, FrameSpan otherSpan, Attribute otherAttribute) throws UncomposableException
composeValues
method. Depending on how it is implemented,
this function might not be comutative.
thisSpan
- the span of attribute AthisAttribute
- the value of attribute AotherSpan
- the span of attribute BotherAttribute
- the value of attribute B
UncomposableException
public boolean possibleValueOf(java.lang.String S)
S
- the string to be tested
public boolean possibleValueOf(org.w3c.dom.Element E)
E
- the data DOM element to test
protected final org.w3c.dom.Element nullXML(org.w3c.dom.Document root)
protected final org.w3c.dom.Element nullXML(org.w3c.dom.Document root, FrameSpan span)
public org.w3c.dom.Element getXMLFormat(org.w3c.dom.Document root)
AbstractAttribute
getXMLFormat
in class AbstractAttribute
root
- where to print the data.
public org.w3c.dom.Element getXMLFormat(org.w3c.dom.Document root, FrameSpan descriptorSpan)
root
- the xml rootdescriptorSpan
- the descriptor's span
public java.lang.String toString()
public void setValue(java.lang.String s) throws BadDataException
another setValue
.
s
- the attribute value
BadDataException
public AttributeValue getValue(FrameSpan span, int frame)
span
- The attributes span. Ignored if this is a static attr.frame
- The frame number's data to return. Ignored for static data.
Will throw an AIOOBX if the frame isn't inside the span.
public java.util.Iterator getValues(FrameSpan span)
ValueSpan
objects.
span
- the attributes span
Iterator<ValueSpan>
public void setStaticValue(AttributeValue v) throws BadDataException
v
- the new value
BadDataException
- if this is a dynamic attribute, or
if the data isn't the right typepublic AttributeValue getStaticValue()
public void setFrameSpan(FrameSpan newSpan, FrameSpan oldSpan)
newSpan
- the new spanoldSpan
- the old span
java.lang.IndexOutOfBoundsException
- when oldSpan is of inappropriate lengthpublic Attribute crop(FrameSpan newSpan, FrameSpan oldSpan)
newSpan
- the new span to crop tooldSpan
- the old span
java.lang.IndexOutOfBoundsException
public void setValue(java.lang.String s, ErrorWriter err, FrameSpan span)
s
- the string containing the new value for the Attributeerr
- where to write errors and warningsspan
- the numbers of the beginning and end frame; needed for dynamic
attributespublic void setValue(java.lang.String s, ErrorWriter err, FrameSpan span, DescVector neighbors)
s
- the valueerr
- where to write any errors in the value's formatspan
- the spanneighbors
- the enclosing desc vectorsetValue(String, ErrorWriter, FrameSpan)
public void setValue(org.w3c.dom.Element el, FrameSpan span, DescVector neighbors) throws BadDataException
el
- the attribute dom node to parsespan
- the descriptor's frame spanneighbors
- the descriptor list
BadDataException
public void setValue(org.w3c.dom.Element el, FrameSpan span) throws BadDataException
el
- the attribute dom node to parsespan
- the descriptor's frame span
BadDataException
public boolean isValidRule(java.lang.String rule)
Filterable
isValidRule
in interface Filterable
rule
- the name of the rule
public Filterable.Rule convertRule(java.lang.String unparsedRule, java.util.List unparsedValues, ErrorWriter err) throws BadDataException
convertRule
in interface Filterable
unparsedRule
- the rule to convertunparsedValues
- the valueserr
- the error stream
BadDataException
- if there is an error in the rule or valuespublic final boolean passes(Filterable.Rule rule)
getValue
for each of the frames.
passes
in interface Filterable
rule
- the rule to test against
true
if at least one frame's attribute passes the
rule.public java.lang.String getValueToString()
public void setExtraConfig(java.util.Map list) throws MethodNotSupportedException, BadDataException
list
- the map
MethodNotSupportedException
- if the attribute
does not entail extended information
BadDataException
public java.util.Map getExtraConfig()
public java.util.Map parseExtraConfig(java.lang.String value) throws BadDataException
value
- the extedned information.
BadDataException
protected void setDefaultValue(java.lang.String defaultValue) throws BadDataException
AbstractAttribute
Attributes.isGoodValue(viper.descriptors.attributes.Attribute, java.lang.String)
.
setDefaultValue
in class AbstractAttribute
defaultValue
- What to set as the default.
BadDataException
- if Attributes.isGoodValue returns false
.protected void setDefaultValue(org.w3c.dom.Element defaultValue) throws BadDataException, MethodNotSupportedException
setDefaultValue
in class AbstractAttribute
BadDataException
MethodNotSupportedException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |