Package convex.core.data
Class ANumericBlob
java.lang.Object
convex.core.data.AObject
convex.core.data.ACell
convex.core.data.ACountable<CVMByte>
convex.core.data.ABlob
convex.core.data.AArrayBlob
convex.core.data.ANumericBlob
- All Implemented Interfaces:
IValidated,IWriteable,Comparable<ABlob>
Base class for Blobs which represent an integral numeric value
-
Field Summary
Fields inherited from class convex.core.data.AArrayBlob
length, offset, storeFields inherited from class convex.core.data.ABlob
contentHashFields inherited from class convex.core.data.ACell
cachedRef, EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintencode(byte[] bs, int pos)Writes this Cell's encoding to a byte array, including a tag byte which will be written firstbooleanDetermines if this Blob is equal to another Blob.booleanequals(ANumericBlob a)intEstimate the encoded data size for this Cell.getChunk(long i)Gets a chunk of this Blob, as a canonical Blob up to the maximum chunk sizebytegetTag()Gets the tag byte for this cell.booleanReturns true if this Cell is in a canonical representation for message writing.booleanReturns true if this object represents a first class CVM Value.booleanReturns true if this object is a regular blob (i.e.Methods inherited from class convex.core.data.AArrayBlob
append, byteAt, commonHexPrefixLength, compareTo, compareTo, count, encodeRaw, equalsBytes, equalsBytes, getByteBuffer, getBytes, getHexDigit, getInternalArray, getInternalOffset, getRefCount, getUnchecked, hexMatches, hexMatchLength, longValue, rangeMatches, rangeMatches, slice, slice, toBlob, toHexString, toHexString, toLong, updateDigest, validate, validateCell, writeToBuffer, writeToBufferMethods inherited from class convex.core.data.ABlob
computeHash, empty, equals, get, getBytes, getContentHash, getElementRef, getType, hashCode, hexEquals, hexEquals, hexLength, print, toByteBuffer, toCanonical, toHexStringMethods inherited from class convex.core.data.ACountable
isEmpty, sizeMethods inherited from class convex.core.data.ACell
announce, announce, attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createAnnounced, createEncoding, createPersisted, createPersisted, createRef, equals, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getRef, getRef, isEmbedded, mark, mark, toString, updateRefs, writeMethods inherited from class convex.core.data.AObject
attachEncoding, print
-
Constructor Details
-
ANumericBlob
protected ANumericBlob(byte[] bytes, int offset, int length)
-
-
Method Details
-
estimatedEncodingSize
public int estimatedEncodingSize()Description copied from interface:IWriteableEstimate the encoded data size for this Cell. Used for quickly sizing buffers. Implementations should try to return a size that is likely to contain the entire object when represented in binary format, including the tag byte.- Returns:
- The estimated size for the binary representation of this object.
-
equals
Description copied from class:ABlobDetermines if this Blob is equal to another Blob. Blobs are defined to be equal if they have the same on-chain representation, i.e. if and only if all of the following are true: - Blob is of the same general type - Blobs are of the same length - All byte values are equal -
equals
-
getChunk
Description copied from class:ABlobGets a chunk of this Blob, as a canonical Blob up to the maximum chunk size -
isRegularBlob
public boolean isRegularBlob()Description copied from class:ABlobReturns true if this object is a regular blob (i.e. not a special blob type like Address)- Overrides:
isRegularBlobin classABlob- Returns:
- True if a regular blob
-
encode
public int encode(byte[] bs, int pos)Description copied from class:ACellWrites this Cell's encoding to a byte array, including a tag byte which will be written first- Specified by:
encodein interfaceIWriteable- Specified by:
encodein classACell- Parameters:
bs- A byte array to which to write the encodingpos- The offset into the byte array- Returns:
- New position after writing
-
isCanonical
public boolean isCanonical()Description copied from class:ACellReturns 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:
isCanonicalin classACell- Returns:
- true if the object is in canonical format, false otherwise
-
isCVMValue
public final boolean isCVMValue()Description copied from class:ACellReturns true if this object represents a first class CVM Value. Sub-structural cells that are not themselves first class values should return false. CVM values might not be in a canonical format, e.g. temporary data structures- Specified by:
isCVMValuein classACell- Returns:
- true if the object is a CVM Value, false otherwise
-
getTag
public byte getTag()Description copied from class:ACellGets the tag byte for this cell. The tag byte is always written as the first byte of the Cell's Encoding
-