system
Class DataTypeIdentifier

java.lang.Object
  extended by system.DataTypeIdentifier

public abstract class DataTypeIdentifier
extends java.lang.Object

Allows for the data type of the data arraylist to be discovered. Also allows for the validation of various user inputs.


Field Summary
static java.lang.String[] CLASS_NAMES
           
private static java.lang.String regExpressionBooleanFalse
           
private static java.lang.String regExpressionBooleanTrue
           
private static java.lang.String regExpressionCurrency
           
private static java.lang.String regExpressionDouble
           
private static java.lang.String regExpressionNo
           
private static java.lang.String regExpressionNumber
           
private static java.lang.String regExpressionYes
           
 
Constructor Summary
DataTypeIdentifier()
           
 
Method Summary
private static java.util.ArrayList<java.lang.Object> checkContent(java.util.ArrayList<java.lang.String> singleRecord)
          Checks the content of the single record and assigns the datatype for each column.
private static void checkLoop(java.util.ArrayList<java.lang.Object> temp, java.util.List<java.lang.Object> dataClass)
          Checks the array of datatypes against the established data type array.
static java.util.ArrayList<java.lang.Object> getDataType(java.util.List<java.util.List<java.lang.Object>> dataList)
          Gets the data type of the data in the arraylist.
private static java.util.ArrayList<java.lang.String> getSingleRecord(java.util.List<java.util.List<java.lang.Object>> dataList, int position)
          Gets the singles record in the arraylist of records ata certain position.
static boolean testDataType(java.util.ArrayList<java.lang.Object> dataTypeClasses, java.lang.String value, int position)
          Checks a single value to see if it matches against the data type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAMES

public static final java.lang.String[] CLASS_NAMES

regExpressionBooleanTrue

private static final java.lang.String regExpressionBooleanTrue
See Also:
Constant Field Values

regExpressionBooleanFalse

private static final java.lang.String regExpressionBooleanFalse
See Also:
Constant Field Values

regExpressionYes

private static final java.lang.String regExpressionYes
See Also:
Constant Field Values

regExpressionNo

private static final java.lang.String regExpressionNo
See Also:
Constant Field Values

regExpressionNumber

private static final java.lang.String regExpressionNumber
See Also:
Constant Field Values

regExpressionDouble

private static final java.lang.String regExpressionDouble
See Also:
Constant Field Values

regExpressionCurrency

private static final java.lang.String regExpressionCurrency
See Also:
Constant Field Values
Constructor Detail

DataTypeIdentifier

public DataTypeIdentifier()
Method Detail

getSingleRecord

private static java.util.ArrayList<java.lang.String> getSingleRecord(java.util.List<java.util.List<java.lang.Object>> dataList,
                                                                     int position)
Gets the singles record in the arraylist of records ata certain position.

Parameters:
dataList - the list of records.
position - the position in which the record is to be gotten from.
Returns:
the single record.

checkContent

private static java.util.ArrayList<java.lang.Object> checkContent(java.util.ArrayList<java.lang.String> singleRecord)
Checks the content of the single record and assigns the datatype for each column.

Parameters:
singleRecord - the single record to be checked.
Returns:
the array of data type objects assigned to the single record.

checkLoop

private static void checkLoop(java.util.ArrayList<java.lang.Object> temp,
                              java.util.List<java.lang.Object> dataClass)
Checks the array of datatypes against the established data type array.

Parameters:
temp - the temp data type array to be checked.
dataClass - the established data array.

testDataType

public static boolean testDataType(java.util.ArrayList<java.lang.Object> dataTypeClasses,
                                   java.lang.String value,
                                   int position)
Checks a single value to see if it matches against the data type.

Parameters:
dataTypeClasses - the list of data types supplied.
value - the value to be checked.
position - the position of the value in the array list.
Returns:
whether the value was the correct value.

getDataType

public static java.util.ArrayList<java.lang.Object> getDataType(java.util.List<java.util.List<java.lang.Object>> dataList)
Gets the data type of the data in the arraylist.

Parameters:
dataList - the data to be identfied.
Returns:
the arraylist of data classes.