|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.client.dbcreate2.TravelDataCreator
This class generates the data used in the test databases.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
|
private static java.lang.String[] |
COUNTRIES
|
private static java.lang.String[] |
DESTINATION_NAME
|
private static java.lang.String[] |
FIRST_NAMES
|
private static java.lang.String[] |
LAST_NAMES
|
private static byte[] |
mRandomBytes
Holds a random byte array of size SIZE |
private static java.lang.String[] |
PLACES
|
private static java.lang.String[] |
ROADS
|
private static int |
SEED
Seed value for random number generator - do not modify. |
private static int |
SIZE
|
private static java.lang.String[] |
TOWNS
|
Constructor Summary | |
TravelDataCreator()
|
Method Summary | |
private java.lang.String |
chooseDate(long i,
int minYear,
int maxYear)
Returns a date string between minYear and maxYear, corresponding to the specified index in the test data |
private static java.lang.String |
chooseFromArray(java.lang.String[] stringArray,
int i)
Picks a value from a String array depending on value of i |
private static int |
chooseFromByteArray(long i)
Picks a value from the random byte array depending on the value of i |
private int[] |
chooseNumbers(long i,
int length)
Returns an array of integers between 0 and 9, corresponding to the specified index in the test data. |
private java.lang.String |
chooseTime(long i)
Returns a time of the day corresponding to the specified index in the test data |
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 phone number corresponding to the specified index in the test data |
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 |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private static final int SEED
private static byte[] mRandomBytes
private static final int SIZE
private static final java.lang.String[] FIRST_NAMES
private static final java.lang.String[] LAST_NAMES
private static final java.lang.String[] TOWNS
private static final java.lang.String[] ROADS
private static final java.lang.String[] DESTINATION_NAME
private static final java.lang.String[] PLACES
private static final java.lang.String[] COUNTRIES
Constructor Detail |
public TravelDataCreator()
Method Detail |
public java.lang.String generatePhone(int i)
i
- index within test data
String
containing the phone number.public java.lang.String generateName(int i)
i
- index within test data
String
containing a name.public java.lang.String generateAddress(int i)
i
- index within test data
String
containing the address.public java.lang.String generateDOB(int i)
i
- index within test data
public int generateTraveller(long i, int maxValue)
maxValue
- the upper boundi
- index within test data
public int generateDestination(long i, int maxValue)
i
- index within test datamaxValue
- the upper bound
public java.lang.String generateDestinationName(int i)
i
- index within test data
public java.lang.String generateCountry(int i)
i
- index within test data
String
containing a country namepublic java.lang.String generateDescription(int i)
i
- index within test data
public byte[] generateBytes(int i, int length)
i
- index within test datalength
- the length of the byte array
public java.lang.String generateDepartureDate(long i)
i
- index within test data
public java.lang.String generateDepartureTime(long i)
i
- index within test data
public java.lang.String generateTimestamp(long i)
i
- index within test data
public double generatePrice(long i)
i
- index within test data
private static java.lang.String chooseFromArray(java.lang.String[] stringArray, int i)
stringArray
- i
- index within test data
private static int chooseFromByteArray(long i)
i
- index within test data
private int[] chooseNumbers(long i, int length)
i
- index within test datalength
- the length of the returned array
length
private java.lang.String chooseDate(long i, int minYear, int maxYear)
i
- index within test dataminYear
- maxYear
-
private java.lang.String chooseTime(long i)
i
- index within test data
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |