Interface MatcherInterface

  • All Known Implementing Classes:
    MatcherInterface.Matcher

    public interface MatcherInterface
    This interface is used to test if a specified (source) tree matches a predefined target tree. Some kind of abstraction can be used by means of special nodes.
    Author:
    Christophe Lecoutre
    • Method Detail

      • target

        XNode<IVar> target()
        Returns the target tree, which may possibly involve some form of abstraction by means of special nodes.
        Returns:
        the target tree
      • validForSpecialTargetNode

        boolean validForSpecialTargetNode​(XNode<? extends IVar> node,
                                          int level)
        Returns true if the specified node (considered at the specified level/depth) is valid with respect to the target tree when assuming that the corresponding node in the target tree is a special node.
        Parameters:
        node - a (source) node
        level - the level/depth associated with the node
        Returns:
        true if the specified source node is valid with respect to a corresponding special node in the target tree
      • matching

        default boolean matching​(XNode<? extends IVar> source,
                                 XNode<IVar> target,
                                 int level)
        Returns true if the specified source tree matches the specified target tree (at the specified level).
        Parameters:
        source - the source (sub-)tree
        target - the target (sub-)tree
        level - the level/depth for the comparison
        Returns:
        true if the specified source tree matches the specified target tree
      • matches

        default boolean matches​(XNode<? extends IVar> tree)
        Returns true if the predefined target tree matches the specified (source) tree.
        Parameters:
        tree - a tree
        Returns:
        true if the predefined target tree matches the specified (source) tree