lt.monarch.chart.models
Class DataModelValidator

java.lang.Object
  extended by lt.monarch.chart.models.AbstractModelValidator
      extended by lt.monarch.chart.models.DataModelValidator
All Implemented Interfaces:
java.io.Serializable

public class DataModelValidator
extends AbstractModelValidator

Data model validator, which validates if the data supplied is correct and consistent

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  DataModel model
          Data model to validate
 
Fields inherited from class lt.monarch.chart.models.AbstractModelValidator
keyType, sortDirection, sortEnabled, validate
 
Constructor Summary
Constructor and Description
DataModelValidator(DataModel dataModel)
          Data model validator default constructor
 
Method Summary
Modifier and Type Method and Description
 void dispose()
          Disposes object
protected  void finalize()
           
 java.lang.String getValidationMessage()
           
 boolean isSorted(DataColumnType keyType, SortDirection direction)
          Checks if the data is sorted according to the axis mapper
 boolean isStackConsistent()
          Checks if the stacked data models are consistent
 boolean isValidateTypes()
          Is validating data types of the column
 void setValidateTypes(boolean validateTypes)
          Sets to validate data types of the column
 void sort(DataColumnType keyType, SortDirection direction)
          Sorts the data model according to the axis
 void validate(DataColumnType keyType)
          Validates data model and sorts the data if required.
 boolean validateTypes(DataColumnType type)
          Validates if data types for the same column are of the same type.
 
Methods inherited from class lt.monarch.chart.models.AbstractModelValidator
getKeyType, getSortDirection, isSortEnabled, isValidationEnabled, setKeyType, setSortDirection, setSortEnabled, setValidationEnabled
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

protected final DataModel model
Data model to validate

Constructor Detail

DataModelValidator

public DataModelValidator(DataModel dataModel)
Data model validator default constructor

Parameters:
dataModel - data model to validate
Method Detail

sort

public void sort(DataColumnType keyType,
                 SortDirection direction)
Sorts the data model according to the axis

Parameters:
keyType - key data value type, which is mapped to the axisMapper
direction - data sort direction

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

validate

public void validate(DataColumnType keyType)
Description copied from class: AbstractModelValidator
Validates data model and sorts the data if required. If key type for the validator is not set, the one passed here through parameter will be used.

Specified by:
validate in class AbstractModelValidator
Parameters:
keyType - key value type

isSorted

public boolean isSorted(DataColumnType keyType,
                        SortDirection direction)
Description copied from class: AbstractModelValidator
Checks if the data is sorted according to the axis mapper

Specified by:
isSorted in class AbstractModelValidator
Parameters:
keyType - key type to check
direction - specifies which way data should be sorted
Returns:
true if sorted

isStackConsistent

public boolean isStackConsistent()
Description copied from class: AbstractModelValidator
Checks if the stacked data models are consistent

Specified by:
isStackConsistent in class AbstractModelValidator
Returns:
true if stack is consistent

getValidationMessage

public java.lang.String getValidationMessage()

dispose

public void dispose()
Disposes object


validateTypes

public boolean validateTypes(DataColumnType type)
Validates if data types for the same column are of the same type.

Parameters:
type - column number
Returns:
true if types a valid (the same)
Throws:
java.lang.IllegalArgumentException - if validation do not pass

isValidateTypes

public boolean isValidateTypes()
Is validating data types of the column

Returns:
true if validating

setValidateTypes

public void setValidateTypes(boolean validateTypes)
Sets to validate data types of the column

Parameters:
validateTypes - true if to validate data types