Package convex.core.lang.ops
Class Local<T extends ACell>
java.lang.Object
convex.core.data.AObject
convex.core.data.ACell
convex.core.lang.AOp<T>
convex.core.lang.ops.Local<T>
- Type Parameters:
T
- Result type of Op
- All Implemented Interfaces:
IValidated
,IWriteable
Op to look up a local value from the lexical environment
-
Field Summary
Fields inherited from class convex.core.data.ACell
cachedRef, EMPTY_ARRAY
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(long position) Creates Local to look up a lexical value in the given positionint
encodeRaw
(byte[] bs, int pos) Writes the raw data for this Op to the specified bytebuffer.Executes this op with the given context.int
Gets the number of Refs contained within this Cell.byte
opCode()
Returns the opcode for this opboolean
print
(BlobBuilder bb, long limit) Prints this Object to a readable String Representation.read
(ByteBuffer bb) toString()
Returns the Java String representation of this Cell.updateRefs
(IRefFunction func) Updates all Refs in this object using the given function.void
Validates the local structure and invariants of this cell.Methods inherited from class convex.core.lang.AOp
encode, estimatedEncodingSize, getTag, getType, isCanonical, isCVMValue, toCanonical
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, getRef, hashCode, isCompletelyEncoded, isEmbedded, mark, mark, toCVMString, validate, write
Methods inherited from class convex.core.data.AObject
attachEncoding, print, print
-
Method Details
-
create
Creates Local to look up a lexical value in the given position- Parameters:
position
- Position in lexical value vector- Returns:
- Special instance, or null if not found
-
execute
Description copied from class:AOp
Executes this op with the given context. Must preserve depth unless an exceptional is returned. -
opCode
public byte opCode()Description copied from class:AOp
Returns the opcode for this op -
encodeRaw
public int encodeRaw(byte[] bs, int pos) Description copied from class:AOp
Writes the raw data for this Op to the specified bytebuffer. Assumes Op tag and opcode already written. -
read
- Throws:
BadFormatException
-
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.- Specified by:
updateRefs
in classAOp<T extends ACell>
- Parameters:
func
- Ref update function- Returns:
- Cell with updated Refs
-
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
-
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 and is defined by the Cell encoding rules. Contained Refs may be either external or embedded.- Specified by:
getRefCount
in classACell
- Returns:
- The number of Refs in this Cell
-
print
Description copied from class:AObject
Prints this Object to a readable String Representation. SECURITY: Must halt and return false in O(1) time if limit of printing is exceeded otherwise DoS attacks may be possible. -
toString
Description copied from class:ACell
Returns the Java String representation of this Cell. The String representation is intended to be a easy-to-read textual representation of the Cell's data content.
-