Class ServiceRankingDelegationResultListener<S>
- java.lang.Object
-
- jadex.commons.future.IntermediateDelegationResultListener<E>
-
- jadex.commons.future.TerminableIntermediateDelegationResultListener<S>
-
- jadex.bridge.nonfunctional.search.ServiceRankingDelegationResultListener<S>
-
- All Implemented Interfaces:
IFunctionalExceptionListener,IFunctionalIntermediateFinishedListener<S>,IFunctionalIntermediateResultCountListener,IFunctionalIntermediateResultListener<S>,IFunctionalResultListener<java.util.Collection<S>>,IFutureCommandResultListener<java.util.Collection<S>>,IIntermediateResultListener<S>,IResultListener<java.util.Collection<S>>,IUndoneIntermediateResultListener<S>,IUndoneResultListener<java.util.Collection<S>>
- Direct Known Subclasses:
ServiceRankingDelegationResultListener2
public class ServiceRankingDelegationResultListener<S> extends TerminableIntermediateDelegationResultListener<S>
Listener that ranks results.
-
-
Field Summary
Fields Modifier and Type Field Description protected IRankingSearchTerminationDecider<S>deciderThe termination decider.protected java.lang.BooleanfinishedThe listener state (false=unfinished, null=finishing, true=finished.protected IServiceRanker<S>rankerThe ranker.protected java.util.List<S>resultsThe saved results.-
Fields inherited from class jadex.commons.future.IntermediateDelegationResultListener
delegate, future, undone
-
-
Constructor Summary
Constructors Constructor Description ServiceRankingDelegationResultListener(TerminableIntermediateDelegationFuture<S> future, ITerminableIntermediateFuture<S> src, IServiceRanker<S> ranker, IRankingSearchTerminationDecider<S> decider)Create a new ranker.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcustomIntermediateResultAvailable(S result)Process intermediate results for ranking.voidcustomResultAvailable(java.util.Collection<S> result)Called when result is available.voidexceptionOccurred(java.lang.Exception exception)Called when exception occurs.voidfinished()Declare that the future is finished.booleanisFinished()Get the finished.booleanisFinishing()Get the finished.protected voidnotifyException(java.lang.Exception exception)protected voidnotifyResults(java.util.List<Tuple2<S,java.lang.Double>> results)protected voidrankResults()Rank the results and announce them-
Methods inherited from class jadex.commons.future.IntermediateDelegationResultListener
commandAvailable, exceptionOccurredIfUndone, finishedIfUndone, handleException, intermediateResultAvailable, intermediateResultAvailableIfUndone, maxResultCountAvailable, resultAvailable, resultAvailableIfUndone
-
-
-
-
Field Detail
-
results
protected java.util.List<S> results
The saved results.
-
finished
protected java.lang.Boolean finished
The listener state (false=unfinished, null=finishing, true=finished.
-
ranker
protected IServiceRanker<S> ranker
The ranker.
-
decider
protected IRankingSearchTerminationDecider<S> decider
The termination decider.
-
-
Constructor Detail
-
ServiceRankingDelegationResultListener
public ServiceRankingDelegationResultListener(TerminableIntermediateDelegationFuture<S> future, ITerminableIntermediateFuture<S> src, IServiceRanker<S> ranker, IRankingSearchTerminationDecider<S> decider)
Create a new ranker.
-
-
Method Detail
-
customIntermediateResultAvailable
public void customIntermediateResultAvailable(S result)
Process intermediate results for ranking.- Overrides:
customIntermediateResultAvailablein classIntermediateDelegationResultListener<S>- Parameters:
result- The result.
-
customResultAvailable
public void customResultAvailable(java.util.Collection<S> result)
Called when result is available.- Overrides:
customResultAvailablein classIntermediateDelegationResultListener<S>- Parameters:
result- The result.
-
exceptionOccurred
public void exceptionOccurred(java.lang.Exception exception)
Called when exception occurs.- Specified by:
exceptionOccurredin interfaceIFunctionalExceptionListener- Overrides:
exceptionOccurredin classIntermediateDelegationResultListener<S>- Parameters:
exception- The exception.
-
finished
public void finished()
Description copied from class:IntermediateDelegationResultListenerDeclare that the future is finished.- Specified by:
finishedin interfaceIFunctionalIntermediateFinishedListener<S>- Specified by:
finishedin interfaceIIntermediateResultListener<S>- Overrides:
finishedin classIntermediateDelegationResultListener<S>
-
isFinished
public boolean isFinished()
Get the finished.- Returns:
- The finished.
-
isFinishing
public boolean isFinishing()
Get the finished.- Returns:
- The finished.
-
rankResults
protected void rankResults()
Rank the results and announce them
-
notifyException
protected void notifyException(java.lang.Exception exception)
-
-