Package convex.core.data
Class Refs
java.lang.Object
convex.core.data.Refs
Static utilities for working with Refs
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAccumulates the set of all unique Refs in the given object.accumulateRefSet(Ref<?> root) static voidcheckConsistentStores(Ref<?> root, AStore store) Checks the complete tree of Refs is consistent with the given storestatic Refs.RefTreeStatsgetRefTreeStats(Ref<?> root) Gets statistics for a tree of Refsstatic StringprintMissingTree(ACell value) static voidprintMissingTree(StringBuilder sb, ACell value) Utility function to locate missing datastatic longCounts the total number of Refs contained in a data object recursively.static longCounts the number of logically unique Refs for a Cell, i.e.static voidvisitAllRefs(Ref<?> root, Consumer<Ref<?>> visitor) Visit all Refs in a tree of Refs, in depth first order.static voidvisitNonEmbedded(ACell a, Consumer<Ref<?>> visitor) Visit all non-embedded children of a Cell.
-
Constructor Details
-
Refs
public Refs()
-
-
Method Details
-
visitAllRefs
Visit all Refs in a tree of Refs, in depth first order. Requires O(1) stack, O(n) time and O(depth) memory.- Parameters:
root- Root of Ref tree to visitvisitor- Visitor function to call for each Ref
-
visitNonEmbedded
Visit all non-embedded children of a Cell. Recursively checks embedded children.- Parameters:
a- Cell within which to visit children.visitor- Visitor instance
-
checkConsistentStores
Checks the complete tree of Refs is consistent with the given store- Parameters:
root- Root of Ref tree to visitstore- Store to check consistency with
-
getRefTreeStats
Gets statistics for a tree of Refs- Parameters:
root- Root node of Ref Tree- Returns:
- Stats object
-
accumulateRefSet
Accumulates the set of all unique Refs in the given object.- Parameters:
a- Ref or Cell- Returns:
- Set containing all unique refs (accumulated recursively) within the given object
-
accumulateRefSet
-
totalRefCount
Counts the total number of Refs contained in a data object recursively. Will count duplicate children multiple times.- Parameters:
a- Object to count Refs in- Returns:
- Total number of Refs found
-
uniqueRefCount
Counts the number of logically unique Refs for a Cell, i.e. the number of unique cell values (including this Cell)- Parameters:
a- Cell to count Refs in- Returns:
- Number of Refs found
-
printMissingTree
Utility function to locate missing data- Parameters:
sb- StringBuilder to append tovalue- Value to search for missing data
-
printMissingTree
-