Interface SelectionFilter<Solution_,T>
-
- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotationT- the selection type. On problems using multiple planning variables on a single entity without specifying single variable name, this needs to beObjectas variables of both types will be tested.
- All Known Implementing Classes:
MovableChainedTrailingValueFilter,PinEntityFilter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface SelectionFilter<Solution_,T>
Decides on accepting or discarding a selection, which is either aPlanningEntity, a planning value, aMoveor aSelector). For example, a pinnedPlanningEntityis rejected and therefore never used in aMove.A filtered selection is considered as not selected, it does not count as an unaccepted selection.
Implementations are expected to be stateless. The solver may choose to reuse instances.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaccept(ScoreDirector<Solution_> scoreDirector, T selection)static <Solution_,T>
SelectionFilter<Solution_,T>compose(SelectionFilter<Solution_,T>... filterArray)Creates aSelectionFilterwhich applies all the provided filters one after another.static <Solution_,T>
SelectionFilter<Solution_,T>compose(List<SelectionFilter<Solution_,T>> filterList)As defined bycompose(SelectionFilter[]).
-
-
-
Method Detail
-
compose
static <Solution_,T> SelectionFilter<Solution_,T> compose(SelectionFilter<Solution_,T>... filterArray)
Creates aSelectionFilterwhich applies all the provided filters one after another. Once one filter in the sequence returns false, no subsequent filers are evaluated.- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotationT- the selection type- Parameters:
filterArray- filters to apply, never null- Returns:
- never null
-
compose
static <Solution_,T> SelectionFilter<Solution_,T> compose(List<SelectionFilter<Solution_,T>> filterList)
As defined bycompose(SelectionFilter[]).
-
accept
boolean accept(ScoreDirector<Solution_> scoreDirector, T selection)
- Parameters:
scoreDirector- never null, theScoreDirectorwhich has theScoreDirector.getWorkingSolution()to which the selection belongs or applies toselection- never null, aPlanningEntity, a planningValue, aMoveor aSelector- Returns:
- true if the selection is accepted (for example it is movable), false if the selection will be discarded (for example it is pinned)
-
-