Class ARecordGeneric

All Implemented Interfaces:
IValidated, IWriteable, Map<Keyword,​ACell>
Direct Known Subclasses:
Result

public abstract class ARecordGeneric extends ARecord
Abstract base class for generic records. Generic records are backed by a vector
  • Field Details

  • Constructor Details

  • Method Details

    • entryAt

      public MapEntry<Keyword,​ACell> entryAt(long i)
      Description copied from class: AMap
      Gets the entry in this map at a specified index, according to the map-specific order.
      Overrides:
      entryAt in class ARecord
      Parameters:
      i - Index of entry
      Returns:
      MapEntry at the specified index.
    • get

      public ACell get(ACell key)
      Description copied from class: ARecord
      Gets the record field content for a given key, or null if not found.
      Specified by:
      get in class ARecord
      Parameters:
      key - Key to look up in this record
      Returns:
      Field value for the given key
    • getTag

      public abstract byte getTag()
      Description copied from class: ARecord
      Gets the tag byte for this record type. The Tag is the byte used to identify the record in the binary encoding.
      Specified by:
      getTag in class ARecord
      Returns:
      Record tag byte
    • getRefCount

      public int getRefCount()
      Description copied from class: ACell
      Gets the number of Refs contained within this Cell. This number is final / immutable for any given instance. Contained Refs may be either external or embedded.
      Overrides:
      getRefCount in class ARecord
      Returns:
      The number of Refs in this Cell
    • equals

      public boolean equals(AMap<Keyword,​ACell> a)
      Description copied from class: AMap
      Checks this map for equality with another map. In general, maps should be considered equal if they have the same canonical representation, i.e. the same hash value. Subclasses may override this this they have a more efficient equals implementation or a more specific definition of equality.
      Specified by:
      equals in class AMap<Keyword,​ACell>
      Parameters:
      a - Map to compare with
      Returns:
      true if maps are equal, false otherwise.
    • getRef

      public <R extends ACell> Ref<R> getRef(int index)
      Description copied from class: ACell
      Gets a numbered child Ref from within this Cell.
      Overrides:
      getRef in class ARecord
      Type Parameters:
      R - Type of referenced Cell
      Parameters:
      index - Index of ref to get
      Returns:
      The Ref at the specified index
    • updateRefs

      public ARecord updateRefs(IRefFunction func)
      Description copied from class: ACell
      Updates all Refs in this object using the given function. The function *must not* change the hash value of Refs, in order to ensure structural integrity of modified data structures. This is a building block for a very sneaky trick that enables use to do a lot of efficient operations on large trees of smart references. Must return the same object if no Refs are altered.
      Overrides:
      updateRefs in class ARecord
      Parameters:
      func - Ref update function
      Returns:
      Cell with updated Refs
    • updateAll

      protected ARecord updateAll(ACell[] newVals)
      Description copied from class: ARecord
      Updates all values in this record, in declared field order. Returns this if all values are identical.
      Specified by:
      updateAll in class ARecord
      Parameters:
      newVals - New values to replace current
      Returns:
      Updated Record
    • values

      public AVector<ACell> values()
      Description copied from class: ARecord
      Gets a vector of values for this record, in format-determined order
      Specified by:
      values in interface Map<Keyword,​ACell>
      Overrides:
      values in class ARecord
      Returns:
      Vector of Values
    • withValues

      protected abstract ARecord withValues(AVector<ACell> newValues)
      Updates the record with a new set of values. Returns this if and only if values vector is identical.
      Parameters:
      newValues - New values to use
      Returns:
      Updated Record
    • validateCell

      public void validateCell() throws InvalidDataException
      Description copied from class: ACell
      Validates the local structure and invariants of this cell. Called by validate() super implementation. Should validate directly contained data, but should not validate all other structure of this cell. In particular, should not traverse potentially missing child Refs.
      Specified by:
      validateCell in class ACell
      Throws:
      InvalidDataException - If the Cell is invalid