Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MutableRecordModelImpl

Implementation of MutableRecordModel

Hierarchy

Implements

Index

Constructors

constructor

Properties

Private Readonly recordData

recordData: RecordData[]

The record data

Methods

add

  • add(recordName: string, recordIndexOrValue: number | string, ...values: string[]): MutableRecordModel
  • inheritdoc

    Parameters

    • recordName: string
    • recordIndexOrValue: number | string
    • Rest ...values: string[]

    Returns MutableRecordModel

addRecord

  • Adds a new initialized record occurrence to the end of a variable multiplicity record list.

    As the only variable multiplicity record can be the last one there is no need to name the record. This method will add to the list of occurrences of the last defined record. The record will be initialized with default values appropriate to the schema definition and may then have individual field items set separately.

    throws

    a SchemaViolationError if adding a record would violate the schema

    Returns MutableRecordModel

    this model

Private addValuesToRecord

  • Add values to the last field in a record. Values can only be added if the record is variable

    throws

    an error if the record is not variable

    Parameters

    • schemaRecord: RecordImpl

      the schema of the record

    • record: FieldData[]

      the record's model data

    • values: string[]

      the values to add

    Returns void

asValue

fieldCount

  • fieldCount(recordName: string, recordIndex: number, fieldName: string): number
  • inheritdoc

    Parameters

    • recordName: string
    • recordIndex: number
    • fieldName: string

    Returns number

get

  • get(recordName: string, recordIndexOrFieldName?: string | number, fieldNameOrFieldIndex?: string | number, fieldIndex?: number): string | null
  • inheritdoc

    Parameters

    • recordName: string
    • Default value recordIndexOrFieldName: string | number = 0
    • Optional fieldNameOrFieldIndex: string | number
    • Default value fieldIndex: number = 0

    Returns string | null

Protected getRecord

  • Get the model data for a record

    throws

    an IllegalArgumentError if the index is invalid

    Parameters

    • schemaRecord: RecordImpl

      the record for which to get the data

    • index: number

      the index of the record

    Returns RecordData

    model data of the record

model

Protected parseKey

  • Convert a textual representation of a record entry to a record key

    Parameters

    • key: string

      the key string

    Returns RecordKey

    the parsed record key

Protected parseKeyPart

  • parseKeyPart(keyPart: string): Array<string | number>
  • Parse the field name and index part of a record key

    throws

    an IllegalArgumentError if the key part is invalid

    Parameters

    • keyPart: string

      the part of the key containing the field name and index

    Returns Array<string | number>

    an array containing the field name and the field index

recordCount

  • recordCount(recordName: string): number
  • Returns the actual number of occurrences of a named record.

    If the record is not variable, this is the same as the defined number of occurrences in the schema

    Parameters

    • recordName: string

      the record name

    Returns number

    the actual number of occurrences of the record

removeField

  • removeField(recordName: string, recordIndex: number, fieldIndex: number): MutableRecordModel
  • Removes the specified occurrence of a variable multiplicity field.

    A variable multiplicity field must be the last or only field within a record and therefore the field name is not required.

    throws

    an IllegalArgumentError if one of the indices is out of range

    throws

    a OutOfBoundsError if recordIndex or fieldIndex is out of range

    throws

    a SchemaViolationError if removing the field would violate the schema

    Parameters

    • recordName: string

      the name of the record

    • recordIndex: number

      the record index

    • fieldIndex: number

      the index of the field to remove

    Returns MutableRecordModel

    this model

removeRecord

  • Removes the specified occurrence of a variable multiplicity record.

    A variable multiplicity record must be the last or only record within a schema and therefore the record name is not required.

    throws

    an IllegalArgumentError if the index is out of range

    throws

    a SchemaViolationError if removing the record would violate the schema

    Parameters

    • index: number

      the index of the record to remove

    Returns MutableRecordModel

    this model

Protected schema

  • Get the schema that this model corresponds to

    Returns ConcreteSchema

set

  • set(recordName: string, recordIndexOrFieldNameOrValue: number | string, fieldNameOrValue?: undefined | string, fieldIndex?: number, value?: undefined | string): MutableRecordModel
  • inheritdoc

    Parameters

    • recordName: string
    • recordIndexOrFieldNameOrValue: number | string
    • Optional fieldNameOrValue: undefined | string
    • Default value fieldIndex: number = 0
    • Optional value: undefined | string

    Returns MutableRecordModel

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.