Package jadex.bdi.planlib.protocols
Class Selector
- java.lang.Object
- 
- jadex.bdi.planlib.protocols.Selector
 
- 
- All Implemented Interfaces:
- ISelector
 
 public class Selector extends java.lang.Object implements ISelector Default selector implementation for evaluating a set of proposals. The proposals will be first tested on acceptability. In the second (optional) step they will be sorted according to the specified comparator/comparable. In the third step a (sub)set will be filtered out according to the specified number chooseable of resuls (choose).
- 
- 
Field SummaryFields Modifier and Type Field Description static intALLThe constant for specifiying that all proposals should be chosen.protected java.util.ComparatorcompThe comparator for comparing proposals.protected intmax_winnersThe max number of proposals to be chosen.static intONEThe constant for specifiying that one proposal should be chosen.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object[]determineAcceptableProposals(java.lang.Object[] proposals)Get all acceptable proposals.protected java.lang.Object[]determineWinners(java.lang.Object[] proposals)Select proposals.booleanisAcceptable(java.lang.Object proposal)Test if a proposal is acceptable.java.lang.Object[]select(java.lang.Object[] proposals)Select proposals.protected voidsortProposals(java.lang.Object[] proposals)Sort the proposals.
 
- 
- 
- 
Field Detail- 
ALLpublic static final int ALL The constant for specifiying that all proposals should be chosen.- See Also:
- Constant Field Values
 
 - 
ONEpublic static final int ONE The constant for specifiying that one proposal should be chosen.- See Also:
- Constant Field Values
 
 - 
compprotected java.util.Comparator comp The comparator for comparing proposals.
 - 
max_winnersprotected int max_winners The max number of proposals to be chosen.
 
- 
 - 
Constructor Detail- 
Selectorpublic Selector() Create a new selector.
 - 
Selectorpublic Selector(java.util.Comparator comp) Create a new selector.- Parameters:
- comp- The optional comparator for sorting proposals.
 
 - 
Selectorpublic Selector(int max_winners) Create a new selector.- Parameters:
- max_winners- The number of proposals to be chosen at most.
 
 - 
Selectorpublic Selector(java.util.Comparator comp, int max_winners)Create a new selector.- Parameters:
- comp- The optional comparator for sorting proposals.
- max_winners- The number of proposals to be chosen at most.
 
 
- 
 - 
Method Detail- 
selectpublic java.lang.Object[] select(java.lang.Object[] proposals) Select proposals.
 - 
determineAcceptableProposalsprotected java.lang.Object[] determineAcceptableProposals(java.lang.Object[] proposals) Get all acceptable proposals.- Parameters:
- proposals- The proposals.
- Returns:
- The acceptable proposals.
 
 - 
sortProposalsprotected void sortProposals(java.lang.Object[] proposals) Sort the proposals.- Parameters:
- proposals- The proposals to sort.
 
 - 
determineWinnersprotected java.lang.Object[] determineWinners(java.lang.Object[] proposals) Select proposals.- Parameters:
- proposals- The proposals.
- Returns:
- The selected proposals.
 
 - 
isAcceptablepublic boolean isAcceptable(java.lang.Object proposal) Test if a proposal is acceptable.- Parameters:
- proposal- The proposal.
- Returns:
- True, if proposal is acceptable.
 
 
- 
 
-