Package convex.core.data
Class AMapEntry<K extends ACell,V extends ACell>
java.lang.Object
- All Implemented Interfaces:
IAssociative<CVMLong,
,ACell> IValidated
,IWriteable
,Iterable<ACell>
,Collection<ACell>
,List<ACell>
,Map.Entry<K,
V>
- Direct Known Subclasses:
MapEntry
-
Field Summary
Fields inherited from class convex.core.data.ADataStructure
count
Fields inherited from class convex.core.data.ACell
cachedRef, EMPTY_ARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
Appends a single element to this vectorappendChunk
(VectorLeaf<ACell> listVector) Appends a ListVector chunk to this vector.long
Computes the length of the longest common prefix of this vector and another vector.abstract int
encode
(byte[] bs, int pos) Writes this Cell's encoding to a byte array, including a tag byte which will be written first.void
abstract ACell
get
(long i) Gets the element at the specified index in this vectorfinal VectorLeaf<ACell>
getChunk
(long offset) Gets the VectorLeaf chunk at a given offsetabstract K
getKey()
getRef
(int i) Gets a numbered child Ref from within this Cell.abstract int
Gets the number of Refs contained within this Cell.abstract V
getValue()
abstract boolean
Returns true if this vector is in canonical format, i.e.final boolean
Returns true if this Vector is a single fully packed tree.iterator()
listIterator
(long index) Gets the ListIterator for a long positionlong
Gets the first long index at which the specified value appears in the the sequence.long
Gets the last long index at which the specified value appears in the the sequence.next()
Gets the sequence of all elements after the first, or null if no elements remainfinal ACell
final V
<T> T[]
toArray
(T[] a) Create a new MapEntry with an updated key.Create a new MapEntry with an updated value.Methods inherited from class convex.core.data.AVector
appendAll, assoc, concat, conj, conjAll, cons, empty, encodeRaw, flatMap, get, getElementRefUnsafe, getTag, getType, indexOf, isPacked, lastIndexOf, listIterator, map, mergeWith, print, reduce, reverse, slice, toArray, updateRefs
Methods inherited from class convex.core.data.ASequence
add, addAll, assoc, checkRange, contains, containsKey, get, get, getElementRef, remove, spliterator, spliterator, subList, subVector, toCellArray, visitElementRefs
Methods inherited from class convex.core.data.ACollection
add, addAll, clear, containsAll, copyToArray, remove, removeAll, retainAll, toVector
Methods inherited from class convex.core.data.ADataStructure
checkIndex, count, isEmpty, size, toCVMString
Methods inherited from class convex.core.data.ACountable
slice
Methods inherited from class convex.core.data.ACell
announce, announce, attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createAnnounced, createEncoding, createPersisted, createPersisted, createRef, equals, equals, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getRef, hashCode, isCompletelyEncoded, isCVMValue, isEmbedded, mark, mark, toCanonical, toString, 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.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface convex.core.data.IWriteable
estimatedEncodingSize
-
Constructor Details
-
AMapEntry
public AMapEntry(long count)
-
-
Method Details
-
get
Description copied from class:AVector
Gets the element at the specified index in this vector -
appendChunk
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 classAVector<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
Description copied from class:AVector
Gets the VectorLeaf chunk at a given offset -
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 classAVector<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. WARNING: may not be valid id Cell is not canonical Contained Refs may be either external or embedded.- Specified by:
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 be unreliable is cell is not canonical -
getKey
-
getValue
-
setValue
-
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 classAVector<ACell>
- Returns:
- true if the vector is in canonical format, false otherwise
-
append
Description copied from class:AVector
Appends a single element to this vector -
listIterator
Description copied from class:ASequence
Gets the ListIterator for a long position- Specified by:
listIterator
in classAVector<ACell>
- Returns:
- ListIterator instance.
-
listIterator
- Specified by:
listIterator
in interfaceList<K extends ACell>
-
iterator
-
longIndexOf
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 classASequence<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
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 classASequence<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
Description copied from class:AVector
Computes the length of the longest common prefix of this vector and another vector.- Specified by:
commonPrefixLength
in classAVector<ACell>
- Parameters:
b
- Any vector- Returns:
- Length of the longest common prefix
-
withKey
Create a new MapEntry with an updated key. Shares old value. Returns the same MapEntry if unchanged- Parameters:
key
- Key to update- Returns:
-
withValue
Create a new MapEntry with an updated value. Shares old key. Returns the same MapEntry if unchanged- Parameters:
value
- Value to update- Returns:
-
next
Description copied from class:ASequence
Gets the sequence of all elements after the first, or null if no elements remain -
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 interfaceIWriteable
- Specified by:
encode
in classACollection<ACell>
- Parameters:
bs
- A byte array to which to write the encodingpos
- The offset into the byte array- Returns:
- New position after writing
-
set
-
anyMatch
-
allMatch
-
forEach
-
toArray
public <T> T[] toArray(T[] a)
-