Package tools

Class SearchTools

Object
SearchTools

public class SearchTools
extends Object
The SearchTools class provides a set of methods that perform functions related to searching through with the contents in a function tree and performing actions on those functions.
  • Method Details

    • existsAny

      public static boolean existsAny​(GeneralFunction input, Predicate<? super GeneralFunction> test)
      Returns true if any GeneralFunction in the function tree satisfies test
      Parameters:
      input - the GeneralFunction to be searched in
      test - the predicate to be tested
      Returns:
      true if found
    • existsExcluding

      public static boolean existsExcluding​(GeneralFunction input, Predicate<? super GeneralFunction> test, Predicate<? super GeneralFunction> exclude)
      Returns true if a GeneralFunction in the function tree satisfies test, excluding all functions on branches whose parent satisfies exclude
      Parameters:
      input - the GeneralFunction to be searched in
      test - the predicate to be tested
      exclude - the predicate to be excluded
      Returns:
      true if found
    • existsSurface

      public static boolean existsSurface​(GeneralFunction input, Predicate<? super GeneralFunction> test)
      Returns true if at least one direct child of this GeneralFunction satisfies test
      Parameters:
      input - the function to be searched in
      test - the predicate to be tested
      Returns:
      true if found
    • existsInSurfaceSubset

      public static boolean existsInSurfaceSubset​(CommutativeFunction input, Predicate<? super GeneralFunction> test)
      Checks if this CommutativeFunction has a subset (as a new instance of its class) satisfying test, including empty and single-element functions
      Parameters:
      input - the CommutativeFunction to be searched in
      test - the condition to be satisfied
      Returns:
      true if the condition was satisfied by a subset
    • existsInOppositeSurfaceSubset

      public static boolean existsInOppositeSurfaceSubset​(CommutativeFunction input, Predicate<? super GeneralFunction> test, Predicate<? super GeneralFunction> excludeFromSubset)
      Checks if this CommutativeFunction has a subset (as a new instance of its class), including empty and single-element functions, that: - Is the complement of a subset satisfying excludeFromSubset - Satisfies test
      Parameters:
      input - the CommutativeFunction to be searched in
      test - the condition to be satisfied
      excludeFromSubset - the predicate for the subset that should be excluded
      Returns:
      true if the conditions above were satisfied by a subset of input
    • consumeIf

      public static void consumeIf​(GeneralFunction input, Consumer<? super GeneralFunction> consumer, Predicate<? super GeneralFunction> test)
      Applies the specified consumer recursively down the function tree for every node satisfying the test
      Parameters:
      input - the GeneralFunction to be recursively consumed
      consumer - the consumer
      test - the test to be satisfied