Trevis provides the ContextTreeOperations
class, which performs various operations on trees.
public final class ContextTreeOperations { public static ContextTree union(final ContextTree a, final ContextTree b, final ContextTreeFactory factory) {...} public static ContextTree intersection(final ContextTree a, final ContextTree b, final ContextTreeFactory factory) {...} public static ContextTree subtract(final ContextTree a, final ContextTree b, final ContextTreeFactory factory) {...} public static ContextTree clone(final ContextTree inTree, final ContextTreeFactory factory) {...} public static ContextTreeNode clone(final ContextTreeNode inSubtreeRoot, final ContextTreeFactory factory) {...} }
All these operations require a ContextTreeFactory
, because they will have to create a new ContextTree
and new ContextTreeNodes
of the correct type.