ThinkUI Data Generator 1.0.2 API

thinkui.datagen
Class AbstractAttributeValueGenerator

java.lang.Object
  extended bythinkui.datagen.AbstractAttributeValueGenerator
All Implemented Interfaces:
AttributeValueGenerator, java.lang.Cloneable
Direct Known Subclasses:
BigDecimalGenerator, BooleanGenerator, ByteGenerator, CharacterGenerator, DateGenerator, DoubleGenerator, DynamicDataGenerator, EmailAddressGenerator, EnumGenerator, FirstNameGenerator, FloatGenerator, IndexedValueDataGenerator, InheritValueGenerator, IntegerGenerator, LongGenerator, NullGenerator, ObjectIdGenerator, ShortGenerator, StringGenerator, TimeGenerator, TimestampGenerator, UserNameGenerator, YNCharacterGenerator

public abstract class AbstractAttributeValueGenerator
extends java.lang.Object
implements AttributeValueGenerator

Abstract implementation of the AttributeValueGenerator.


Field Summary
 
Fields inherited from interface thinkui.datagen.AttributeValueGenerator
ALL_MODES, BERNOULLI_MODE, BINOMIAL_MODE, CONSTANT_MODE, DEFAULT_MODE, EXPONENTIAL_MODE, MILLIS_PER_DAY, MILLIS_PER_HOUR, MILLIS_PER_MINUTE, MILLIS_PER_SECOND, NORMAL_MODE, POISON_MODE, SEQUENTIAL_MODE, UNIFORM_MODE
 
Constructor Summary
AbstractAttributeValueGenerator(Attribute attribute)
          AbstractAttributeValueGenerator constructor.
 
Method Summary
 AttributeValueGenerator copy()
          Makes a copy of the AttributeValueGenerator.
static AttributeValueGenerator createGenerator(AttributeValueGeneratorParam generatorParam)
          Helper method to create an AttributeValueGenerator for the given generatorParam.
abstract  java.lang.Object generateValue()
          Generate a value for the attribute.
 Attribute getAttribute()
           
 java.lang.Object getConstantValue()
           
 java.lang.Number getCount()
           
 int getCountAsInt()
          Return the count as an int or throw a runtime exception.
 DataObject getDataObject()
           
 java.util.Map getDataObjectMap()
           
 int getGeneratorMode()
           
 java.lang.Comparable getMaxValue()
           
 java.lang.Number getMeanIndex()
           
 double getMeanIndexAsDouble()
          Return the mean index as a double or throw a runtime exception.
 java.lang.Number getMeanLength()
           
 double getMeanLengthAsDouble()
          Return the mean length as a double or throw a runtime exception.
 java.lang.Comparable getMeanValue()
           
 double getMeanValueAsDouble()
          Return the mean value as a double or throw a runtime exception.
 AttributeType getMinMaxAttributeType()
          Return the attribute type for the min/max values.
 java.lang.Comparable getMinValue()
           
 DataObject getParameterData()
          Returns the data object containing the optional data required by the generator.
 DataObject getParentDataObject()
           
 java.lang.Number getProbability()
           
 double getProbabilityAsDouble()
          Return the probability as a double or throw a runtime exception.
 int getProbabilityNull()
           
 java.lang.Number getStdDevValue()
           
 double getStdDevValueAsDouble()
          Return the standard deviation value as a double or throw a runtime exception.
 java.lang.String getValueAttributeName()
          Returns the attribute name in the case where we are generating data objects.
 void initGenerator()
          Initialize the attribute generator with dynamic data (if any).
 boolean isDataDependent()
           
 boolean isMultiValued()
           
 boolean isParentDataDependent()
           
 void setAttribute(Attribute attribute)
          Sets the attribute for the generator.
 void setConstantValue(java.lang.Object constantValue)
          Sets the constant value for the generator.
 void setCount(java.lang.Number count)
          Sets the count for the BERNOULLI and BINOMIAL probability distribution.
 void setDataDependent(boolean dataDependent)
          Sets whether or not the generator is dependent on previously generated data.
 void setDataObject(DataObject dataObject)
          Sets the data object currently being generated.
 void setDataObjectMap(java.util.Map dataObjectMap)
          Sets the data object map to use for variable resolution.
 void setGeneratorMode(int generatorMode)
          Sets the generation mode for the generator.
 void setMaxValue(java.lang.Comparable maxValue)
          Sets the maximum value that can be generated.
 void setMeanIndex(java.lang.Number meanIndex)
          Sets the mean index for the various probability distributions.
 void setMeanLength(java.lang.Number meanLength)
          Sets the mean length for the various probability distributions.
 void setMeanValue(java.lang.Comparable meanValue)
          Sets the mean value for the various probability distributions.
 void setMinValue(java.lang.Comparable minValue)
          Sets the minimum value that can be generated.
 void setMultiValued(boolean multiValued)
          Sets whether or not we are generating data objects or single attribute values.
 void setParentDataDependent(boolean parentDataDependent)
          Sets whether or not the generator is dependent on previously generated parent data.
 void setParentDataObject(DataObject parentDataObject)
          Sets the parent data object currently being generated.
 void setProbability(java.lang.Number probability)
          Sets the probability value for the BERNOULLI and BINOMIAL probability distribution.
 void setProbabilityNull(int probabilityNull)
          Sets the probability that the generated value is null.
 void setStdDevValue(java.lang.Number stdDevValue)
          Sets the standard deviation value for the various probability distributions.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAttributeValueGenerator

public AbstractAttributeValueGenerator(Attribute attribute)
AbstractAttributeValueGenerator constructor.

Method Detail

copy

public AttributeValueGenerator copy()
Makes a copy of the AttributeValueGenerator.

Specified by:
copy in interface AttributeValueGenerator

createGenerator

public static final AttributeValueGenerator createGenerator(AttributeValueGeneratorParam generatorParam)
                                                     throws java.lang.Exception
Helper method to create an AttributeValueGenerator for the given generatorParam.

Throws:
java.lang.Exception

generateValue

public abstract java.lang.Object generateValue()
                                        throws java.lang.Exception
Generate a value for the attribute.

Specified by:
generateValue in interface AttributeValueGenerator
Throws:
java.lang.Exception

getAttribute

public final Attribute getAttribute()
Specified by:
getAttribute in interface AttributeValueGenerator
Returns:
the attribute for the generator.

getConstantValue

public java.lang.Object getConstantValue()
Specified by:
getConstantValue in interface AttributeValueGenerator
Returns:
the constant value for the generator or null.

getCount

public final java.lang.Number getCount()
Specified by:
getCount in interface AttributeValueGenerator
Returns:
the count for the BERNOULLI and BINOMIAL probability distribution or null.

getCountAsInt

public final int getCountAsInt()
Return the count as an int or throw a runtime exception.

Returns:
the probability as an int.

getDataObject

public final DataObject getDataObject()
Specified by:
getDataObject in interface AttributeValueGenerator
Returns:
the data object currently being generated or null.

getDataObjectMap

public final java.util.Map getDataObjectMap()
Specified by:
getDataObjectMap in interface AttributeValueGenerator
Returns:
the data object map to use for variable resolution.

getGeneratorMode

public int getGeneratorMode()
Specified by:
getGeneratorMode in interface AttributeValueGenerator
Returns:
the generation mode for the generator.

getMaxValue

public final java.lang.Comparable getMaxValue()
Specified by:
getMaxValue in interface AttributeValueGenerator
Returns:
the maximum value that can be generated.

getMeanIndex

public java.lang.Number getMeanIndex()
Specified by:
getMeanIndex in interface AttributeValueGenerator
Returns:
the mean index for the various probability distributions or null.

getMeanIndexAsDouble

public final double getMeanIndexAsDouble()
Return the mean index as a double or throw a runtime exception.

Returns:
the mean index as a double.

getMeanLength

public java.lang.Number getMeanLength()
Specified by:
getMeanLength in interface AttributeValueGenerator
Returns:
the mean length for the various probability distributions or null.

getMeanLengthAsDouble

public final double getMeanLengthAsDouble()
Return the mean length as a double or throw a runtime exception.

Returns:
the mean length as a double.

getMeanValue

public final java.lang.Comparable getMeanValue()
Specified by:
getMeanValue in interface AttributeValueGenerator
Returns:
the mean value for the various probability distributions or null.

getMeanValueAsDouble

public final double getMeanValueAsDouble()
Return the mean value as a double or throw a runtime exception.

Returns:
the mean value as a double.

getMinMaxAttributeType

public AttributeType getMinMaxAttributeType()
Return the attribute type for the min/max values. The default implementation simply returns the attribute type of the configured attribute (if any). Derived generator can override this method in the case where the min/max/std dev values will not be the same as the attribute type.

Specified by:
getMinMaxAttributeType in interface AttributeValueGenerator

getMinValue

public final java.lang.Comparable getMinValue()
Specified by:
getMinValue in interface AttributeValueGenerator
Returns:
the minimum value that can be generated.

getParameterData

public DataObject getParameterData()
Returns the data object containing the optional data required by the generator. The default implementation simply returns null. Derived classes (i.e. custom generators) should override this method as required.

Specified by:
getParameterData in interface AttributeValueGenerator
Returns:
the custom generator data or null.

getParentDataObject

public final DataObject getParentDataObject()
Specified by:
getParentDataObject in interface AttributeValueGenerator
Returns:
the parent data object currently being generated or null.

getProbability

public final java.lang.Number getProbability()
Specified by:
getProbability in interface AttributeValueGenerator
Returns:
the probability for the BERNOULLI and BINOMIAL probability distribution or null.

getProbabilityAsDouble

public final double getProbabilityAsDouble()
Return the probability as a double or throw a runtime exception.

Returns:
the probability as a double.

getProbabilityNull

public int getProbabilityNull()
Specified by:
getProbabilityNull in interface AttributeValueGenerator
Returns:
the probability that the generated value is null.

getStdDevValue

public java.lang.Number getStdDevValue()
Specified by:
getStdDevValue in interface AttributeValueGenerator
Returns:
the standard deviation value for the various probability distributions or null.

getStdDevValueAsDouble

public final double getStdDevValueAsDouble()
Return the standard deviation value as a double or throw a runtime exception.

Returns:
the standard deviation value as a double.

getValueAttributeName

public java.lang.String getValueAttributeName()
Returns the attribute name in the case where we are generating data objects. The current method simply returns null. Derived classes must override this method if isMultiValued() can return true.

Specified by:
getValueAttributeName in interface AttributeValueGenerator
Returns:
the attribute name containing the value or null.

initGenerator

public void initGenerator()
                   throws java.lang.Exception
Initialize the attribute generator with dynamic data (if any). The current implementation simply does nothing.

Derived classes should override this method to perform dynamic data initialization (e.g. when the generator is data dependent).

Specified by:
initGenerator in interface AttributeValueGenerator
Throws:
java.lang.Exception

isDataDependent

public final boolean isDataDependent()
Specified by:
isDataDependent in interface AttributeValueGenerator
Returns:
whether or not the generator is dependent on previously generated data.

isMultiValued

public final boolean isMultiValued()
Specified by:
isMultiValued in interface AttributeValueGenerator
Returns:
whether or not we are generating data objects or single attribute values.

isParentDataDependent

public final boolean isParentDataDependent()
Specified by:
isParentDataDependent in interface AttributeValueGenerator
Returns:
whether or not the generator is dependent on previously generated parent data.

setAttribute

public final void setAttribute(Attribute attribute)
Sets the attribute for the generator.

Specified by:
setAttribute in interface AttributeValueGenerator

setConstantValue

public void setConstantValue(java.lang.Object constantValue)
Sets the constant value for the generator.

Specified by:
setConstantValue in interface AttributeValueGenerator

setCount

public final void setCount(java.lang.Number count)
Sets the count for the BERNOULLI and BINOMIAL probability distribution.

Specified by:
setCount in interface AttributeValueGenerator

setDataDependent

public final void setDataDependent(boolean dataDependent)
Sets whether or not the generator is dependent on previously generated data.

Specified by:
setDataDependent in interface AttributeValueGenerator

setDataObject

public final void setDataObject(DataObject dataObject)
Sets the data object currently being generated.

Specified by:
setDataObject in interface AttributeValueGenerator

setDataObjectMap

public final void setDataObjectMap(java.util.Map dataObjectMap)
Sets the data object map to use for variable resolution.

Specified by:
setDataObjectMap in interface AttributeValueGenerator

setGeneratorMode

public void setGeneratorMode(int generatorMode)
Sets the generation mode for the generator.

Specified by:
setGeneratorMode in interface AttributeValueGenerator

setMaxValue

public final void setMaxValue(java.lang.Comparable maxValue)
Sets the maximum value that can be generated.

Specified by:
setMaxValue in interface AttributeValueGenerator

setMeanIndex

public void setMeanIndex(java.lang.Number meanIndex)
Sets the mean index for the various probability distributions.

Specified by:
setMeanIndex in interface AttributeValueGenerator

setMeanLength

public void setMeanLength(java.lang.Number meanLength)
Sets the mean length for the various probability distributions.

Specified by:
setMeanLength in interface AttributeValueGenerator

setMeanValue

public final void setMeanValue(java.lang.Comparable meanValue)
Sets the mean value for the various probability distributions.

Specified by:
setMeanValue in interface AttributeValueGenerator

setMinValue

public final void setMinValue(java.lang.Comparable minValue)
Sets the minimum value that can be generated.

Specified by:
setMinValue in interface AttributeValueGenerator

setMultiValued

public final void setMultiValued(boolean multiValued)
Sets whether or not we are generating data objects or single attribute values.

Specified by:
setMultiValued in interface AttributeValueGenerator

setParentDataDependent

public final void setParentDataDependent(boolean parentDataDependent)
Sets whether or not the generator is dependent on previously generated parent data.

Specified by:
setParentDataDependent in interface AttributeValueGenerator

setParentDataObject

public final void setParentDataObject(DataObject parentDataObject)
Sets the parent data object currently being generated.

Specified by:
setParentDataObject in interface AttributeValueGenerator

setProbability

public final void setProbability(java.lang.Number probability)
Sets the probability value for the BERNOULLI and BINOMIAL probability distribution.

Specified by:
setProbability in interface AttributeValueGenerator

setProbabilityNull

public void setProbabilityNull(int probabilityNull)
Sets the probability that the generated value is null.

Specified by:
setProbabilityNull in interface AttributeValueGenerator

setStdDevValue

public void setStdDevValue(java.lang.Number stdDevValue)
Sets the standard deviation value for the various probability distributions.

Specified by:
setStdDevValue in interface AttributeValueGenerator

ThinkUI Data Generator 1.0.2 API

Copyright © 2007-2009. ThinkUI Software Inc. All rights reserved.