Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RecordImpl

A Record V2 record schema entry

Hierarchy

  • RecordImpl

Implements

Index

Constructors

constructor

  • new RecordImpl(name: string, min: number, max: number, index: number, fields: FieldImpl[]): RecordImpl
  • Create a new record

    Parameters

    • name: string

      the name of the record

    • min: number

      the minimum index that this record can assume

    • max: number

      the maximum index that this record can assume

    • index: number

      the index of the record

    • fields: FieldImpl[]

      an array of fields contained in this record

    Returns RecordImpl

Properties

fields

fields: FieldImpl[]

The fields in an array

Private fieldsMap

fieldsMap: object

The fields indexed by their name

Type declaration

index

index: number

The index of the record

isVariable

isVariable: boolean

Flag that indicates if the record can have variable index.

This is true if min is different from max.

max

max: number

The maximum number of occurrences of the node within its parent

min

min: number

The minimum number of occurrences of the node within its parent

name

name: string

The name of the record

Methods

createModel

  • createModel(): string[]
  • Create a model representation of this record schema.

    Returns string[]

    an array of model string representations for each field in the record

getAbsoluteIndex

  • getAbsoluteIndex(index: number): number
  • Calculate the absolute index of the record

    throws

    an error if the index offset is out of range

    Parameters

    • index: number

      the index offset

    Returns number

    the absolute index

getField

  • Get a field by its name

    throws

    an error if no field with that name exists

    Parameters

    • fieldName: string

      the name of the field to get

    Returns FieldImpl

    the field with the given name

getFields

  • Get a copy of the internal fields array

    Returns FieldImpl[]

    an array of fields

lastField

  • Get the last field in the array

    Returns FieldImpl

    the field with the last index in the fields array

toString

  • toString(): string
  • Convert the record schema to a string

    Returns string

    a string representation of the field