comirva.audio.feature
Class Attribute

java.lang.Object
  extended by comirva.audio.feature.Attribute
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AudioFeature

public abstract class Attribute
extends Object
implements Serializable

Attribute

Description:

An Attribute is an abstract concept strongly related to another object, which one can attributed with an Attribute object. One can think about the attributed object to be some kind of a container, which represents a real world object, that one can describe closer simply by putting Attribute objects in the container. In latter the attributed object is simply called container.

For example one could think of a container House being closer described by an attribute Color, whose state could be red for example. Another attribute could be Cat, telling us that there lives a cat in the house.

The obvious advantage is that there is no need to change the container's class structure, if one has to add a new attribute, but simply can subclass Attribute. This is extremely useful, if possible attributes of a container are unknown at the current development stage.

In combination with an AttributeExtractor an Attribute object gets a further semantics. An Attribute describes a container, and the description can be obtained automatically by an extraction process. The type of information needed to obtain an attribute depends on the attribute extraction process and therefore can vary from attribute to attribute. So if one has a large number of containers, a batch job for extracting attributes is a good idea. This takes us to the concept of a AttributeExtractionThread.
Last but not least Attributes may implement the XMLSerializable interface, such that it is easy for a container to make attributes persistent.

See Also:
AttributeExtractor, XMLSerializable, AudioFeatureExtractionThread, Serialized Form

Constructor Summary
protected Attribute()
          Constructor of an attribute.
 
Method Summary
 String getClassName()
          Returns the full qualified class name of an attribute.
 int getType()
          Returns an unique integer value for each subclass of attribute.
static Attribute readAttribute(XMLStreamReader parser)
          Supports reading Attribute objects from a xml input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Attribute

protected Attribute()
Constructor of an attribute.

Method Detail

getType

public final int getType()
Returns an unique integer value for each subclass of attribute. This can be used to distinguish different subclasses. By definition this is the hash code of the attribute's class name.

Returns:
int typevalue

getClassName

public final String getClassName()
Returns the full qualified class name of an attribute.

Returns:
String the full qualified class name

readAttribute

public static Attribute readAttribute(XMLStreamReader parser)
                               throws IOException,
                                      XMLStreamException
Supports reading Attribute objects from a xml input stream.

Parameters:
parser - XMLStreamReader the xml input stream
Returns:
Attribute the attribute read from the stream
Throws:
IOException - raised, if there are any io troubles
XMLStreamException - raised, if there are any parsing errors