Class ServiceRankingResultListener<S>
- java.lang.Object
-
- jadex.bridge.nonfunctional.search.ServiceRankingResultListener<S>
-
- All Implemented Interfaces:
IFunctionalExceptionListener
,IFunctionalIntermediateFinishedListener<S>
,IFunctionalIntermediateResultListener<S>
,IFunctionalResultListener<java.util.Collection<S>>
,IIntermediateResultListener<S>
,IResultListener<java.util.Collection<S>>
public class ServiceRankingResultListener<S> extends java.lang.Object implements IIntermediateResultListener<S>
Listener that ranks results.
-
-
Field Summary
Fields Modifier and Type Field Description protected IRankingSearchTerminationDecider<S>
decider
The termination decider.protected boolean
finished
The listener state.protected IResultListener<java.util.Collection<S>>
listener
The delegate listener.protected IServiceRanker<S>
ranker
The ranker.protected java.util.List<S>
results
The saved results.protected IResultListener<java.util.Collection<Tuple2<S,java.lang.Double>>>
scorelistener
The delegate listener.
-
Constructor Summary
Constructors Constructor Description ServiceRankingResultListener(IServiceRanker<S> ranker, IRankingSearchTerminationDecider<S> decider, IResultListener<java.util.Collection<S>> listener)
Create a new ranker.ServiceRankingResultListener(IResultListener<java.util.Collection<Tuple2<S,java.lang.Double>>> scorelistener, IServiceRanker<S> ranker, IRankingSearchTerminationDecider<S> decider)
Create a new ranker.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
exceptionOccurred(java.lang.Exception exception)
Called when exception occurs.void
finished()
Declare that the future is finished.void
intermediateResultAvailable(S result)
Process intermediate results for ranking.boolean
isFinished()
Get the finished.protected void
notifyException(java.lang.Exception exception)
protected void
notifyResults(java.util.List<Tuple2<S,java.lang.Double>> results)
protected void
rankResults()
Rank the results and announce themvoid
resultAvailable(java.util.Collection<S> result)
Called when result is available.
-
-
-
Field Detail
-
results
protected java.util.List<S> results
The saved results.
-
finished
protected boolean finished
The listener state.
-
ranker
protected IServiceRanker<S> ranker
The ranker.
-
decider
protected IRankingSearchTerminationDecider<S> decider
The termination decider.
-
listener
protected IResultListener<java.util.Collection<S>> listener
The delegate listener.
-
scorelistener
protected IResultListener<java.util.Collection<Tuple2<S,java.lang.Double>>> scorelistener
The delegate listener.
-
-
Constructor Detail
-
ServiceRankingResultListener
public ServiceRankingResultListener(IServiceRanker<S> ranker, IRankingSearchTerminationDecider<S> decider, IResultListener<java.util.Collection<S>> listener)
Create a new ranker.
-
ServiceRankingResultListener
public ServiceRankingResultListener(IResultListener<java.util.Collection<Tuple2<S,java.lang.Double>>> scorelistener, IServiceRanker<S> ranker, IRankingSearchTerminationDecider<S> decider)
Create a new ranker.
-
-
Method Detail
-
intermediateResultAvailable
public void intermediateResultAvailable(S result)
Process intermediate results for ranking.- Specified by:
intermediateResultAvailable
in interfaceIFunctionalIntermediateResultListener<S>
- Specified by:
intermediateResultAvailable
in interfaceIIntermediateResultListener<S>
- Parameters:
result
- The result.
-
resultAvailable
public void resultAvailable(java.util.Collection<S> result)
Called when result is available.- Specified by:
resultAvailable
in interfaceIFunctionalResultListener<S>
- Parameters:
result
- The result.
-
exceptionOccurred
public void exceptionOccurred(java.lang.Exception exception)
Called when exception occurs.- Specified by:
exceptionOccurred
in interfaceIFunctionalExceptionListener
- Parameters:
exception
- The exception.
-
finished
public void finished()
Description copied from interface:IIntermediateResultListener
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:
finished
in interfaceIFunctionalIntermediateFinishedListener<S>
- Specified by:
finished
in interfaceIIntermediateResultListener<S>
-
isFinished
public boolean isFinished()
Get the finished.- Returns:
- The finished.
-
rankResults
protected void rankResults()
Rank the results and announce them
-
notifyException
protected void notifyException(java.lang.Exception exception)
-
-