Class ExtendOperationExecutor<T>
java.lang.Object
tools.refinery.interpreter.localsearch.operations.ExtendOperationExecutor<T>
- All Implemented Interfaces:
ISearchOperation.ISearchOperationExecutor
- Direct Known Subclasses:
SingleValueExtendOperationExecutor
public abstract class ExtendOperationExecutor<T>
extends Object
implements ISearchOperation.ISearchOperationExecutor
An operation that can be used to enumerate all possible values for a single position based on a constraint
- Since:
- 2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidcleanup(MatchingFrame frame, ISearchContext context) Restores the frame to the state beforefillInValue(Object, MatchingFrame, ISearchContext).booleanexecute(MatchingFrame frame, ISearchContext context) Fixed version that handles failed unification of variables correctly.protected abstract booleanfillInValue(T newValue, MatchingFrame frame, ISearchContext context) Updates the frame with the next element of the iterator.getIterator(MatchingFrame frame, ISearchContext context) Returns an iterator with the possible options from the current statevoidonBacktrack(MatchingFrame frame, ISearchContext context) After the execution of the operation failed andISearchOperation.ISearchOperationExecutor.execute(MatchingFrame, ISearchContext)returns false, the onBacktrack callback is evaluated.voidonInitialize(MatchingFrame frame, ISearchContext context) During the execution of the corresponding plan, the onInitialize callback is evaluated before the execution of the operation may begin.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface tools.refinery.interpreter.localsearch.operations.ISearchOperation.ISearchOperationExecutor
getOperation
-
Constructor Details
-
ExtendOperationExecutor
public ExtendOperationExecutor()
-
-
Method Details
-
getIterator
Returns an iterator with the possible options from the current state- Since:
- 2.0
-
fillInValue
Updates the frame with the next element of the iterator. Called duringexecute(MatchingFrame, ISearchContext).- Returns:
- true if the update is successful or false otherwise; in case of false is returned, the next element should be taken from the iterator.
- Since:
- 2.0
-
cleanup
Restores the frame to the state beforefillInValue(Object, MatchingFrame, ISearchContext). Called duringonBacktrack(MatchingFrame, ISearchContext).- Since:
- 2.0
-
onInitialize
Description copied from interface:ISearchOperation.ISearchOperationExecutorDuring the execution of the corresponding plan, the onInitialize callback is evaluated before the execution of the operation may begin. Operations may use this method to initialize its internal data structures.- Specified by:
onInitializein interfaceISearchOperation.ISearchOperationExecutor
-
onBacktrack
Description copied from interface:ISearchOperation.ISearchOperationExecutorAfter the execution of the operation failed andISearchOperation.ISearchOperationExecutor.execute(MatchingFrame, ISearchContext)returns false, the onBacktrack callback is evaluated. Operations may use this method to clean up any temporary structures, and make the operation ready for a new execution.- Specified by:
onBacktrackin interfaceISearchOperation.ISearchOperationExecutor
-
execute
Fixed version that handles failed unification of variables correctly.- Specified by:
executein interfaceISearchOperation.ISearchOperationExecutor- Parameters:
frame- The matching frame to extend.context- The search context.- Returns:
trueif an extension was found,falseotherwise.
-