hhreco.recognition
Class Type

java.lang.Object
  extended byhhreco.recognition.Type

public class Type
extends java.lang.Object

A unique identifier for the type of a piece of data that results from a recognition. For example, different drawings of squares have different parameters (size, etc.) but they all have the same type.

See Also:
TypedData, SimpleData

Field Summary
static Type NO_TYPE
          A Type object that has no ID.
 
Constructor Summary
Type(java.lang.Class c, java.lang.String id)
          Create a Type of the specified class and string ID.
 
Method Summary
static void addNativeType(java.lang.String nativeType)
          Record the specified type so that objects of this type can be automatically generated on the fly.
 TypedData createTypedData()
          Create a TypedData object by instantiating an object based on the Class specified in this Type object.
 boolean equals(java.lang.Object o)
          Check the equivalence of this object and the specified object.
 java.lang.String getID()
          Return the string ID.
 Type getParent()
          Return the parent of this type.
 int hashCode()
          Return the hashCode of this object.
static boolean isNativeType(java.lang.String type)
          Check if the specified type is in the record.
static Type makeType(java.lang.String typeName)
          Instantiate a Type object based on the specified type name.
 java.lang.String toString()
          Text representation of this Type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_TYPE

public static final Type NO_TYPE
A Type object that has no ID.

Constructor Detail

Type

public Type(java.lang.Class c,
            java.lang.String id)
Create a Type of the specified class and string ID.

Method Detail

addNativeType

public static void addNativeType(java.lang.String nativeType)
Record the specified type so that objects of this type can be automatically generated on the fly.


isNativeType

public static boolean isNativeType(java.lang.String type)
Check if the specified type is in the record.


createTypedData

public TypedData createTypedData()
Create a TypedData object by instantiating an object based on the Class specified in this Type object. Return null if the instantiated object is not an instance of TypedData.


getID

public java.lang.String getID()
Return the string ID.


makeType

public static Type makeType(java.lang.String typeName)
Instantiate a Type object based on the specified type name. If no native types match this type name, return a Type of SimpleData.


equals

public boolean equals(java.lang.Object o)
Check the equivalence of this object and the specified object.


hashCode

public int hashCode()
Return the hashCode of this object. If the class is a SimpleData, use the string ID hash code, otherwise use the hash code of the class.


getParent

public Type getParent()
Return the parent of this type. If this is a NO_TYPE or SimpleData Type, return NO_TYPE. Otherwise, get the super class of this class.


toString

public java.lang.String toString()
Text representation of this Type.