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 boolean
Flag 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 TypeMethodDescriptionvoid
commandAvailable
(Object command) Called when a command is available.void
customIntermediateResultAvailable
(E result) Called when an intermediate result is available.void
customResultAvailable
(Collection<E> result) Called when the result is available.void
exceptionOccurred
(Exception exception) Called when an exception occurred.void
exceptionOccurredIfUndone
(Exception exception) Called when an exception occurred.void
finished()
Declare that the future is finished.void
Declare that the future is finished.protected void
Handle an exception.final void
intermediateResultAvailable
(E result) Called when an intermediate result is available.void
intermediateResultAvailableIfUndone
(E result) Called when an intermediate result is available.void
maxResultCountAvailable
(int max) Declare that the future result count is available.final void
resultAvailable
(Collection<E> result) Called when the result is available.void
resultAvailableIfUndone
(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:
resultAvailable
in interfaceIResultListener<E>
- Parameters:
result
- The result.
-
intermediateResultAvailable
Called when an intermediate result is available.- Specified by:
intermediateResultAvailable
in interfaceIIntermediateResultListener<E>
- Parameters:
result
- The result.
-
finished
public void finished()Declare that the future is finished.- Specified by:
finished
in interfaceIIntermediateResultListener<E>
-
customResultAvailable
Called when the result is available.- Parameters:
result
- The result.
-
exceptionOccurred
Called when an exception occurred.- Specified by:
exceptionOccurred
in 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:
maxResultCountAvailable
in interfaceIIntermediateResultListener<E>
-
commandAvailable
Called when a command is available.- Specified by:
commandAvailable
in interfaceIFutureCommandResultListener<E>
-
resultAvailableIfUndone
Called when the result is available.- Specified by:
resultAvailableIfUndone
in interfaceIUndoneResultListener<E>
- Parameters:
result
- The result.
-
exceptionOccurredIfUndone
Called when an exception occurred.- Specified by:
exceptionOccurredIfUndone
in interfaceIUndoneResultListener<E>
- Parameters:
exception
- The exception.
-
intermediateResultAvailableIfUndone
Called when an intermediate result is available.- Specified by:
intermediateResultAvailableIfUndone
in 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:
finishedIfUndone
in interfaceIUndoneIntermediateResultListener<E>
-
handleException
Handle an exception.
-