Package jadex.commons.future
Class IntermediateDelegationResultListener<E>
- java.lang.Object
-
- jadex.commons.future.IntermediateDelegationResultListener<E>
-
- All Implemented Interfaces:
IFutureCommandResultListener<java.util.Collection<E>>,IIntermediateResultListener<E>,IResultListener<java.util.Collection<E>>,IUndoneIntermediateResultListener<E>,IUndoneResultListener<java.util.Collection<E>>
- Direct Known Subclasses:
DuplicateRemovalIntermediateResultListener,TerminableIntermediateDelegationResultListener
public class IntermediateDelegationResultListener<E> extends java.lang.Object implements IIntermediateResultListener<E>, IFutureCommandResultListener<java.util.Collection<E>>, IUndoneIntermediateResultListener<E>
Intermediate version of the delegation result listener.
-
-
Field Summary
Fields Modifier and Type Field Description protected IIntermediateResultListener<E>delegateCustom functional result listenerprotected IntermediateFuture<E>futureThe future to which calls are delegated.protected booleanundoneFlag if undone methods should be used.
-
Constructor Summary
Constructors Constructor Description IntermediateDelegationResultListener(IIntermediateResultListener<E> delegate)Create a new listener.IntermediateDelegationResultListener(IIntermediateResultListener<E> delegate, boolean undone)Create a new listener.IntermediateDelegationResultListener(IntermediateFuture<E> future)Create a new listener.IntermediateDelegationResultListener(IntermediateFuture<E> future, boolean undone)Create a new listener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommandAvailable(java.lang.Object command)Called when a command is available.voidcustomIntermediateResultAvailable(E result)Called when an intermediate result is available.voidcustomResultAvailable(java.util.Collection<E> result)Called when the result is available.voidexceptionOccurred(java.lang.Exception exception)Called when an exception occurred.voidexceptionOccurredIfUndone(java.lang.Exception exception)Called when an exception occurred.voidfinished()Declare that the future is finished.voidfinishedIfUndone()Declare that the future is finished.protected voidhandleException(java.lang.Exception e)Handle an exception.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.voidresultAvailable(java.util.Collection<E> result)Called when the result is available.voidresultAvailableIfUndone(java.util.Collection<E> result)Called when the result is available.
-
-
-
Field Detail
-
future
protected IntermediateFuture<E> future
The future to which calls are delegated.
-
undone
protected boolean undone
Flag if undone methods should be used.
-
delegate
protected IIntermediateResultListener<E> delegate
Custom functional result listener
-
-
Constructor Detail
-
IntermediateDelegationResultListener
public IntermediateDelegationResultListener(IIntermediateResultListener<E> delegate)
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
public IntermediateDelegationResultListener(IntermediateFuture<E> future)
Create a new listener.- Parameters:
future- The delegation target.
-
IntermediateDelegationResultListener
public IntermediateDelegationResultListener(IntermediateFuture<E> future, boolean undone)
Create a new listener.- Parameters:
future- The delegation target.undone- use undone methods.
-
-
Method Detail
-
resultAvailable
public final void resultAvailable(java.util.Collection<E> result)
Called when the result is available.- Specified by:
resultAvailablein interfaceIResultListener<E>- Parameters:
result- The result.
-
intermediateResultAvailable
public final void intermediateResultAvailable(E result)
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
public void customResultAvailable(java.util.Collection<E> result)
Called when the result is available.- Parameters:
result- The result.
-
exceptionOccurred
public void exceptionOccurred(java.lang.Exception exception)
Called when an exception occurred.- Specified by:
exceptionOccurredin interfaceIResultListener<E>- Parameters:
exception- The exception.
-
customIntermediateResultAvailable
public void customIntermediateResultAvailable(E result)
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
public void commandAvailable(java.lang.Object command)
Called when a command is available.- Specified by:
commandAvailablein interfaceIFutureCommandResultListener<E>
-
resultAvailableIfUndone
public void resultAvailableIfUndone(java.util.Collection<E> result)
Called when the result is available.- Specified by:
resultAvailableIfUndonein interfaceIUndoneResultListener<E>- Parameters:
result- The result.
-
exceptionOccurredIfUndone
public void exceptionOccurredIfUndone(java.lang.Exception exception)
Called when an exception occurred.- Specified by:
exceptionOccurredIfUndonein interfaceIUndoneResultListener<E>- Parameters:
exception- The exception.
-
intermediateResultAvailableIfUndone
public void intermediateResultAvailableIfUndone(E result)
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
protected void handleException(java.lang.Exception e)
Handle an exception.
-
-