its.backbone.domain
Class SensorData

java.lang.Object
  extended byits.backbone.domain.SensorData
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
TmsData

public abstract class SensorData
extends java.lang.Object
implements java.io.Serializable

Base class for data types

See Also:
Serialized Form

Field Summary
protected  DataBlock dataBlock
          datablock
protected static int MASK_EIGHT_BIT
           
protected static int MASK_FIVE_BIT
           
protected static int MASK_FOUR_BIT
           
protected static int MASK_ONE_BIT
          Bitmasks used in extracting data
protected static int MASK_SEVEN_BIT
           
protected static int MASK_SIX_BIT
           
protected static int MASK_THREE_BIT
           
protected static int MASK_TWO_BIT
           
protected  byte[] rawData
          data
 
Constructor Summary
SensorData(DataBlock dataBlock, int packedsize)
          constructor
 
Method Summary
protected abstract  void checkOffsetBounds(int offset)
          checks offset against the header size and the data block size, called by read.
 int getPackedSize()
           
abstract  boolean isValid()
           
abstract  java.lang.String[] processSensor(int offset, java.lang.String sensor_id)
          processes an instance of a sensor
protected abstract  void read(int offset)
          Method to read object from raw TMS data block.
protected  byte[] setRawData(int offset)
          initializes rawData: allocates and copies from data block
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rawData

protected byte[] rawData
data


dataBlock

protected DataBlock dataBlock
datablock


MASK_ONE_BIT

protected static final int MASK_ONE_BIT
Bitmasks used in extracting data

See Also:
Constant Field Values

MASK_TWO_BIT

protected static final int MASK_TWO_BIT
See Also:
Constant Field Values

MASK_THREE_BIT

protected static final int MASK_THREE_BIT
See Also:
Constant Field Values

MASK_FOUR_BIT

protected static final int MASK_FOUR_BIT
See Also:
Constant Field Values

MASK_FIVE_BIT

protected static final int MASK_FIVE_BIT
See Also:
Constant Field Values

MASK_SIX_BIT

protected static final int MASK_SIX_BIT
See Also:
Constant Field Values

MASK_SEVEN_BIT

protected static final int MASK_SEVEN_BIT
See Also:
Constant Field Values

MASK_EIGHT_BIT

protected static final int MASK_EIGHT_BIT
See Also:
Constant Field Values
Constructor Detail

SensorData

public SensorData(DataBlock dataBlock,
                  int packedsize)
           throws java.lang.IllegalArgumentException
constructor

Method Detail

getPackedSize

public int getPackedSize()

processSensor

public abstract java.lang.String[] processSensor(int offset,
                                                 java.lang.String sensor_id)
                                          throws java.lang.IllegalArgumentException,
                                                 BadOffsetException
processes an instance of a sensor

Returns:
an array with the corresponding sensor values
Throws:
java.lang.IllegalArgumentException
BadOffsetException

isValid

public abstract boolean isValid()

read

protected abstract void read(int offset)
                      throws BadOffsetException
Method to read object from raw TMS data block. The number of bytes to read is inherent in the sensor type (loop or station are 3 bytes, speed trap is 6 bytes).

Parameters:
offset - the offset at which to start reading
Throws:
BadOffsetException - if the offset < TmsData.HEADER_LENGTH or >= the length of the data block

checkOffsetBounds

protected abstract void checkOffsetBounds(int offset)
                                   throws BadOffsetException
checks offset against the header size and the data block size, called by read.

Throws:
BadOffsetException - if offset < HEADER_SIZE or offset >= (data block size - size of sensor).

setRawData

protected byte[] setRawData(int offset)
initializes rawData: allocates and copies from data block