uk.org.ogsadai.client.dbcreate2
Class TravelDataCreator

java.lang.Object
  |
  +--uk.org.ogsadai.client.dbcreate2.TravelDataCreator

public class TravelDataCreator
extends java.lang.Object

This class generates the data used in the test databases.

Author:
The OGSA-DAI Project Team

Constructor Summary
TravelDataCreator()
           
 
Method Summary
 java.lang.String generateAddress(int i)
          Returns a address corresponding to the specified index in the test data.
 byte[] generateBytes(int i, int length)
          Returns a randomly generated byte array corresponding to the specified index in the test data.
 java.lang.String generateCountry(int i)
          Picks a country from the list corresponding to the specified index in the test data.
 java.lang.String generateDepartureDate(long i)
          Generates a departure date in the years 2000 to 2010.
 java.lang.String generateDepartureTime(long i)
          Generates a departure time corresponding to the specified index within the test data.
 java.lang.String generateDescription(int i)
          Generates a text description corresponding to the specified index
 int generateDestination(long i, int maxValue)
          Generates an integer n where 1 <= n <= maxValue, corresponding to the specified index in the test data.
 java.lang.String generateDestinationName(int i)
          Picks the name of a destination from a list corresponding to the specified index in the test data
 java.lang.String generateDOB(int i)
          Generates a date of birth corresponding to the specified index in the test data.
 java.lang.String generateName(int i)
          Returns a name corresponding to the specified index in the test data.
 java.lang.String generatePhone(int i)
          Returns a randomly generated phone number.
 double generatePrice(long i)
          Generates a price with corresponding to the specified index in the test data
 java.lang.String generateTimestamp(long i)
          Generates a time stamp corresponding to the specified index in the test data
 int generateTraveller(long i, int maxValue)
          Generates an integer n where 1 <= n <= maxValue, depending on the specified index in the test data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TravelDataCreator

public TravelDataCreator()
Method Detail

generatePhone

public java.lang.String generatePhone(int i)
Returns a randomly generated phone number.

Returns:
a String containing the phone number.

generateName

public java.lang.String generateName(int i)
Returns a name corresponding to the specified index in the test data.

Parameters:
i - index within test data
Returns:
a String containing a name.

generateAddress

public java.lang.String generateAddress(int i)
Returns a address corresponding to the specified index in the test data.

Parameters:
i - index within test data
Returns:
a String containing the address.

generateDOB

public java.lang.String generateDOB(int i)
Generates a date of birth corresponding to the specified index in the test data.

Parameters:
i - index within test data
Returns:
String a date in the format YYYY-MM-DD

generateTraveller

public int generateTraveller(long i,
                             int maxValue)
Generates an integer n where 1 <= n <= maxValue, depending on the specified index in the test data.

Parameters:
maxValue - the upper bound
i - index within test data
Returns:
an integer

generateDestination

public int generateDestination(long i,
                               int maxValue)
Generates an integer n where 1 <= n <= maxValue, corresponding to the specified index in the test data.

Parameters:
i - index within test data
maxValue - the upper bound
Returns:
a random integer

generateDestinationName

public java.lang.String generateDestinationName(int i)
Picks the name of a destination from a list corresponding to the specified index in the test data

Parameters:
i - index within test data
Returns:
String

generateCountry

public java.lang.String generateCountry(int i)
Picks a country from the list corresponding to the specified index in the test data.

Parameters:
i - index within test data
Returns:
a String containing a country name

generateDescription

public java.lang.String generateDescription(int i)
Generates a text description corresponding to the specified index

Parameters:
i - index within test data
Returns:
String

generateBytes

public byte[] generateBytes(int i,
                            int length)
Returns a randomly generated byte array corresponding to the specified index in the test data.

Parameters:
i - index within test data
length - the length of the byte array
Returns:
byte array with random entries

generateDepartureDate

public java.lang.String generateDepartureDate(long i)
Generates a departure date in the years 2000 to 2010.

Parameters:
i - index within test data
Returns:
date String in the format YYYY-MM-DD

generateDepartureTime

public java.lang.String generateDepartureTime(long i)
Generates a departure time corresponding to the specified index within the test data.

Parameters:
i - index within test data
Returns:
String time of the day in format HH:MM:SS

generateTimestamp

public java.lang.String generateTimestamp(long i)
Generates a time stamp corresponding to the specified index in the test data

Parameters:
i - index within test data
Returns:
String a time stamp in the format YYYY-MM-DD HH:MM:SS

generatePrice

public double generatePrice(long i)
Generates a price with corresponding to the specified index in the test data

Parameters:
i - index within test data
Returns:
double