public class CounterResultListener<E> extends java.lang.Object implements IResultListener<E>, IUndoneResultListener<E>
| Modifier and Type | Field and Description |
|---|---|
protected int |
cnt
The number of received callbacks.
|
protected IResultListener<java.lang.Void> |
delegate
The delegate result listener.
|
protected boolean |
ignorefailures
The ignore failure flag.
|
protected IFunctionalResultListener<E> |
intermediateResultListener
Listener that is called on intermediate results.
|
protected boolean |
notified
Flag to indicate that the delegate already has been notified.
|
protected int |
num
The number of sub listeners to wait for.
|
protected boolean |
undone
The undone flag.
|
| Constructor and Description |
|---|
CounterResultListener(int num,
boolean ignorefailures,
IFunctionalResultListener<java.lang.Void> countReachedListener)
Create a new counter listener.
|
CounterResultListener(int num,
boolean ignorefailures,
IFunctionalResultListener<java.lang.Void> countReachedListener,
IFunctionalExceptionListener exListener)
Create a new counter listener.
|
CounterResultListener(int num,
boolean ignorefailures,
IFunctionalResultListener<java.lang.Void> countReachedListener,
IFunctionalResultListener<E> intermediateResultListener,
IFunctionalExceptionListener exListener)
Create a new counter listener.
|
CounterResultListener(int num,
boolean ignorefailures,
IResultListener<java.lang.Void> delegate)
Create a new counter listener.
|
CounterResultListener(int num,
IFunctionalResultListener<java.lang.Void> countReachedListener)
Create a new counter listener.
|
CounterResultListener(int num,
IFunctionalResultListener<java.lang.Void> countReachedListener,
IFunctionalExceptionListener exListener)
Create a new counter listener.
|
CounterResultListener(int num,
IFunctionalResultListener<java.lang.Void> countReachedListener,
IFunctionalResultListener<E> intermediateResultListener,
IFunctionalExceptionListener exListener)
Create a new counter listener.
|
CounterResultListener(int num,
IResultListener<java.lang.Void> delegate)
Create a new counter listener.
|
| Modifier and Type | Method and Description |
|---|---|
void |
exceptionOccurred(java.lang.Exception exception)
Called when an exception occurred.
|
void |
exceptionOccurredIfUndone(java.lang.Exception exception)
Called when an exception occurred.
|
int |
getCnt()
Get the current number of received results.
|
int |
getNumber()
Get the number of results this Listener is waiting for.
|
boolean |
intermediateExceptionOccurred(java.lang.Exception exception)
Method that can be overridden to do sth.
|
void |
intermediateResultAvailable(E result)
Method that can be overridden to do sth.
|
boolean |
isUndone()
Get the undone.
|
void |
resultAvailable(E result)
Called when the result is available.
|
void |
resultAvailableIfUndone(E result)
Called when the result is available.
|
void |
setNumber(int num)
Set the number.
|
protected int num
protected int cnt
protected IResultListener<java.lang.Void> delegate
protected boolean notified
protected boolean ignorefailures
protected boolean undone
protected IFunctionalResultListener<E> intermediateResultListener
public CounterResultListener(int num,
IFunctionalResultListener<java.lang.Void> countReachedListener)
num - The number of sub callbacks.countReachedListener - Functional listener called when the count is
reached.public CounterResultListener(int num,
IFunctionalResultListener<java.lang.Void> countReachedListener,
IFunctionalExceptionListener exListener)
num - The number of sub callbacks.countReachedListener - Functional listener called when the count is
reached.exListener - The listener that is called on exceptions. Passing
null enables default exception logging.public CounterResultListener(int num,
IFunctionalResultListener<java.lang.Void> countReachedListener,
IFunctionalResultListener<E> intermediateResultListener,
IFunctionalExceptionListener exListener)
num - The number of sub callbacks.countReachedListener - Functional listener called when the count is
reached.intermediateResultListener - Functional listener called on
intermediate results.exListener - The listener that is called on exceptions. Passing
null enables default exception logging.public CounterResultListener(int num,
IResultListener<java.lang.Void> delegate)
num - The number of sub callbacks.public CounterResultListener(int num,
boolean ignorefailures,
IFunctionalResultListener<java.lang.Void> countReachedListener)
num - The number of sub callbacks.ignorefailures - Flag whether to ignore failures.countReachedListener - Functional listener called when the count is
reached.public CounterResultListener(int num,
boolean ignorefailures,
IFunctionalResultListener<java.lang.Void> countReachedListener,
IFunctionalExceptionListener exListener)
num - The number of sub callbacks.ignorefailures - Flag whether to ignore failures.countReachedListener - Functional listener called when the count is
reached.exListener - The listener that is called on exceptions. Passing
null enables default exception logging.public CounterResultListener(int num,
boolean ignorefailures,
IFunctionalResultListener<java.lang.Void> countReachedListener,
IFunctionalResultListener<E> intermediateResultListener,
IFunctionalExceptionListener exListener)
num - The number of sub callbacks.ignorefailures - Flag whether to ignore failures.countReachedListener - Functional listener called when the count is
reached.intermediateResultListener - Functional listener called on
intermediate results, can be null.exListener - The listener that is called on exceptions. Passing
null enables default exception logging.public CounterResultListener(int num,
boolean ignorefailures,
IResultListener<java.lang.Void> delegate)
num - The number of sub callbacks.public void resultAvailable(E result)
resultAvailable in interface IFunctionalResultListener<E>result - The result.public void exceptionOccurred(java.lang.Exception exception)
exceptionOccurred in interface IFunctionalExceptionListenerexception - The exception.public void intermediateResultAvailable(E result)
public boolean intermediateExceptionOccurred(java.lang.Exception exception)
public int getNumber()
public void setNumber(int num)
num - The number.public int getCnt()
public void resultAvailableIfUndone(E result)
resultAvailableIfUndone in interface IUndoneResultListener<E>result - The result.public void exceptionOccurredIfUndone(java.lang.Exception exception)
exceptionOccurredIfUndone in interface IUndoneResultListener<E>exception - The exception.public boolean isUndone()