Package convex.core.data
Class Cells
java.lang.Object
convex.core.data.Cells
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ACell>
TAnnounces a Cell, reporting as novelty any cells that have not been previously announcedstatic int
branchCount
(ACell a) Gets the number of Branches directly contained in a Cell (will be zero if the Cell is not a Ref container)static boolean
Equality method allowing for nullsgetEncoding
(ACell a) static Hash
Gets the Hash (Value ID of a cell)Gets a Ref from a Cell by indexstatic boolean
Checks if a Cell is completely encoded, i.e.static boolean
Checks if a Cell is a valid CVM valuestatic boolean
Checks if a Cell is a first class valuestatic <T extends ACell>
Tpersist
(T a) Persist a cell in the current storestatic <T extends ACell>
TPersist a cell in the given storestatic int
Gets the number of Refs directly contained in a Cell (will be zero if the Cell is not a Ref container)static long
storageSize
(ACell a) Get the full storage size of a value, including size of an embedded encodingstatic <T extends ACell>
TPersist a cell in the given storestatic ACell[]
toCellArray
(Object anyArray) Converts any array to an ACell[] array.static void
visitBranches
(ACell a, Consumer<ACell> visitor) Visit all non-embedded branches from a Cell.static void
visitBranchRefs
(ACell a, Consumer<Ref<?>> visitor) Visit all non-embedded branches from a Cell.
-
Field Details
-
EMPTY_ARRAY
An empty Java array of cells
-
-
Constructor Details
-
Cells
public Cells()
-
-
Method Details
-
equals
-
toCellArray
-
refCount
Gets the number of Refs directly contained in a Cell (will be zero if the Cell is not a Ref container)- Parameters:
a
- Cell to check (may be null)- Returns:
- Number of Refs in the object.
-
branchCount
Gets the number of Branches directly contained in a Cell (will be zero if the Cell is not a Ref container)- Parameters:
a
- Cell to check (may be null)- Returns:
- Number of Refs in the object.
-
getRef
Gets a Ref from a Cell by index- Type Parameters:
R
- Type of cell- Parameters:
cell
- Cell to read Ref fromindex
- Numerical index of Ref- Returns:
- Ref for cell
- Throws:
IndexOutOfBoundsException
- if the index is out of range for the Cell
-
isCVM
Checks if a Cell is a valid CVM value- Parameters:
a
- Cell to check- Returns:
- True if CVM VAlue, false otherwise
-
isCompletelyEncoded
Checks if a Cell is completely encoded, i.e. has not external Refs- Parameters:
a
- Cell to check- Returns:
- True if completely encoded, false otherwise
-
isValue
Checks if a Cell is a first class value- Parameters:
a
- Cell to check- Returns:
- True if CVM VAlue, false otherwise
-
persist
Persist a cell in the current store- Parameters:
a
- Cell to persist- Returns:
- Cell after persisting (may be the same Cell if no change in cell hierarchy)
-
persist
-
store
-
announce
Announces a Cell, reporting as novelty any cells that have not been previously announced- Parameters:
a
- Cell to announcenoveltyHandler
- Handler for novelty values- Returns:
- Cell after announcing (may be the same Cell if no change in cell hierarchy)
-
getHash
-
getEncoding
-
storageSize
Get the full storage size of a value, including size of an embedded encoding- Parameters:
a
- Cell to get size for (may be null)- Returns:
- Storage size
-
visitBranchRefs
-
visitBranches
-