Package

org.opencypher.okapi

trees

Permalink

package trees

Visibility
  1. Public
  2. All

Type Members

  1. abstract class AbstractTreeNode[T <: AbstractTreeNode[T]] extends TreeNode[T]

    Permalink

    Class that implements the children and withNewChildren methods using reflection when implementing TreeNode with a case class or case object.

    Class that implements the children and withNewChildren methods using reflection when implementing TreeNode with a case class or case object.

    This class caches values that are expensive to recompute.

    The constructor can also contain NonEmptyLists, Lists, and Options that contain children. This works as long as there the assignment of children in withNewChildren to the different constructor parameters can be inferred.

    Inferred assignment of new children is done as follows:

    • Traverse the constructor arguments from left to right
    • Always try to assign the next child in newChildren to a constructor parameter that is a child
    • For constructor parameters that are an Option of a child: Assign some next child in newChildren if the child type matches the element type of the Option, assign None otherwise.
    • For constructor parameters that are a List of children: Assign children from newChildren to the list until the type of a child does not match the element type of the list.

    It is possible to override the defaults and use custom children/withNewChildren implementations.

  2. case class BottomUp[T <: TreeNode[T]](rule: PartialFunction[T, T])(implicit evidence$5: ClassTag[T]) extends TreeRewriter[T] with Product with Serializable

    Permalink

    Applies the given partial function starting from the leaves of this tree.

  3. case class BottomUpStackSafe[T <: TreeNode[T]](partial: PartialFunction[T, T])(implicit evidence$1: ClassTag[T]) extends TreeTransformer[T, T] with SameTypeTransformerStackSafe[T] with Product with Serializable

    Permalink

    Applies the given partial function starting from the leafs of this tree.

    Applies the given partial function starting from the leafs of this tree.

    Note

    This is a stack-safe version of BottomUp.

  4. case class BottomUpWithContext[T <: TreeNode[T], C](rule: PartialFunction[(T, C), (T, C)])(implicit evidence$6: ClassTag[T]) extends TreeRewriterWithContext[T, C] with Product with Serializable

    Permalink

    Applies the given partial function starting from the leaves of this tree.

    Applies the given partial function starting from the leaves of this tree. An additional context is being recursively passed from the leftmost child to its siblings and eventually to its parent.

  5. case class Done[I <: TreeNode[I], O](transformedChildren: List[O]) extends TreeOperation[I, O] with Product with Serializable

    Permalink

    Represents a finished transformation during off-stack transformations.

  6. case class InvalidConstructorArgument(message: String, originalException: Option[Exception] = None) extends RuntimeException with Product with Serializable

    Permalink
  7. trait SameTypeTransformerStackSafe[T <: TreeNode[T]] extends TreeTransformer[T, T] with TransformerStackSafe[T, T]

    Permalink

    Common parent of BottomUpStackSafe and TopDownStackSafe

  8. case class TopDown[T <: TreeNode[T]](rule: PartialFunction[T, T])(implicit evidence$7: ClassTag[T]) extends TreeRewriter[T] with Product with Serializable

    Permalink

    Applies the given partial function starting from the root of this tree.

    Applies the given partial function starting from the root of this tree.

    Note

    Note the applied rule cannot insert new parent nodes.

  9. case class TopDownStackSafe[T <: TreeNode[T]](partial: PartialFunction[T, T])(implicit evidence$2: ClassTag[T]) extends TreeTransformer[T, T] with SameTypeTransformerStackSafe[T] with Product with Serializable

    Permalink

    Applies the given partial function starting from the root of this tree.

    Applies the given partial function starting from the root of this tree.

    Note

    This is a stack-safe version of TopDown.

    ,

    Note the applied rule cannot insert new parent nodes.

  10. case class Transform[I <: TreeNode[I], O](transform: (I, List[O]) ⇒ O)(implicit evidence$8: ClassTag[I]) extends TreeTransformer[I, O] with Product with Serializable

    Permalink

    Applies the given transformation starting from the leaves of this tree.

  11. case class TransformChildren[I <: TreeNode[I], O](node: I, transformedChildren: List[O] = List.empty[O]) extends TreeOperation[I, O] with Product with Serializable

    Permalink

    Represents a child transformation operation during off-stack transformations.

  12. case class TransformNode[I <: TreeNode[I], O](node: I, transformedChildren: List[O] = List.empty[O]) extends TreeOperation[I, O] with Product with Serializable

    Permalink

    Represents a node transformation operation during off-stack transformations.

  13. case class TransformStackSafe[I <: TreeNode[I], O](transform: (I, List[O]) ⇒ O)(implicit evidence$3: ClassTag[I]) extends TreeTransformer[I, O] with TransformerStackSafe[I, O] with Product with Serializable

    Permalink

    Applies the given transformation starting from the leaves of this tree.

    Applies the given transformation starting from the leaves of this tree.

    Note

    This is a stack-safe version of Transform.

  14. trait TransformerStackSafe[I <: TreeNode[I], O] extends TreeTransformer[I, O]

    Permalink

    This is the base-class for stack-safe tree transformations.

  15. abstract class TreeNode[T <: TreeNode[T]] extends Product with Traversable[T]

    Permalink

    This is the basic tree node class.

    This is the basic tree node class. Usually it makes more sense to use AbstractTreeNode, which uses reflection to generate the children and withNewChildren field/method. Our benchmarks show that manually implementing them can result in a speedup of a factor of ~3 for tree rewrites, so in performance critical places it might make sense to extend TreeNode instead.

    This class uses array operations instead of Scala collections, both for improved performance as well as to save stack frames during recursion, which allows it to operate on trees that are several thousand nodes high.

  16. sealed trait TreeOperation[T <: TreeNode[T], O] extends AnyRef

    Permalink

    Common trait of all classes that represent tree operations for off-stack transformations.

  17. abstract class TreeRewriter[T <: TreeNode[T]] extends TreeTransformer[T, T]

    Permalink
  18. abstract class TreeRewriterWithContext[T <: TreeNode[T], C] extends TreeTransformerWithContext[T, T, C]

    Permalink
  19. abstract class TreeTransformer[I <: TreeNode[I], O] extends AnyRef

    Permalink
  20. abstract class TreeTransformerWithContext[I <: TreeNode[I], O, C] extends AnyRef

    Permalink

Value Members

  1. object AbstractTreeNode

    Permalink

    Caches an instance of the copy method per case class type.

Ungrouped