Class ARecordGeneric

All Implemented Interfaces:
IAssociative<Keyword,ACell>, 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 of values
  • 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 and is defined by the Cell encoding rules. WARNING: may not be valid id Cell is not canonical Contained Refs may be either external or embedded.
      Specified by:
      getRefCount in class ACell
      Returns:
      The number of Refs in this Cell
    • equals

      public boolean equals(ACell a)
      Description copied from class: ACell
      Checks for equality with another Cell. In general, Cells are considered equal if they have the same canonical representation, i.e. an identical encoding with the same hash value. Subclasses SHOULD override this if they have a more efficient equals implementation. MUST NOT require reads from Store.
      Overrides:
      equals in class ACell
      Parameters:
      a - Cell to compare with. May be null.
      Returns:
      True if this cell is equal to the other object
    • equals

      protected boolean equals(ARecordGeneric a)
    • getRef

      public <R extends ACell> Ref<R> getRef(int index)
      Description copied from class: ACell
      Gets a numbered child Ref from within this Cell. WARNING: May be unreliable is cell is not canonical
      Overrides:
      getRef in class ACell
      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. The implementation *should* re-attach any original encoding in order to prevent re-encoding or surplus hashing 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 ACell
      Parameters:
      func - Ref update function
      Returns:
      Cell with updated Refs
    • 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