Package io.molr.mole.core.utils
Class Trees
- java.lang.Object
-
- io.molr.mole.core.utils.Trees
-
public class Trees extends Object
-
-
Constructor Summary
Constructors Constructor Description Trees()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
doesBlockHaveAParallelParent(Block block, TreeStructure structure)
Return whether or not the block has a parent in the hierarchy of the providedTreeStructure
that is parallelstatic void
logResultsOf(TreeTracker<?> tracker, TreeStructure structure)
Walks through theTreeStructure
, writing the result of each node to the logger.static void
visitParentBeforeChild(TreeStructure structure, BiConsumer<Block,Integer> c)
Walk through the providedTreeStructure
visiting the parent before each child.
-
-
-
Method Detail
-
logResultsOf
public static void logResultsOf(TreeTracker<?> tracker, TreeStructure structure)
Walks through theTreeStructure
, writing the result of each node to the logger.- Parameters:
tracker
- the tracker whose results to write to the loggerstructure
- the structure to walk through
-
visitParentBeforeChild
public static void visitParentBeforeChild(TreeStructure structure, BiConsumer<Block,Integer> c)
Walk through the providedTreeStructure
visiting the parent before each child. TheBiConsumer
is applied to each node and the second parameter represents the current depth of the node in the tree.- Parameters:
structure
- the structure to walk throughc
- a biconsumer which is called for each block, with the block as first parameter and the depth in the tree as second.
-
doesBlockHaveAParallelParent
public static boolean doesBlockHaveAParallelParent(Block block, TreeStructure structure)
Return whether or not the block has a parent in the hierarchy of the providedTreeStructure
that is parallel- Parameters:
block
- the block for which to query if it has a parent which is parallelstructure
- the tree structure to consider- Returns:
true
if the block has a parent which is parallel,false
if not.
-
-