Class TypePredicate

    • Constructor Summary

      Constructors 
      Constructor Description
      TypePredicate​(@NotNull NodeState root, @NotNull java.lang.Iterable<java.lang.String> names)
      Creates a predicate for checking whether a node state is an instance of any of the named node types.
      TypePredicate​(@NotNull NodeState root, @NotNull java.lang.String name)
      Creates a predicate for checking whether a node state is an instance of the named node type.
      TypePredicate​(@NotNull NodeState root, @NotNull java.lang.String[] names)
      Creates a predicate for checking whether a node state is an instance of any of the named node types.
    • Constructor Detail

      • TypePredicate

        public TypePredicate​(@NotNull
                             @NotNull NodeState root,
                             @NotNull
                             @NotNull java.lang.String name)
        Creates a predicate for checking whether a node state is an instance of the named node type. This is an O(1) operation in terms of item accesses.
        Parameters:
        root - root node state
        name - Oak name of the node type to check for
      • TypePredicate

        public TypePredicate​(@NotNull
                             @NotNull NodeState root,
                             @NotNull
                             @NotNull java.lang.Iterable<java.lang.String> names)
        Creates a predicate for checking whether a node state is an instance of any of the named node types. This is an O(n) operation in terms of item accesses, with n being the number of given node types.
        Parameters:
        root - root node state
        names - Oak names of the node types to check for
      • TypePredicate

        public TypePredicate​(@NotNull
                             @NotNull NodeState root,
                             @NotNull
                             @NotNull java.lang.String[] names)
        Creates a predicate for checking whether a node state is an instance of any of the named node types. This is an O(n) operation in terms of item accesses, with n being the number of given node types.
        Parameters:
        root - root node state
        names - Oak names of the node types to check for
    • Method Detail

      • isOrderable

        @NotNull
        public static @NotNull TypePredicate isOrderable​(@NotNull
                                                         @NotNull NodeState root)
      • test

        public boolean test​(java.lang.String primary,
                            java.util.Set<java.lang.String> mixins)
      • test

        public boolean test​(@Nullable
                            @Nullable Tree input)
      • test

        public boolean test​(@Nullable
                            @Nullable NodeState input)
        Specified by:
        test in interface java.util.function.Predicate<NodeState>
      • apply

        @Deprecated
        public boolean apply​(@Nullable
                             @Nullable NodeState input)
        Deprecated.
        use test(NodeState) instead (see OAK-8874)
        Description copied from interface: Predicate
        Returns the result of applying this predicate to input. This method is generally expected, but not absolutely required, to have the following properties:
        • Its execution does not cause any observable side effects.
        • The computation is consistent with equals; that is, Objects.equal(a, b) implies that predicate.apply(a) == predicate.apply(b)).
        Specified by:
        apply in interface Predicate<NodeState>
      • apply

        @Deprecated
        public boolean apply​(@Nullable
                             @Nullable Tree input)
        Deprecated.
        use test(Tree) instead (see OAK-8874)
      • apply

        @Deprecated
        public boolean apply​(java.lang.String primary,
                             java.util.Set<java.lang.String> mixins)
        Deprecated.
        use test(String, Set) instead (see OAK-8874)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object