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 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 teststatic boolean
existsAny(GeneralFunction input, Predicate<? super GeneralFunction> test)
Returns true if anyGeneralFunction
in the function tree satisfiestest
static boolean
existsExcluding(GeneralFunction input, Predicate<? super GeneralFunction> test, Predicate<? super GeneralFunction> exclude)
Returns true if aGeneralFunction
in the function tree satisfiestest
, excluding all functions on branches whose parent satisfiesexclude
static boolean
existsInOppositeSurfaceSubset(CommutativeFunction input, Predicate<? super GeneralFunction> test, Predicate<? super GeneralFunction> excludeFromSubset)
Checks if thisCommutativeFunction
has a subset (as a new instance of its class), including empty and single-element functions, that: - Is the complement of a subset satisfyingexcludeFromSubset
- Satisfiestest
static boolean
existsInSurfaceSubset(CommutativeFunction input, Predicate<? super GeneralFunction> test)
Checks if thisCommutativeFunction
has a subset (as a new instance of its class) satisfyingtest
, including empty and single-element functionsstatic boolean
existsSurface(GeneralFunction input, Predicate<? super GeneralFunction> test)
Returns true if at least one direct child of thisGeneralFunction
satisfiestest
-
Method Details
-
existsAny
Returns true if anyGeneralFunction
in the function tree satisfiestest
- Parameters:
input
- theGeneralFunction
to 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 aGeneralFunction
in the function tree satisfiestest
, excluding all functions on branches whose parent satisfiesexclude
- Parameters:
input
- theGeneralFunction
to 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 thisGeneralFunction
satisfiestest
- 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 thisCommutativeFunction
has a subset (as a new instance of its class) satisfyingtest
, including empty and single-element functions- Parameters:
input
- theCommutativeFunction
to 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 thisCommutativeFunction
has 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
- theCommutativeFunction
to 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
- theGeneralFunction
to be recursively consumedconsumer
- the consumertest
- the test to be satisfied
-