Package convex.core.data.prim
Class CVMBool
java.lang.Object
convex.core.data.AObject
convex.core.data.ACell
convex.core.data.prim.APrimitive
convex.core.data.prim.CVMBool
- All Implemented Interfaces:
IValidated,IWriteable
Class for CVM Boolean types.
Two canonical values are provided, TRUE and FALSE. No other instances should exist.
-
Field Summary
FieldsFields inherited from class convex.core.data.ACell
cachedRef, EMPTY_ARRAY -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic CVMBoolcreate(boolean value)doubleintencode(byte[] bs, int pos)Writes this Cell's encoding to a byte array, including a tag byte which will be written firstintencodeRaw(byte[] bs, int pos)Writes this Cell's encoding to a byte array, excluding the tag byteintEstimate the encoded data size for this Cell.bytegetTag()Gets the tag byte for this cell.getType()Gets the most specific known runtime Type for this Cell.longstatic CVMBoolof(boolean b)Get the canonical CVMBool value for true or falsestatic ACellvoidprint(StringBuilder sb)Prints this Object to a readable String RepresentationvoidValidates the local structure and invariants of this cell.Methods inherited from class convex.core.data.prim.APrimitive
calcMemorySize, createRef, getRefCount, isCanonical, isCVMValue, isEmbedded, toCanonicalMethods inherited from class convex.core.data.ACell
announce, announce, attachMemorySize, attachRef, cachedEncoding, cachedHash, createAnnounced, createEncoding, createPersisted, createPersisted, equals, equals, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getRef, getRef, hashCode, toString, updateRefs, validate, writeMethods inherited from class convex.core.data.AObject
attachEncoding, print
-
Field Details
-
TRUE
-
FALSE
-
-
Method Details
-
getType
Description copied from class:ACellGets the most specific known runtime Type for this Cell. -
create
-
of
Get the canonical CVMBool value for true or false- Parameters:
b- Boolean specifying- Returns:
- CVMBool value representing false or true
-
longValue
public long longValue()- Specified by:
longValuein classAPrimitive- Returns:
- long value representing primitive
-
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.
-
validateCell
Description copied from class:ACellValidates 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:
validateCellin classACell- Throws:
InvalidDataException- If the Cell is invalid
-
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
-
encodeRaw
public int encodeRaw(byte[] bs, int pos)Description copied from class:ACellWrites this Cell's encoding to a byte array, excluding the tag byte -
print
Description copied from class:AObjectPrints this Object to a readable String Representation -
doubleValue
public double doubleValue()- Specified by:
doubleValuein classAPrimitive- Returns:
- double value representing primitive
-
booleanValue
public boolean booleanValue() -
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 -
parse
-