Class AMapEntry<K extends ACell,​V extends ACell>

All Implemented Interfaces:
IAssociative<CVMLong,​ACell>, IValidated, IWriteable, Iterable<ACell>, Collection<ACell>, List<ACell>, Map.Entry<K,​V>
Direct Known Subclasses:
MapEntry

public abstract class AMapEntry<K extends ACell,​V extends ACell> extends AVector<ACell> implements Map.Entry<K,​V>
  • Constructor Details

    • AMapEntry

      public AMapEntry(long count)
  • Method Details

    • get

      public abstract ACell get(long i)
      Description copied from class: AVector
      Gets the element at the specified index in this vector
      Specified by:
      get in class AVector<ACell>
      Parameters:
      i - The index of the element to get
      Returns:
      The element value at the specified index
    • appendChunk

      public final AVector<ACell> appendChunk(VectorLeaf<ACell> listVector)
      Description copied from class: AVector
      Appends a ListVector chunk to this vector. This vector must contain a whole number of chunks
      Specified by:
      appendChunk in class AVector<ACell>
      Parameters:
      listVector - A chunk to append. Must be a ListVector of maximum size
      Returns:
      The updated vector, of the same type as this vector @
    • getChunk

      public final VectorLeaf<ACell> getChunk(long offset)
      Description copied from class: AVector
      Gets the VectorLeaf chunk at a given offset
      Specified by:
      getChunk in class AVector<ACell>
      Parameters:
      offset - Offset into this vector. Must be a valid chunk start position
      Returns:
      The chunk referenced
    • isFullyPacked

      public final boolean isFullyPacked()
      Description copied from class: AVector
      Returns true if this Vector is a single fully packed tree. i.e. a full ListVector or TreeVector.
      Specified by:
      isFullyPacked in class AVector<ACell>
      Returns:
      true if fully packed, false otherwise
    • getRefCount

      public abstract 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. Contained Refs may be either external or embedded.
      Specified by:
      getRefCount in class ACell
      Returns:
      The number of Refs in this Cell
    • getRef

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

      public abstract K getKey()
      Specified by:
      getKey in interface Map.Entry<K extends ACell,​V extends ACell>
    • getValue

      public abstract V getValue()
      Specified by:
      getValue in interface Map.Entry<K extends ACell,​V extends ACell>
    • setValue

      public final V setValue(V value)
      Specified by:
      setValue in interface Map.Entry<K extends ACell,​V extends ACell>
    • isCanonical

      public abstract boolean isCanonical()
      Description copied from class: AVector
      Returns true if this vector is in canonical format, i.e. suitable as top-level serialised representation of a vector.
      Specified by:
      isCanonical in class AVector<ACell>
      Returns:
      true if the vector is in canonical format, false otherwise
    • append

      public AVector<ACell> append(ACell value)
      Description copied from class: AVector
      Appends a single element to this vector
      Specified by:
      append in class AVector<ACell>
      Parameters:
      value - Value to append
      Returns:
      Updated vector
    • spliterator

      public Spliterator<ACell> spliterator(long position)
      Specified by:
      spliterator in class AVector<ACell>
    • listIterator

      public ListIterator<ACell> listIterator(long index)
      Description copied from class: ASequence
      Gets the ListIterator for a long position
      Specified by:
      listIterator in class AVector<ACell>
      Returns:
      ListIterator instance.
    • listIterator

      public ListIterator<ACell> listIterator()
      Specified by:
      listIterator in interface List<K extends ACell>
    • iterator

      public Iterator<ACell> iterator()
      Specified by:
      iterator in interface Collection<K extends ACell>
      Specified by:
      iterator in interface Iterable<K extends ACell>
      Specified by:
      iterator in interface List<K extends ACell>
      Overrides:
      iterator in class AVector<ACell>
    • longIndexOf

      public long longIndexOf(Object o)
      Description copied from class: ASequence
      Gets the first long index at which the specified value appears in the the sequence. Similar to Java's standard List.indexOf(...) but supports long indexes.
      Specified by:
      longIndexOf in class ASequence<ACell>
      Parameters:
      o - Any value which could appear as an element of the sequence.
      Returns:
      Index of the value, or -1 if not found.
    • longLastIndexOf

      public long longLastIndexOf(Object o)
      Description copied from class: ASequence
      Gets the last long index at which the specified value appears in the the sequence. Similar to Java's standard List.lastIndexOf(...) but supports long indexes.
      Specified by:
      longLastIndexOf in class ASequence<ACell>
      Parameters:
      o - Any value which could appear as an element of the sequence.
      Returns:
      Index of the value, or -1 if not found.
    • commonPrefixLength

      public long commonPrefixLength(AVector<ACell> b)
      Description copied from class: AVector
      Computes the length of the longest common prefix of this vector and another vector.
      Specified by:
      commonPrefixLength in class AVector<ACell>
      Parameters:
      b - Any vector
      Returns:
      Length of the longest common prefix
    • withKey

      protected abstract AMapEntry<K,​V> withKey(K key)
      Create a new MapEntry with an updated key. Shares old value. Returns the same MapEntry if unchanged
      Parameters:
      key - Key to update
      Returns:
    • withValue

      protected abstract AMapEntry<K,​V> withValue(V value)
      Create a new MapEntry with an updated value. Shares old key. Returns the same MapEntry if unchanged
      Parameters:
      value - Value to update
      Returns:
    • next

      public AVector<ACell> next()
      Description copied from class: ASequence
      Gets the sequence of all elements after the first, or null if no elements remain
      Specified by:
      next in class AVector<ACell>
      Returns:
      Sequence following the first element
    • encode

      public abstract int encode(byte[] bs, int pos)
      Description copied from class: ACell
      Writes this Cell's encoding to a byte array, including a tag byte which will be written first. Cell must be canonical, or else an error may occur.
      Specified by:
      encode in interface IWriteable
      Specified by:
      encode in class ACollection<ACell>
      Parameters:
      bs - A byte array to which to write the encoding
      pos - The offset into the byte array
      Returns:
      New position after writing
    • set

      public final ACell set(int index, ACell element)
      Specified by:
      set in interface List<K extends ACell>
      Overrides:
      set in class ASequence<ACell>
    • anyMatch

      public boolean anyMatch(Predicate<? super ACell> pred)
      Specified by:
      anyMatch in class AVector<ACell>
    • allMatch

      public boolean allMatch(Predicate<? super ACell> pred)
      Specified by:
      allMatch in class AVector<ACell>
    • forEach

      public void forEach(Consumer<? super ACell> action)
      Specified by:
      forEach in interface Iterable<K extends ACell>
      Specified by:
      forEach in class ASequence<ACell>
    • toArray

      public <T> T[] toArray(T[] a)
      Specified by:
      toArray in interface Collection<K extends ACell>
      Specified by:
      toArray in interface List<K extends ACell>
      Overrides:
      toArray in class ACollection<ACell>