com.devexperts.qd
Interface DataRecord

All Superinterfaces:
RecordReader
All Known Implementing Classes:
DefaultRecord

public interface DataRecord
extends RecordReader

The DataRecord defines identity and content of generic data record.

The DataRecord contains a set of data fields in a form of a two indexed lists of Int-fields and Obj-fields respectively. For determination, whenever serial access to the data fields of a record is performed (iteration, visiting, serialization), all Int-fields go first in their list order, then all Obj-fields go in their list order.


Method Summary
 int getId()
          Returns identifier of this record.
 DataIntField getIntField(int index)
          Returns Int-field by its index within this record.
 int getIntFieldCount()
          Returns a number of Int-fields in this record.
 RecordMapping getMapping()
          Returns mapping for this data record or null if there is no mapping for this record.
 java.lang.String getName()
          Returns name of this record.
 DataObjField getObjField(int index)
          Returns Obj-field by its index within this record.
 int getObjFieldCount()
          Returns a number of Obj-fields in this record.
 DataScheme getScheme()
          Returns parent DataScheme of this field.
 boolean hasTime()
          Determines if this record contains time coordinate.
 void readFields(com.devexperts.io.BufferedInput in, RecordCursor cursor)
          Reads this record's field values in a binary from the specified buffered input.
 boolean update(RecordCursor from, RecordCursor to)
          Updates this record's field values in to cusor by values from cursor.
 void writeFields(com.devexperts.io.BufferedOutput out, RecordCursor cursor)
          Writes this record's field values in a binary form into a specified buffered output.
 
Methods inherited from interface com.devexperts.qd.ng.RecordReader
getIncomingRecord, getResultingRecord, readRecord
 

Method Detail

getScheme

DataScheme getScheme()
Returns parent DataScheme of this field.


getMapping

RecordMapping getMapping()
Returns mapping for this data record or null if there is no mapping for this record. The result of invoking getRecord() method on the resulting record mapping (when it is non null) is equal to this data record.


getId

int getId()
Returns identifier of this record. The identifier coincides with record index in its parent DataScheme. It is also used for identification of data record in serialized form.


getName

java.lang.String getName()
Returns name of this record. The name must be unique within whole DataScheme. It is recommended that full names of record's fields contain record name as a prefix like these: "FooRecord.Category", "FooRecord.Amount", etc.


hasTime

boolean hasTime()
Determines if this record contains time coordinate.


getIntFieldCount

int getIntFieldCount()
Returns a number of Int-fields in this record.


getIntField

DataIntField getIntField(int index)
Returns Int-field by its index within this record.

Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getIntFieldCount()).

getObjFieldCount

int getObjFieldCount()
Returns a number of Obj-fields in this record.


getObjField

DataObjField getObjField(int index)
Returns Obj-field by its index within this record.

Throws:
java.lang.IndexOutOfBoundsException - if the index if out of range (index < 0 || index >= getObjFieldCount()).

update

boolean update(RecordCursor from,
               RecordCursor to)
Updates this record's field values in to cusor by values from cursor. This method is used for implementation of ticker contract.

Returns:
true if any values were updated and listeners shall be notified on data change.

writeFields

void writeFields(com.devexperts.io.BufferedOutput out,
                 RecordCursor cursor)
                 throws java.io.IOException
Writes this record's field values in a binary form into a specified buffered output. The bytes written should be the same as if each field is individually written using DataIntField.writeInt(java.io.DataOutput, int) and DataObjField.writeObj(java.io.DataOutput, java.lang.Object).

Throws:
java.io.IOException

readFields

void readFields(com.devexperts.io.BufferedInput in,
                RecordCursor cursor)
                throws java.io.IOException
Reads this record's field values in a binary from the specified buffered input. The data read should be the same as if each field is individually read using DataIntField.readInt(java.io.DataInput) and DataObjField.readObj(java.io.DataInput).

Throws:
java.io.IOException