diva.sketch.recognition
Class SimpleData

java.lang.Object
  extended by diva.util.xml.AbstractXmlBuilder
      extended by diva.sketch.recognition.SimpleData
All Implemented Interfaces:
TypedData, XmlBuilder

public final class SimpleData
extends AbstractXmlBuilder
implements TypedData

An instance of typed data that represents dynamic, user-defined types. If you are writing a low-level recognizer and that recognizes strokes based on a feature vector and knows nothing about the semantics of the recognition, other than a string representation of the type, then this is the class for you (e.g. new SimpleData("scribble")). However, if you have semantic knowledge of the data that is being represented, e.g. the number of sides on the polygon that you just recognized, then you should probably be a statically-typed form of TypedData (e.g. PolygonData).

Version:
$Revision: 1.8 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)
See Also:
Type, TypedData

Constructor Summary
SimpleData()
          Used in the builder interface--do not call this constructor from code!
SimpleData(String typeId)
          Construct a simple data with the given dynamic identifier.
 
Method Summary
 Object build(XmlElement in, String type)
          Build a SimpleData from the given XmlElement
 boolean equals(Object o)
          Equality test: are the types equal?
 XmlElement generate(Object in)
          Generate an XML element from this instance
 Type getType()
          Construct a simple data with the given dynamic identifier.
 String getTypeID()
          Return the dynamic type identifier of this data item.
 String toString()
          Print the dynamic type of this data in brackets as short hand to denote that it is a dynamic type.
 
Methods inherited from class diva.util.xml.AbstractXmlBuilder
getDelegate, setDelegate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface diva.util.xml.XmlBuilder
setDelegate
 

Constructor Detail

SimpleData

public SimpleData()
Used in the builder interface--do not call this constructor from code!


SimpleData

public SimpleData(String typeId)
Construct a simple data with the given dynamic identifier. Throw an illegal argument exception if the given identifier is already registered as static in the type system.

See Also:
Type.isStaticType(String)
Method Detail

getType

public Type getType()
Construct a simple data with the given dynamic identifier.

Specified by:
getType in interface TypedData

getTypeID

public String getTypeID()
Return the dynamic type identifier of this data item.


equals

public boolean equals(Object o)
Equality test: are the types equal?

Overrides:
equals in class Object

toString

public String toString()
Print the dynamic type of this data in brackets as short hand to denote that it is a dynamic type.

Overrides:
toString in class Object

generate

public XmlElement generate(Object in)
Generate an XML element from this instance

Specified by:
generate in interface XmlBuilder
Overrides:
generate in class AbstractXmlBuilder

build

public Object build(XmlElement in,
                    String type)
Build a SimpleData from the given XmlElement

Specified by:
build in interface XmlBuilder
Specified by:
build in class AbstractXmlBuilder


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.