uk.ac.leeds.ccg.andyt.projects.moses.io
Class CASKS013DataHandler
java.lang.Object
uk.ac.leeds.ccg.andyt.projects.moses.utilities.AbstractLog
uk.ac.leeds.ccg.andyt.projects.moses.io.AbstractDataHandler
uk.ac.leeds.ccg.andyt.projects.moses.io.AbstractCASDataHandler
uk.ac.leeds.ccg.andyt.projects.moses.io.CASKS013DataHandler
- All Implemented Interfaces:
- java.io.Serializable
public class CASKS013DataHandler
- extends AbstractCASDataHandler
A class
for handling an individual
CASKS013DataRecord
and collections of
CASKS013DataRecords
.
- See Also:
AbstractCASDataRecord
,
Serialized Form
Constructor Summary |
CASKS013DataHandler()
Creates a new instance of CASKS013DataHandler for handling
CASKS013DataRecords stored in a formatted File The default
File is hard coded. |
CASKS013DataHandler(java.io.File formattedFile)
Creates a new instance of CASKS013DataHandler with Records loaded from
formattedFile. |
Method Summary |
void |
aggregateOAToMSOA(java.io.RandomAccessFile aRandomAccessFile,
long startRecordID,
long endRecordID)
Aggregates CASKS013DataRecords from OA To MSOA for the OA
records in the range [startRecordID,endRecordID] and writes the results
to aRandomAccessFile |
void |
aggregateOAToWard(java.io.RandomAccessFile aRandomAccessFile,
long startRecordID,
long endRecordID)
Aggregates CASKS013DataRecords from OA To Ward for the OA
records in the range [startRecordID,endRecordID] and writes the results
to aRandomAccessFile |
protected long |
format(java.io.File sourceFile,
long RecordID,
java.lang.String country)
Uses a BufferedReader and a StreamTokenizer to
read lines from the sourceFile File . |
protected void |
formatSourceData(java.io.File directory,
int n)
Loads CAS001DataRecords and prints out n randomly |
CASKS013DataRecord |
getCASKS013DataRecord(long RecordID)
|
AbstractCASDataRecord |
getDataRecord(long RecordID)
|
static void |
main(java.lang.String[] args)
|
Methods inherited from class uk.ac.leeds.ccg.andyt.projects.moses.io.AbstractCASDataHandler |
get_LookUpMSOAfromOAHashMap, getCAS001DataHandler, getCAS003DataHandler, getDataRecord, getDataRecord, getLADCodes_TreeSet, getMSOACodes_HashSet, getMSOACodes_HashSet, getOACodes_HashSet, getOACodes_HashSet, getOACodes_TreeSet, getRecordIDZoneCode_HashMap, getRecordIDZoneCodeHashMap, getZoneCodeRecordID_HashMap, parseLine, printOAMSOACodes, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CASKS013DataHandler
public CASKS013DataHandler()
throws java.io.IOException
- Creates a new instance of
CASKS013DataHandler
for handling
CASKS013DataRecords stored in a formatted File
The default
File
is hard coded. To specify the File
use
CASKS013DataHandler(File)
. To set a different default
File
edit the source code and recompile.
- Throws:
java.io.IOException
CASKS013DataHandler
public CASKS013DataHandler(java.io.File formattedFile)
throws java.io.IOException
- Creates a new instance of CASKS013DataHandler with Records loaded from
formattedFile.
- Parameters:
formattedFile
- Formatted file of CASKS013DataRecords
- Throws:
java.io.IOException
main
public static void main(java.lang.String[] args)
throws java.io.IOException
- Parameters:
args
- the command line arguments No arguments are used.
- Throws:
java.io.IOException
formatSourceData
protected void formatSourceData(java.io.File directory,
int n)
throws java.io.IOException
- Loads
CAS001DataRecords
and prints out n randomly
- Parameters:
directory
- to load source data fromn
- the number of loaded data records to print out.
- Throws:
java.io.IOException
format
protected long format(java.io.File sourceFile,
long RecordID,
java.lang.String country)
throws java.io.IOException
- Uses a
BufferedReader and a StreamTokenizer
to
read lines from the sourceFile File
. The lines are converted
to CASKS013DataRecords
and written to
this.tRandomAccessFile
.
- Parameters:
sourceFile
- The source CASKS013DataRecords file to be formatted and
written to this.tRandomAccessFile
.RecordID
- The RecordID
to assign to the first
CASKS013DataRecord
.country
- Identifies type of table
- country.equalsIgnoreCase("Northern Ireland") treated as
Northern Ireland CASKS013DataRecord
- country.equalsIgnoreCase("Scotland") treated as Scotland
CASKS013DataRecord
- country.equalsIgnoreCase("England") treated as England
CASKS013DataRecord
- country.equalsIgnoreCase("Wales") treated as Wales
CASKS013DataRecord
- Returns:
- The
RecordID
assigned to the last
CASKS013DataRecords
.
- Throws:
java.io.IOException
getDataRecord
public AbstractCASDataRecord getDataRecord(long RecordID)
- Specified by:
getDataRecord
in class AbstractCASDataHandler
- Parameters:
RecordID
- The RecordID of the CASKS013DataRecord to be returned.
- Returns:
- a
CASKS013DataRecord
with
AbstractCASDataRecord.RecordID = RecordID
getCASKS013DataRecord
public CASKS013DataRecord getCASKS013DataRecord(long RecordID)
- Parameters:
RecordID
- The RecordID of the CASKS013DataRecord to be returned.
- Returns:
- a
CASKS013DataRecord
with
CASKS013DataRecord.RecordID = RecordID
aggregateOAToWard
public void aggregateOAToWard(java.io.RandomAccessFile aRandomAccessFile,
long startRecordID,
long endRecordID)
throws java.io.IOException
- Aggregates
CASKS013DataRecords
from OA To Ward for the OA
records in the range [startRecordID,endRecordID] and writes the results
to aRandomAccessFile
- Parameters:
aRandomAccessFile
- RandomAccessFile
to which results are writtenstartRecordID
- The first OA RecordID in the sequence to be aggregated.endRecordID
- The last OA RecordID in the sequence to be aggregated.
- Throws:
java.io.IOException
aggregateOAToMSOA
public void aggregateOAToMSOA(java.io.RandomAccessFile aRandomAccessFile,
long startRecordID,
long endRecordID)
throws java.io.IOException
- Aggregates
CASKS013DataRecords
from OA To MSOA for the OA
records in the range [startRecordID,endRecordID] and writes the results
to aRandomAccessFile
- Parameters:
aRandomAccessFile
- RandomAccessFile
to which results are writtenstartRecordID
- The first OA RecordID in the sequence to be aggregated.endRecordID
- The last OA RecordID in the sequence to be aggregated.
- Throws:
java.io.IOException