de.lmu.ifi.dbs.elki.data.type
Class SimpleTypeInformation<T>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.data.type.SimpleTypeInformation<T>
Type Parameters:
T - Java type we represent.
All Implemented Interfaces:
TypeInformation
Direct Known Subclasses:
VectorTypeInformation

public class SimpleTypeInformation<T>
extends Object
implements TypeInformation

Class wrapping a particular data type.


Field Summary
private  Class<? super T> cls
          The restriction class we represent.
private  String label
          Type label
 
Constructor Summary
SimpleTypeInformation(Class<? super T> cls)
          Constructor.
SimpleTypeInformation(Class<? super T> cls, String label)
          Constructor.
 
Method Summary
 T cast(Object other)
          Cast the object to type T (actually to the given restriction class!)
 String getLabel()
          Get the type label
 Class<? super T> getRestrictionClass()
          Get the raw restriction class.
 boolean isAssignableFrom(Object other)
          Test whether this type is assignable from a given object instance.
 boolean isAssignableFromType(TypeInformation type)
          Test whether this type is assignable from another type.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cls

private Class<? super T> cls
The restriction class we represent.


label

private String label
Type label

Constructor Detail

SimpleTypeInformation

public SimpleTypeInformation(Class<? super T> cls)
Constructor.

Parameters:
cls - restriction class

SimpleTypeInformation

public SimpleTypeInformation(Class<? super T> cls,
                             String label)
Constructor.

Parameters:
cls - restriction class
label - type label
Method Detail

getRestrictionClass

public final Class<? super T> getRestrictionClass()
Get the raw restriction class.

Returns:
Restriction class

isAssignableFromType

public boolean isAssignableFromType(TypeInformation type)
Description copied from interface: TypeInformation
Test whether this type is assignable from another type.

Specified by:
isAssignableFromType in interface TypeInformation
Parameters:
type - Other type
Returns:
true when the other type is accepted as subtype.

isAssignableFrom

public boolean isAssignableFrom(Object other)
Description copied from interface: TypeInformation
Test whether this type is assignable from a given object instance.

Specified by:
isAssignableFrom in interface TypeInformation
Parameters:
other - Other object
Returns:
true when the other type is an acceptable instance.

cast

public T cast(Object other)
Cast the object to type T (actually to the given restriction class!)

Parameters:
other - Object to cast.
Returns:
Instance

toString

public String toString()
Overrides:
toString in class Object

getLabel

public String getLabel()
Get the type label

Returns:
Label

Release 0.4.0 (2011-09-20_1324)