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.
 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.
 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 output byte array.
 
Methods inherited from interface com.devexperts.qd.ng.RecordReader
getResultingRecord, readRecord
 

Method Detail

getScheme

DataScheme getScheme()
Returns parent DataScheme of this field.


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 output byte array. 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, Object).

EXPERIMENTAL: This method is not actually used yet.

Throws:
java.io.IOException