Module com.github.akurilov.commons
Interface TreeUtil
-
public interface TreeUtil
-
-
Method Summary
Static Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.Object>addBranches(java.util.Map<java.lang.String,java.lang.Object> dst, java.util.Map<java.lang.String,java.lang.Object> src)static java.util.Map<java.lang.String,java.lang.Object>copyTree(java.util.Map<java.lang.String,java.lang.Object> srcTree)Deep copy the tree implemented as map of maps/leafsstatic java.util.Map<java.lang.String,java.lang.Object>reduceForest(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> forest)Merge the tree by reducing the given forest.
-
-
-
Method Detail
-
copyTree
static java.util.Map<java.lang.String,java.lang.Object> copyTree(java.util.Map<java.lang.String,java.lang.Object> srcTree)
Deep copy the tree implemented as map of maps/leafs- Parameters:
srcTree- the source tree- Returns:
- the tree copy
-
addBranches
static java.util.Map<java.lang.String,java.lang.Object> addBranches(java.util.Map<java.lang.String,java.lang.Object> dst, java.util.Map<java.lang.String,java.lang.Object> src)
-
reduceForest
static java.util.Map<java.lang.String,java.lang.Object> reduceForest(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> forest)
Merge the tree by reducing the given forest. Any leaf in any next tree is added to the resulting tree, overwriting already existing leaf if any- Parameters:
forest- the given forest (list of trees)- Returns:
- the resulting tree (may be empty)
-
-