Package convex.core.data
Class AIndex<K extends ABlobLike<?>,V extends ACell>
java.lang.Object
convex.core.data.AObject
convex.core.data.ACell
convex.core.data.ACountable<MapEntry<K,V>>
convex.core.data.ADataStructure<MapEntry<K,V>>
convex.core.data.AMap<K,V>
convex.core.data.AIndex<K,V>
- Type Parameters:
K
- Type of Index keysV
- Type of Index values
- All Implemented Interfaces:
IAssociative<K,
,V> IValidated
,IWriteable
,Map<K,
V>
- Direct Known Subclasses:
Index
Abstract base class for Indexes: a sorted radix-tree map of Blobs to Values.
Primary benefits: - Provide sorted orderings for indexes - Support Schedule
data structure
-
Nested Class Summary
-
Field Summary
Fields inherited from class convex.core.data.ADataStructure
count
Fields inherited from class convex.core.data.ACell
cachedRef, memorySize
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAssociates a blob key with a value in this data structure.boolean
containsKey
(ACell key) Checks if the data structure contains the specified keyDissociates 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.entryAt
(long i) Gets the entry in this map at a specified index, according to the map-specific order.entrySet()
abstract int
Estimate the encoded data size for this Cell.final V
Get the value associated with a given key.abstract V
Gets the map entry for a given BlobGets the MapEntry for the given keygetKeyRefEntry
(Ref<ACell> ref) Get an entry given a Ref to the key value.getRef
(int i) Gets a numbered child Ref from within this Cell.abstract int
Gets the number of Refs contained within this Cell.getType()
Gets the most specific known runtime Type for this Cell.boolean
Returns true if this Cell is in a canonical representation.Methods inherited from class convex.core.data.AMap
accumulateEntrySet, accumulateKeySet, accumulateValues, assocEntry, clear, conj, containsKey, containsKeyRef, containsValue, containsValue, empty, entryVector, filterValues, forEach, get, get, get, getElementRef, getEntryByHash, getKeys, keySet, merge, print, put, putAll, reduceEntries, reduceValues, remove, slice, slice, values
Methods inherited from class convex.core.data.ADataStructure
checkIndex, conjAll, count, isDataValue, isEmpty, size, toCVMString
Methods inherited from class convex.core.data.ACell
attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createEncoding, createRef, encode, encodeRaw, equals, equals, genericEquals, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getMemorySize, getRef, getTag, hashCode, isCVMValue, isEmbedded, toCanonical, toString, updateRefs, validate, validateCell
Methods inherited from class convex.core.data.AObject
attachEncoding, print, print
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, getOrDefault, hashCode, isEmpty, merge, putIfAbsent, remove, replace, replace, replaceAll, size
-
Constructor Details
-
AIndex
protected AIndex(long count)
-
-
Method Details
-
get
Description copied from class:ADataStructure
Get the value associated with a given key. -
containsKey
Description copied from class:ADataStructure
Checks if the data structure contains the specified key -
get
-
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. Contained Refs may be either external or embedded.- Overrides:
getRefCount
in classACell
- Returns:
- The number of Refs in this Cell
-
getRef
Description copied from class:ACell
Gets a numbered child Ref from within this Cell. WARNING: May need to convert to a canonical instance -
isCanonical
public boolean isCanonical()Description copied from class:ACell
Returns true if this Cell is in a canonical representation. Non-canonical objects may be used on a temporary internal basis, they should be converted to canonical representations for general purpose use.- Specified by:
isCanonical
in classACell
- Returns:
- true if the object is in canonical format, false otherwise
-
getType
-
assoc
Associates a blob key with a value in this data structure. Returns null if the key is not a valid Index key -
dissoc
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. -
dissoc
-
getKeyRefEntry
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. -
entryAt
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! -
getEntry
-
getEntry
-
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.
-