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 Details

    • 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 Details

    • 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 Details

    • resultAvailable

      public final void resultAvailable(Collection<E> result)
      Called when the result is available.
      Specified by:
      resultAvailable in interface IResultListener<E>
      Parameters:
      result - The result.
    • intermediateResultAvailable

      public final void intermediateResultAvailable(E result)
      Called when an intermediate result is available.
      Specified by:
      intermediateResultAvailable in interface IIntermediateResultListener<E>
      Parameters:
      result - The result.
    • finished

      public void finished()
      Declare that the future is finished.
      Specified by:
      finished in interface IIntermediateResultListener<E>
    • customResultAvailable

      public void customResultAvailable(Collection<E> result)
      Called when the result is available.
      Parameters:
      result - The result.
    • exceptionOccurred

      public void exceptionOccurred(Exception exception)
      Called when an exception occurred.
      Specified by:
      exceptionOccurred in interface IResultListener<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:
      maxResultCountAvailable in interface IIntermediateResultListener<E>
    • commandAvailable

      public void commandAvailable(Object command)
      Called when a command is available.
      Specified by:
      commandAvailable in interface IFutureCommandResultListener<E>
    • resultAvailableIfUndone

      public void resultAvailableIfUndone(Collection<E> result)
      Called when the result is available.
      Specified by:
      resultAvailableIfUndone in interface IUndoneResultListener<E>
      Parameters:
      result - The result.
    • exceptionOccurredIfUndone

      public void exceptionOccurredIfUndone(Exception exception)
      Called when an exception occurred.
      Specified by:
      exceptionOccurredIfUndone in interface IUndoneResultListener<E>
      Parameters:
      exception - The exception.
    • intermediateResultAvailableIfUndone

      public void intermediateResultAvailableIfUndone(E result)
      Called when an intermediate result is available.
      Specified by:
      intermediateResultAvailableIfUndone in interface IUndoneIntermediateResultListener<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 interface IUndoneIntermediateResultListener<E>
    • handleException

      protected void handleException(Exception e)
      Handle an exception.