Class TypePredicate

  • All Implemented Interfaces:
    java.util.function.Predicate<NodeState>

    public class TypePredicate
    extends java.lang.Object
    implements java.util.function.Predicate<NodeState>
    Inheritance-aware node type predicate for node states.
    Since:
    Oak 0.11
    • 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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static @NotNull TypePredicate isOrderable​(@NotNull NodeState root)  
      boolean test​(@Nullable Tree input)  
      boolean test​(@Nullable NodeState input)  
      boolean test​(java.lang.String primary, java.util.Set<java.lang.String> mixins)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.function.Predicate

        and, negate, or
    • 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>
      • toString

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