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 Summary
Modifier and Type Method Description static voidconsumeIf(GeneralFunction input, Consumer<? super GeneralFunction> consumer, Predicate<? super GeneralFunction> test)Applies the specified consumer recursively down the function tree for every node satisfying the teststatic booleanexistsAny(GeneralFunction input, Predicate<? super GeneralFunction> test)Returns true if anyGeneralFunctionin the function tree satisfiesteststatic booleanexistsExcluding(GeneralFunction input, Predicate<? super GeneralFunction> test, Predicate<? super GeneralFunction> exclude)Returns true if aGeneralFunctionin the function tree satisfiestest, excluding all functions on branches whose parent satisfiesexcludestatic booleanexistsInOppositeSurfaceSubset(CommutativeFunction input, Predicate<? super GeneralFunction> test, Predicate<? super GeneralFunction> excludeFromSubset)Checks if thisCommutativeFunctionhas a subset (as a new instance of its class), including empty and single-element functions, that: - Is the complement of a subset satisfyingexcludeFromSubset- Satisfiesteststatic booleanexistsInSurfaceSubset(CommutativeFunction input, Predicate<? super GeneralFunction> test)Checks if thisCommutativeFunctionhas a subset (as a new instance of its class) satisfyingtest, including empty and single-element functionsstatic booleanexistsSurface(GeneralFunction input, Predicate<? super GeneralFunction> test)Returns true if at least one direct child of thisGeneralFunctionsatisfiestest
-
Method Details
-
existsAny
Returns true if anyGeneralFunctionin the function tree satisfiestest- Parameters:
input- theGeneralFunctionto be searched intest- 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 aGeneralFunctionin the function tree satisfiestest, excluding all functions on branches whose parent satisfiesexclude- Parameters:
input- theGeneralFunctionto be searched intest- the predicate to be testedexclude- 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 thisGeneralFunctionsatisfiestest- Parameters:
input- the function to be searched intest- the predicate to be tested- Returns:
- true if found
-
existsInSurfaceSubset
public static boolean existsInSurfaceSubset(CommutativeFunction input, Predicate<? super GeneralFunction> test)Checks if thisCommutativeFunctionhas a subset (as a new instance of its class) satisfyingtest, including empty and single-element functions- Parameters:
input- theCommutativeFunctionto be searched intest- 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 thisCommutativeFunctionhas a subset (as a new instance of its class), including empty and single-element functions, that: - Is the complement of a subset satisfyingexcludeFromSubset- Satisfiestest- Parameters:
input- theCommutativeFunctionto be searched intest- the condition to be satisfiedexcludeFromSubset- 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- theGeneralFunctionto be recursively consumedconsumer- the consumertest- the test to be satisfied
-