Package jadex.commons.future
Class IntermediateDelegationResultListener<E>
- java.lang.Object
-
- jadex.commons.future.IntermediateDelegationResultListener<E>
-
- All Implemented Interfaces:
IFunctionalExceptionListener
,IFunctionalIntermediateFinishedListener<E>
,IFunctionalIntermediateResultCountListener
,IFunctionalIntermediateResultListener<E>
,IFunctionalResultListener<java.util.Collection<E>>
,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 IFunctionalIntermediateResultListener<E>
cirlistener
Custom functional intermediate result listenerprotected IFunctionalIntermediateResultCountListener
clistener
Custom functional result count listener.protected IFunctionalResultListener<java.util.Collection<E>>
crlistener
Custom functional result listenerprotected IIntermediateResultListener<E>
delegate
Custom functional result listenerprotected IntermediateFuture<E>
future
The future to which calls are delegated.protected boolean
undone
Flag 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.IntermediateDelegationResultListener(IntermediateFuture<E> future, boolean undone, IFunctionalResultListener<java.util.Collection<E>> crlistener, IFunctionalIntermediateResultListener<E> cirlistener, IFunctionalIntermediateResultCountListener clistener)
Create a new listener.IntermediateDelegationResultListener(IntermediateFuture<E> future, IFunctionalResultListener<java.util.Collection<E>> crlistener, IFunctionalIntermediateResultListener<E> cirlistener, IFunctionalIntermediateResultCountListener clistener)
Create a new listener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
commandAvailable(java.lang.Object command)
Called when a command is available.void
customIntermediateResultAvailable(E result)
Called when an intermediate result is available.void
customResultAvailable(java.util.Collection<E> result)
Called when the result is available.void
exceptionOccurred(java.lang.Exception exception)
Called when an exception occurred.void
exceptionOccurredIfUndone(java.lang.Exception exception)
Called when an exception occurred.void
finished()
Declare that the future is finished.void
finishedIfUndone()
Declare that the future is finished.protected void
handleException(java.lang.Exception e)
Handle an exception.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.void
resultAvailable(java.util.Collection<E> result)
Called when the result is available.void
resultAvailableIfUndone(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
-
crlistener
protected IFunctionalResultListener<java.util.Collection<E>> crlistener
Custom functional result listener
-
cirlistener
protected IFunctionalIntermediateResultListener<E> cirlistener
Custom functional intermediate result listener
-
clistener
protected IFunctionalIntermediateResultCountListener clistener
Custom functional result count 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, IFunctionalResultListener<java.util.Collection<E>> crlistener, IFunctionalIntermediateResultListener<E> cirlistener, IFunctionalIntermediateResultCountListener clistener)
Create a new listener.- Parameters:
future
- The delegation target.crlistener
- Custom result listener that overwrites the delegation behaviour.cirlistener
- Custom intermediate result listener that overwrites the delegation behaviour.
-
IntermediateDelegationResultListener
public IntermediateDelegationResultListener(IntermediateFuture<E> future, boolean undone)
Create a new listener.- Parameters:
future
- The delegation target.undone
- use undone methods.
-
IntermediateDelegationResultListener
public IntermediateDelegationResultListener(IntermediateFuture<E> future, boolean undone, IFunctionalResultListener<java.util.Collection<E>> crlistener, IFunctionalIntermediateResultListener<E> cirlistener, IFunctionalIntermediateResultCountListener clistener)
Create a new listener.- Parameters:
future
- The delegation target.undone
- use undone methods.crlistener
- Custom result listener that overwrites the delegation behaviour.cirlistener
- Custom intermediate result listener that overwrites the delegation behaviour.
-
-
Method Detail
-
resultAvailable
public final void resultAvailable(java.util.Collection<E> result)
Called when the result is available.- Specified by:
resultAvailable
in interfaceIFunctionalResultListener<E>
- Parameters:
result
- The result.
-
intermediateResultAvailable
public final void intermediateResultAvailable(E result)
Called when an intermediate result is available.- Specified by:
intermediateResultAvailable
in interfaceIFunctionalIntermediateResultListener<E>
- Specified by:
intermediateResultAvailable
in interfaceIIntermediateResultListener<E>
- Parameters:
result
- The result.
-
finished
public void finished()
Declare that the future is finished.- Specified by:
finished
in interfaceIFunctionalIntermediateFinishedListener<E>
- Specified by:
finished
in 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:
exceptionOccurred
in interfaceIFunctionalExceptionListener
- 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:
maxResultCountAvailable
in interfaceIFunctionalIntermediateResultCountListener
- Specified by:
maxResultCountAvailable
in interfaceIIntermediateResultListener<E>
-
commandAvailable
public void commandAvailable(java.lang.Object command)
Called when a command is available.- Specified by:
commandAvailable
in interfaceIFutureCommandResultListener<E>
-
resultAvailableIfUndone
public void resultAvailableIfUndone(java.util.Collection<E> result)
Called when the result is available.- Specified by:
resultAvailableIfUndone
in interfaceIUndoneResultListener<E>
- Parameters:
result
- The result.
-
exceptionOccurredIfUndone
public void exceptionOccurredIfUndone(java.lang.Exception exception)
Called when an exception occurred.- Specified by:
exceptionOccurredIfUndone
in interfaceIUndoneResultListener<E>
- Parameters:
exception
- The exception.
-
intermediateResultAvailableIfUndone
public void intermediateResultAvailableIfUndone(E result)
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
protected void handleException(java.lang.Exception e)
Handle an exception.
-
-