Class ABlobMap<K extends ABlob,V extends ACell>

Type Parameters:
K - Type of BlobMap keys
V - Type of BlobMap values
All Implemented Interfaces:
IAssociative<K,V>, IValidated, IWriteable, Map<K,V>
Direct Known Subclasses:
BlobMap

public abstract class ABlobMap<K extends ABlob,V extends ACell> extends AMap<K,V>
Abstract base class for BlobMaps: a sorted radix-tree map of Blobs to Values. Primary benefits: - Provide sorted orderings for indexes - Support Schedule data structure
  • Constructor Details

    • ABlobMap

      protected ABlobMap(long count)
  • Method Details

    • get

      public final V get(ACell key)
      Description copied from class: ADataStructure
      Get the value associated with a given key.
      Specified by:
      get in class AMap<K extends ABlob,V extends ACell>
      Parameters:
      key - Associative key to look up
      Returns:
      Value from collection, or a falsey value (null or false) if not found
    • containsKey

      public boolean containsKey(ACell key)
      Description copied from class: ADataStructure
      Checks if the data structure contains the specified key
      Overrides:
      containsKey in class AMap<K extends ABlob,V extends ACell>
      Parameters:
      key - Associative key to look up
      Returns:
      true if the data structure contains the key, false otherwise
    • get

      public abstract V get(ABlob key)
      Gets the map entry for a given blob
      Parameters:
      key - Key to lookup up
      Returns:
      The value specified by the given blob key or null if not present.
    • entrySet

      public Set<Map.Entry<K,V>> entrySet()
    • 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. 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
    • 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. WARNING: May be unreliable is cell is not canonical
      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
    • isCanonical

      public boolean isCanonical()
      Description copied from class: ACell
      Returns true if this Cell is in a canonical representation for message writing. Non-canonical objects may be used on a temporary internal basis, they must always be converted to canonical representations for external use (e.g. Encoding).
      Specified by:
      isCanonical in class ACell
      Returns:
      true if the object is in canonical format, false otherwise
    • getType

      public AType getType()
      Description copied from class: ACell
      Gets the most specific known runtime Type for this Cell.
      Overrides:
      getType in class AMap<K extends ABlob,V extends ACell>
      Returns:
      The Type of this Call
    • assoc

      public abstract ABlobMap<K,V> assoc(ACell key, ACell value)
      Associates a blob key with a value in this data structure. Returns null if the key is not a valid BlobMap key
      Specified by:
      assoc in class AMap<K extends ABlob,V extends ACell>
      Parameters:
      key - Map key to associate
      value - Map value
      Returns:
      An updated map with the new association, or null if the association fails
    • dissoc

      public final ABlobMap<K,V> dissoc(ACell key)
      Description copied from class: AMap
      Dissociates a key from this map, returning an updated map if the key was removed, or the same unchanged map if the key is not present.
      Specified by:
      dissoc in class AMap<K extends ABlob,V extends ACell>
      Parameters:
      key - Key to remove.
      Returns:
      Updated map
    • dissoc

      public abstract ABlobMap<K,V> dissoc(K key)
    • getKeyRefEntry

      public MapEntry<K,V> getKeyRefEntry(Ref<ACell> ref)
      Description copied from class: AMap
      Get an entry given a Ref to the key value. This is more efficient than directly looking up using the key for some map types, and should be preferred if the caller already has a Ref available.
      Specified by:
      getKeyRefEntry in class AMap<K extends ABlob,V extends ACell>
      Parameters:
      ref - Ref to Map key
      Returns:
      MapEntry for the given key ref
    • entryAt

      public abstract MapEntry<K,V> entryAt(long i)
      Description copied from class: AMap
      Gets the entry in this map at a specified index, according to the map-specific order. Caller responsible for bounds check!
      Specified by:
      entryAt in class AMap<K extends ABlob,V extends ACell>
      Parameters:
      i - Index of entry
      Returns:
      MapEntry at the specified index.
    • getEntry

      public MapEntry<K,V> getEntry(ACell key)
      Description copied from class: AMap
      Gets the MapEntry for the given key
      Specified by:
      getEntry in class AMap<K extends ABlob,V extends ACell>
      Parameters:
      key - Key to lookup in Map
      Returns:
      The map entry, or null if the key is not found
    • getEntry

      public abstract MapEntry<K,V> getEntry(ABlob key)
    • estimatedEncodingSize

      public abstract int estimatedEncodingSize()
      Description copied from interface: IWriteable
      Estimate the encoded data size for this Cell. Used for quickly sizing buffers. Implementations should try to return a size that is highly likely to contain the entire object when encoded, including the tag byte. Should not traverse soft Refs, i.e. must be usable on arbitrary partial data structures
      Returns:
      The estimated size for the binary representation of this object.