Package convex.core.data
Class ARecordGeneric
java.lang.Object
- All Implemented Interfaces:
IValidated
,IWriteable
,Map<Keyword,ACell>
- Direct Known Subclasses:
Result
Abstract base class for generic records.
Generic records are backed by a vector
-
Nested Class Summary
-
Field Summary
FieldsFields inherited from class convex.core.data.ARecord
DEFAULT_VALUE, format
Fields inherited from class convex.core.data.ADataStructure
count
Fields inherited from class convex.core.data.ACell
cachedRef, EMPTY_ARRAY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ARecordGeneric(RecordFormat format, AVector<ACell> values)
-
Method Summary
Modifier and TypeMethodDescriptionentryAt(long i)
Gets the entry in this map at a specified index, according to the map-specific order.boolean
Checks this map for equality with another map.Gets the record field content for a given key, or null if not found.getRef(int index)
Gets a numbered child Ref from within this Cell.int
Gets the number of Refs contained within this Cell.abstract byte
getTag()
Gets the tag byte for this record type.protected ARecord
Updates all values in this record, in declared field order.updateRefs(IRefFunction func)
Updates all Refs in this object using the given function.void
Validates the local structure and invariants of this cell.values()
Gets a vector of values for this record, in format-determined orderprotected abstract ARecord
withValues(AVector<ACell> newValues)
Updates the record with a new set of values.Methods inherited from class convex.core.data.ARecord
accumulateEntrySet, accumulateKeySet, accumulateValues, assoc, assocEntry, containsKey, containsValue, dissoc, dissoc, empty, encodeRaw, entrySet, equalsKeys, estimatedEncodingSize, forEach, get, getEntry, getEntryByHash, getFormat, getKeyRefEntry, getKeys, getType, getValuesArray, isCanonical, isCVMValue, keySet, print, reduceEntries, reduceValues, toCanonical, toHashMap
Methods inherited from class convex.core.data.AMap
clear, conj, containsKey, containsKeyRef, entryVector, equals, filterValues, get, get, getElementRef, put, putAll, remove
Methods inherited from class convex.core.data.ADataStructure
conjAll, count, isEmpty, size
Methods inherited from class convex.core.data.ACell
announce, announce, attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createAnnounced, createEncoding, createPersisted, createPersisted, createRef, encode, equals, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getRef, hashCode, isEmbedded, mark, mark, toString, validate, write
Methods inherited from class convex.core.data.AObject
attachEncoding, 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
-
Field Details
-
values
-
-
Constructor Details
-
ARecordGeneric
-
-
Method Details
-
entryAt
Description copied from class:AMap
Gets the entry in this map at a specified index, according to the map-specific order. -
get
Description copied from class:ARecord
Gets the record field content for a given key, or null if not found. -
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. -
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. Contained Refs may be either external or embedded.- Overrides:
getRefCount
in classARecord
- Returns:
- The number of Refs in this Cell
-
equals
Description copied from class:AMap
Checks this map for equality with another map. In general, maps should be considered equal if they have the same canonical representation, i.e. the same hash value. Subclasses may override this this they have a more efficient equals implementation or a more specific definition of equality. -
getRef
Description copied from class:ACell
Gets a numbered child Ref from within this Cell. -
updateRefs
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. 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 classARecord
- Parameters:
func
- Ref update function- Returns:
- Cell with updated Refs
-
updateAll
Description copied from class:ARecord
Updates all values in this record, in declared field order. Returns this if all values are identical. -
values
Description copied from class:ARecord
Gets a vector of values for this record, in format-determined order -
withValues
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
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 classACell
- Throws:
InvalidDataException
- If the Cell is invalid
-