com.its.core.util
Class RandomText

java.lang.Object
  |
  +--com.its.core.util.RandomText

public class RandomText
extends java.lang.Object

This class extends the Random number generator. An instance of this class is used to generate fields and rows filed with randomly generated text.


Field Summary
static int IDXMAX
           
static int IDXMIN
           
static java.lang.String KsCharacterSetExtensive
           
static java.lang.String KsCharacterSetSimple
           
 
Constructor Summary
RandomText()
          Default constructor.
RandomText(long pnSeed)
          Constructor allowing initialization with a specified seed.
 
Method Summary
static int CalculateMaxRowSize(int[][] pnaaFields, java.lang.String psFieldSeparator)
          Calculates the maximum row size
static int CalculateMinRowSize(int[][] pnaaFields, java.lang.String psFieldSeparator)
          Calclates the minimum row size.
 java.lang.String getCharacterSet()
          Returns a character set.
 int[][] getFields()
          Returns field sizes.
 java.lang.String getFieldSeparator()
          Returns a field separator.
 int getMaxRowSize()
          Returns a maximum row size.
 int getMinRowSize()
          Return a minimum row size.
 long[] getUniqueCounts()
          Returns the array of maximum unique numbers for all unique fields.
 int[] getUniqueFields()
          Return unique fields specification.
 char nextChar()
          Generates a random character.
 java.lang.String[] nextFields()
          Generates a set of fields.
 int nextInt(int pnMax)
          Generates a random integer.
 int nextInt(int pnMax, int pnMin)
          Generates a random integer.
 java.lang.String nextRow()
          Generates a row.
 void setCharacterSet(java.lang.String psValue)
          Sets a character set.
 void setFields(int[] pnaSizes)
          Sets fixed length field specifications.
 void setFields(int[][] pnaaSizes)
          Sets field specifications.
 void setFieldSeparator(java.lang.String psFieldSeparator)
          Sets a field separator.
 void setUniqueFields(int[] pnaUniqueFields)
          Set unique fields.
 void specifyUniqueFields(int[] pnaValues)
          Specifies unique fields.
 void specifyUniqueFields(java.lang.Integer[] pnaValues)
          Specifies unique fields.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KsCharacterSetSimple

public static final java.lang.String KsCharacterSetSimple

KsCharacterSetExtensive

public static final java.lang.String KsCharacterSetExtensive

IDXMAX

public static final int IDXMAX

IDXMIN

public static final int IDXMIN
Constructor Detail

RandomText

public RandomText()
Default constructor. Intitializes a random number generator with a random seed.

RandomText

public RandomText(long pnSeed)
Constructor allowing initialization with a specified seed.
Parameters:
pnSeed - The seed for random number generator.
Method Detail

nextChar

public char nextChar()
Generates a random character.
Returns:
The next random character.

nextInt

public int nextInt(int pnMax)
Generates a random integer.
Parameters:
pnMax - The maximum a generaed number can reach.
Returns:
The next integer number.

nextInt

public int nextInt(int pnMax,
                   int pnMin)
Generates a random integer.
Parameters:
pnMax - The maximum a generated number can reach.
pnMin - The minimum a generated number can reach.
Returns:
The next integer number.

nextFields

public java.lang.String[] nextFields()
                              throws java.lang.Exception
Generates a set of fields.
Returns:
The next array of fields.
Throws:
java.lang.Exception -  

nextRow

public java.lang.String nextRow()
                         throws java.lang.Exception
Generates a row.
Returns:
The next row.
Throws:
java.lang.Exception -  

specifyUniqueFields

public void specifyUniqueFields(java.lang.Integer[] pnaValues)
Specifies unique fields.
Parameters:
pnaValues - Array of field numbers to be unique.

specifyUniqueFields

public void specifyUniqueFields(int[] pnaValues)
Specifies unique fields.
Parameters:
pnaValues - Array of field numbers to be unique.

getCharacterSet

public java.lang.String getCharacterSet()
Returns a character set.
Returns:
The current character set.

setCharacterSet

public void setCharacterSet(java.lang.String psValue)
Sets a character set.
Parameters:
psValue - The character set to set.

getFieldSeparator

public java.lang.String getFieldSeparator()
Returns a field separator.
Returns:
The current field separator.

setFieldSeparator

public void setFieldSeparator(java.lang.String psFieldSeparator)
Sets a field separator.
Parameters:
psFieldSeparator - The separator to set.

getFields

public int[][] getFields()
Returns field sizes.
Returns:
The field size array.

setFields

public void setFields(int[] pnaSizes)
Sets fixed length field specifications.
Parameters:
pnaSizes - The field sizes array to set.

setFields

public void setFields(int[][] pnaaSizes)
Sets field specifications.
Parameters:
pnaaSizes - The field sizes array to set.

getMaxRowSize

public int getMaxRowSize()
Returns a maximum row size.
Returns:
Returns the current maximum row size.

CalculateMaxRowSize

public static int CalculateMaxRowSize(int[][] pnaaFields,
                                      java.lang.String psFieldSeparator)
Calculates the maximum row size
Parameters:
pnaaFields - The field sizes array.
psFieldSeparator - The field separator.
Returns:
The calculated maximum row size.

CalculateMinRowSize

public static int CalculateMinRowSize(int[][] pnaaFields,
                                      java.lang.String psFieldSeparator)
Calclates the minimum row size.
Parameters:
pnaaFields - The field sizes array.
psFieldSeparator - The field separator.
Returns:
The calculated minimum row size.

getMinRowSize

public int getMinRowSize()
Return a minimum row size.
Returns:
The current minimum row size.

getUniqueFields

public int[] getUniqueFields()
Return unique fields specification.
Returns:
The array of unique field indexes.

setUniqueFields

public void setUniqueFields(int[] pnaUniqueFields)
Set unique fields.
Parameters:
pnaUniqueFields - The array of field indexes to be unique.

getUniqueCounts

public long[] getUniqueCounts()
Returns the array of maximum unique numbers for all unique fields.
Returns:
The UniqueCounts array.