uk.ac.leeds.ccg.andyt.projects.moses.io
Class AbstractDataHandler

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.projects.moses.utilities.AbstractLog
      extended by uk.ac.leeds.ccg.andyt.projects.moses.io.AbstractDataHandler
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AbstractCASDataHandler, HSARDataHandler, ISARDataHandler

public abstract class AbstractDataHandler
extends AbstractLog
implements java.io.Serializable

Abstract class for handling AbstractDataRecords

See Also:
Serialized Form

Field Summary
protected  java.io.File _Directory
          The workspace directory.
protected  java.io.File _File
          Formatted File for AbstractDataRecords.
protected  java.io.RandomAccessFile _RandomAccessFile
          RandomAccessFile of _File for AbstractDataRecords
protected  long _RecordLength
          For storing the length of an AbstractDataRecord that this Handler handles in measured in byte units and stored as a long.
 
Fields inherited from class uk.ac.leeds.ccg.andyt.projects.moses.utilities.AbstractLog
_Logger, _Logger_FileHandler
 
Constructor Summary
AbstractDataHandler()
           
 
Method Summary
 java.io.File get_Directory()
           
 long get_RecordLength()
          Returns a copy of _RecordLength.
abstract  AbstractDataRecord getDataRecord(long RecordID)
           
 long getNDataRecords()
           
 void init(java.io.File _Directory)
           
 void init(java.util.logging.Level aLevel, java.io.File _Directory)
           
protected  void load(java.io.File _File)
          Set: this._File = _File this.tRandomAccessFile = new RandomAccessFile(_File,"r" )
protected  void print(int n, java.util.Random random)
          Prints a random set of n AbstractDataRecords via System.out.println()
 
Methods inherited from class uk.ac.leeds.ccg.andyt.projects.moses.utilities.AbstractLog
init_Logger, init_Logger, init_Logger, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_RecordLength

protected long _RecordLength
For storing the length of an AbstractDataRecord that this Handler handles in measured in byte units and stored as a long.


_File

protected java.io.File _File
Formatted File for AbstractDataRecords.


_Directory

protected java.io.File _Directory
The workspace directory.


_RandomAccessFile

protected transient java.io.RandomAccessFile _RandomAccessFile
RandomAccessFile of _File for AbstractDataRecords

Constructor Detail

AbstractDataHandler

public AbstractDataHandler()
Method Detail

get_RecordLength

public long get_RecordLength()
Returns a copy of _RecordLength.


get_Directory

public java.io.File get_Directory()

init

public void init(java.util.logging.Level aLevel,
                 java.io.File _Directory)

init

public void init(java.io.File _Directory)

load

protected void load(java.io.File _File)
Set: this._File = _File this.tRandomAccessFile = new RandomAccessFile(_File,"r" )

Parameters:
_File - Formatted File containing AbstractDataRecords.

getNDataRecords

public long getNDataRecords()
Returns:
The number of AbstractDataRecords in this.tRandomAccessFile

getDataRecord

public abstract AbstractDataRecord getDataRecord(long RecordID)
Parameters:
RecordID - The RecordID of the AbstractDataRecord to be returned.
Returns:
An AbstractDataRecord for the given RecordID

print

protected void print(int n,
                     java.util.Random random)
              throws java.io.IOException
Prints a random set of n AbstractDataRecords via System.out.println()

Parameters:
n - the number of AbstractDataRecords to print out
random - the Random used for selecting AbstractDataRecords to print
Throws:
java.io.IOException