Package jadex.future
Class IntermediateDelegationResultListener<E>
java.lang.Object
jadex.future.IntermediateDelegationResultListener<E>
- All Implemented Interfaces:
IFutureCommandResultListener<Collection<E>>,IIntermediateResultListener<E>,IResultListener<Collection<E>>,IUndoneIntermediateResultListener<E>,IUndoneResultListener<Collection<E>>
- Direct Known Subclasses:
DuplicateRemovalIntermediateResultListener
public class IntermediateDelegationResultListener<E>
extends Object
implements IFutureCommandResultListener<Collection<E>>, IUndoneIntermediateResultListener<E>
Intermediate version of the delegation result listener.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IIntermediateResultListener<E>Custom functional result listenerprotected IntermediateFuture<E>The future to which calls are delegated.protected booleanFlag if undone methods should be used. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new listener.IntermediateDelegationResultListener(IIntermediateResultListener<E> delegate, boolean undone) Create a new listener.Create a new listener.IntermediateDelegationResultListener(IntermediateFuture<E> future, boolean undone) Create a new listener. -
Method Summary
Modifier and TypeMethodDescriptionvoidcommandAvailable(Object command) Called when a command is available.voidcustomIntermediateResultAvailable(E result) Called when an intermediate result is available.voidcustomResultAvailable(Collection<E> result) Called when the result is available.voidexceptionOccurred(Exception exception) Called when an exception occurred.voidexceptionOccurredIfUndone(Exception exception) Called when an exception occurred.voidfinished()Declare that the future is finished.voidDeclare that the future is finished.protected voidHandle an exception.final voidintermediateResultAvailable(E result) Called when an intermediate result is available.voidintermediateResultAvailableIfUndone(E result) Called when an intermediate result is available.voidmaxResultCountAvailable(int max) Declare that the future result count is available.final voidresultAvailable(Collection<E> result) Called when the result is available.voidresultAvailableIfUndone(Collection<E> result) Called when the result is available.
-
Field Details
-
future
The future to which calls are delegated. -
undone
protected boolean undoneFlag if undone methods should be used. -
delegate
Custom functional result listener
-
-
Constructor Details
-
IntermediateDelegationResultListener
Create a new listener.- Parameters:
delegate- The delegation target.
-
IntermediateDelegationResultListener
public IntermediateDelegationResultListener(IIntermediateResultListener<E> delegate, boolean undone) Create a new listener.- Parameters:
delegate- The delegation target.undone- use undone methods.
-
IntermediateDelegationResultListener
Create a new listener.- Parameters:
future- The delegation target.
-
IntermediateDelegationResultListener
Create a new listener.- Parameters:
future- The delegation target.undone- use undone methods.
-
-
Method Details
-
resultAvailable
Called when the result is available.- Specified by:
resultAvailablein interfaceIResultListener<E>- Parameters:
result- The result.
-
intermediateResultAvailable
Called when an intermediate result is available.- Specified by:
intermediateResultAvailablein interfaceIIntermediateResultListener<E>- Parameters:
result- The result.
-
finished
public void finished()Declare that the future is finished.- Specified by:
finishedin interfaceIIntermediateResultListener<E>
-
customResultAvailable
Called when the result is available.- Parameters:
result- The result.
-
exceptionOccurred
Called when an exception occurred.- Specified by:
exceptionOccurredin interfaceIResultListener<E>- Parameters:
exception- The exception.
-
customIntermediateResultAvailable
Called when an intermediate result is available.- Parameters:
result- The result.
-
maxResultCountAvailable
public void maxResultCountAvailable(int max) Declare that the future result count is available. This method is only called for intermediate futures, i.e. when this method is called it is guaranteed that the intermediateResultAvailable method will be called as often as the result count indicates.- Specified by:
maxResultCountAvailablein interfaceIIntermediateResultListener<E>
-
commandAvailable
Called when a command is available.- Specified by:
commandAvailablein interfaceIFutureCommandResultListener<E>
-
resultAvailableIfUndone
Called when the result is available.- Specified by:
resultAvailableIfUndonein interfaceIUndoneResultListener<E>- Parameters:
result- The result.
-
exceptionOccurredIfUndone
Called when an exception occurred.- Specified by:
exceptionOccurredIfUndonein interfaceIUndoneResultListener<E>- Parameters:
exception- The exception.
-
intermediateResultAvailableIfUndone
Called when an intermediate result is available.- Specified by:
intermediateResultAvailableIfUndonein interfaceIUndoneIntermediateResultListener<E>- Parameters:
result- The result.
-
finishedIfUndone
public void finishedIfUndone()Declare that the future is finished. This method is only called for intermediate futures, i.e. when this method is called it is guaranteed that the intermediateResultAvailable method was called for all intermediate results before.- Specified by:
finishedIfUndonein interfaceIUndoneIntermediateResultListener<E>
-
handleException
Handle an exception.
-