org.licas.data.gen

## Class StringDataGenerator

- java.lang.Object
- - org.licas.data.gen.DataGenerator
  - - org.licas.data.gen.StringDataGenerator

-     public class StringDataGenerator
      extends DataGenerator

  This class can generate random data for testing purposes. A new instance of this class is only able to return random strings.

  The generator is seeded with a random number generator seed and a minimum and maximum allowed value. The string that is used to generate each random value also needs to be passed in as a parameter. A random value is then a sub-section of the string, but to be consistent over all generators, it should be seeded with the same value. This information can be passed through methods or through the initialisation XML script. A random value between min and max is then generated for each new value instance.

  Author:
    Kieran Greer

- - ### Field Summary

    - ### Fields inherited from class org.licas.data.gen.DataGenerator

      `adminXml, dataType, maxValue, minValue, rnd, seed`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StringDataGenerator(org.licas_xml.abs.Element adminXml)` Create a new instance of StringDataGenerator.
    `StringDataGenerator(long thisSeed, java.lang.String thisDataType)` Create a new instance of StringDataGenerator.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static boolean` | `dataTypeOK(java.lang.String theDataType)` Return true if the data type is allowed by the data generator.
    `java.lang.Object` | `getNextValue()` Generate the next data value.
    `void` | `parseGenXml(org.licas_xml.abs.Element genXml)` Parse the data generator script to set the appropriate variable values.
    `void` | `setRange(java.lang.String thisRange)` Set the range value for data generation.

    - ### Methods inherited from class org.licas.data.gen.DataGenerator

      `conditionsToXml, conditionsToXml, conditionsToXml, generateStringRange, getBaseElement, getDataType, getGeneratorClass, isAllowedDataType, setMaxValue, setMinValue`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StringDataGenerator

          public StringDataGenerator(long thisSeed,
                                     java.lang.String thisDataType)
                              throws java.lang.Exception

      Create a new instance of StringDataGenerator.
      Parameters:
        `thisDataType` - the generator data type.
        `thisSeed` - to seed a random number generator.
      Throws:
        `java.lang.Exception` - any error.

    - #### StringDataGenerator

          public StringDataGenerator(org.licas_xml.abs.Element adminXml)
                              throws java.lang.Exception

      Create a new instance of StringDataGenerator.
      Parameters:
        `adminXml` - a script including the value ranges for the data. This would now be a full admin script, with an `Const`.`PARAMETERS` section for these values.
      Throws:
        `java.lang.Exception` - any error.

  - ### Method Detail

    - #### parseGenXml

          public void parseGenXml(org.licas_xml.abs.Element genXml)

      Parse the data generator script to set the appropriate variable values.
      Specified by:
        `parseGenXml` in class `DataGenerator`
      Parameters:
        `genXml` - the script to parse

    - #### setRange

          public void setRange(java.lang.String thisRange)

      Set the range value for data generation.
      Parameters:
        `thisRange` - the value. A random string are generated from this.

    - #### getNextValue

          public java.lang.Object getNextValue()

      Generate the next data value.
      Specified by:
        `getNextValue` in class `DataGenerator`
      Returns:
        the next randomly generated data value.

    - #### dataTypeOK

          protected static boolean dataTypeOK(java.lang.String theDataType)

      Return true if the data type is allowed by the data generator. Only the String type is allowed for this generator.
      Parameters:
        `theDataType` - the data type to check for.
      Returns:
        true if this data generator can generate value of that type.