- java.lang.Object
-
- com.pervasive.datarush.tokens.record.SparseRecordRegister
-
- All Implemented Interfaces:
DataRegister
,RecordSettable
,RecordValued
,TokenSettable
,TokenValued
,RecordTyped
,TokenTyped
public class SparseRecordRegister extends Object implements DataRegister, RecordValued, RecordSettable
A composite register of scalar registers; a mutableRecordValued
object. ARecordRegister
can also be thought of as an updateable row of tabular data.
-
-
Constructor Summary
Constructors Constructor Description SparseRecordRegister(RecordTokenType type)
Constructs a new register with the given record type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsNull()
Determines if any field in the record is null valued.ScalarRegister
getField(int index)
Get the field at the given index within the list of fields.ScalarRegister
getField(String fieldName)
Gets the value of the field with the given name.ScalarRegister[]
getFields()
Gets the values of all fields in the recordRecordTokenType
getType()
Gets the data type of the token.boolean
isNull()
Indicates whether the token is null valued.ScalarValuedIterator
newFieldIterator(FieldIteratorProperties properties)
Create a new iterator for visiting the fields in this RecordValued object.ScalarValuedIterator
newFieldIterator(ScalarTokenType type)
Create a new iterator for visiting the fields in this RecordValued object.ScalarValuedIterator
newFieldIterator(ScalarTokenType type, String[] selectedFieldNames)
Create a new iterator for visiting the fields in this RecordValued object.void
set(TokenValued value)
Sets the contained value to the given token value.void
setNull()
Sets the contained value to be null valued.void
setZero()
Sets the contained value to be zero valued.int
size()
Gets the number of fields in the record schema.String
toString()
-
-
-
Constructor Detail
-
SparseRecordRegister
public SparseRecordRegister(RecordTokenType type)
Constructs a new register with the given record type. The resulting field registers are all null-valued initially.- Parameters:
type
- the record schema of the register
-
-
Method Detail
-
getType
public final RecordTokenType getType()
Description copied from interface:TokenValued
Gets the data type of the token. This type will dictate the valid values that can be contained.- Specified by:
getType
in interfaceRecordSettable
- Specified by:
getType
in interfaceRecordTyped
- Specified by:
getType
in interfaceRecordValued
- Specified by:
getType
in interfaceTokenTyped
- Specified by:
getType
in interfaceTokenValued
- Returns:
- the token type.
-
size
public final int size()
Description copied from interface:RecordValued
Gets the number of fields in the record schema.- Specified by:
size
in interfaceRecordSettable
- Specified by:
size
in interfaceRecordValued
- Returns:
- the number of fields
-
isNull
public final boolean isNull()
Description copied from interface:TokenValued
Indicates whether the token is null valued. Tokens support null values analogous to SQL. Before accessing the value of the container, it is usually best to ensure it is not null valued using this method.- Specified by:
isNull
in interfaceTokenValued
- Returns:
true
if the token is null valued,false
otherwise
-
containsNull
public final boolean containsNull()
Description copied from interface:RecordValued
Determines if any field in the record is null valued.- Specified by:
containsNull
in interfaceRecordValued
- Returns:
true
if at least one field is null valued,false
if none are
-
set
public void set(TokenValued value)
Description copied from interface:TokenSettable
Sets the contained value to the given token value. The given value must have a type compatible with this object.- Specified by:
set
in interfaceTokenSettable
- Parameters:
value
- the value to which to set the container
-
setNull
public void setNull()
Description copied from interface:TokenSettable
Sets the contained value to be null valued.- Specified by:
setNull
in interfaceTokenSettable
-
setZero
public void setZero()
Description copied from interface:TokenSettable
Sets the contained value to be zero valued.- Specified by:
setZero
in interfaceTokenSettable
-
getField
public final ScalarRegister getField(int index)
Description copied from interface:RecordValued
Get the field at the given index within the list of fields.- Specified by:
getField
in interfaceRecordSettable
- Specified by:
getField
in interfaceRecordValued
- Parameters:
index
- zero-based index into the field list- Returns:
- the field's value
-
getField
public final ScalarRegister getField(String fieldName)
Description copied from interface:RecordValued
Gets the value of the field with the given name.- Specified by:
getField
in interfaceRecordSettable
- Specified by:
getField
in interfaceRecordValued
- Parameters:
fieldName
- the field name- Returns:
- the field's value
-
getFields
public final ScalarRegister[] getFields()
Description copied from interface:RecordValued
Gets the values of all fields in the record- Specified by:
getFields
in interfaceRecordSettable
- Specified by:
getFields
in interfaceRecordValued
- Returns:
- an array containing the values of the record's fields
-
newFieldIterator
public ScalarValuedIterator newFieldIterator(ScalarTokenType type)
Description copied from interface:RecordValued
Create a new iterator for visiting the fields in this RecordValued object. Visitation order will be sorted by the field's index.- Specified by:
newFieldIterator
in interfaceRecordValued
- Parameters:
type
- the type of fields over which to iterate- Returns:
- an iterator over fields of the specified type
-
newFieldIterator
public ScalarValuedIterator newFieldIterator(ScalarTokenType type, String[] selectedFieldNames)
Description copied from interface:RecordValued
Create a new iterator for visiting the fields in this RecordValued object. Visitation order will be sorted by the field's index.- Specified by:
newFieldIterator
in interfaceRecordValued
- Parameters:
type
- the type of fields over which to iterateselectedFieldNames
- the fields over which to iterate- Returns:
- an iterator over the specified fields
-
newFieldIterator
public ScalarValuedIterator newFieldIterator(FieldIteratorProperties properties)
Description copied from interface:RecordValued
Create a new iterator for visiting the fields in this RecordValued object. Visitation order will optionally be sorted by the field's index, depending on the value ofFieldIteratorProperties.isSorted()
.- Specified by:
newFieldIterator
in interfaceRecordValued
- Parameters:
properties
- properties for the iterator- Returns:
- an iterator over the fields
-
-