org.debellor.core
Class DataType

java.lang.Object
  extended by org.debellor.core.DataType
Direct Known Subclasses:
DataVector.DataVectorType, NumericFeature.NumericFeatureType, Sample.SampleType, SymbolicFeature.SymbolicFeatureType

public class DataType
extends java.lang.Object

Subclasses of DataType describe common properties of all DataObjects generated by a given data Cell.Stream. For example, may contain information about number and types of features of a DataVector. Contain also information necessary for correct interpretation of data values, e.g. a dictionary of symbols that should be put in the place of numeric codes in SymbolicFeature.

Usually, every new subclass of DataObject has its corresponding DataType subclass which provides type information specific to this DataObject subclass. For example, common properties of DataVector objects are described by an instance of DataVector.DataVectorType class. Similarly to DataObject subclasses, also DataType subclasses can be nested. Usually, the nesting structure of DataType objects exactly mirrors the nesting structure of corresponding data objects.

Like DataObjects, DataType objects are also immutable, so they can be freely shared by cells without risk of accidental modification.


Field Summary
 java.lang.Class<? extends DataObject> dataClass
          If dataClass is not null, corresponding data objects in all samples of the data set will be instances of the dataClass class or will be missing (null references).
static DataType NOT_PRESENT
          Marks that a given part of data does not exist and the corresponding field will always have null value, in all samples of the data stream.
static DataType UNKNOWN
          Marks that type of a given part of data is unknown and consumer should expect everything.
 
Constructor Summary
DataType(java.lang.Class<? extends DataObject> dataClass)
           
 
Method Summary
 DataVector.DataVectorType asDataVectorType()
          Returns this DataType casted to DataVector.DataVectorType.
 SymbolicFeature.SymbolicFeatureType asSymbolicFeatureType()
          Returns this DataType casted to SymbolicFeature.SymbolicFeatureType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final DataType UNKNOWN
Marks that type of a given part of data is unknown and consumer should expect everything.


NOT_PRESENT

public static final DataType NOT_PRESENT
Marks that a given part of data does not exist and the corresponding field will always have null value, in all samples of the data stream. Consumer of the data should treat this part of data as non-existent, not only as all-nulls. For example, if Sample.SampleType.decision is NOT_PRESENT it means that there is no decision attribute, which is something different than null decisions (null might be treated as an unknown value of a decision).


dataClass

public final java.lang.Class<? extends DataObject> dataClass
If dataClass is not null, corresponding data objects in all samples of the data set will be instances of the dataClass class or will be missing (null references).

Otherwise, class of corresponding data objects is unknown. Note that null dataClass does not mean that all corresponding data objects will be missing!

Constructor Detail

DataType

public DataType(java.lang.Class<? extends DataObject> dataClass)
Method Detail

asDataVectorType

public DataVector.DataVectorType asDataVectorType()
                                           throws DataCastException
Returns this DataType casted to DataVector.DataVectorType.

Throws:
DataCastException

asSymbolicFeatureType

public final SymbolicFeature.SymbolicFeatureType asSymbolicFeatureType()
                                                                throws DataCastException
Returns this DataType casted to SymbolicFeature.SymbolicFeatureType.

Throws:
DataCastException