public class Selector extends java.lang.Object implements ISelector
Modifier and Type | Field and Description |
---|---|
static int |
ALL
The constant for specifiying that all proposals should be chosen.
|
protected java.util.Comparator |
comp
The comparator for comparing proposals.
|
protected int |
max_winners
The max number of proposals to be chosen.
|
static int |
ONE
The constant for specifiying that one proposal should be chosen.
|
Constructor and Description |
---|
Selector()
Create a new selector.
|
Selector(java.util.Comparator comp)
Create a new selector.
|
Selector(java.util.Comparator comp,
int max_winners)
Create a new selector.
|
Selector(int max_winners)
Create a new selector.
|
Modifier and Type | Method and 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.
|
boolean |
isAcceptable(java.lang.Object proposal)
Test if a proposal is acceptable.
|
java.lang.Object[] |
select(java.lang.Object[] proposals)
Select proposals.
|
protected void |
sortProposals(java.lang.Object[] proposals)
Sort the proposals.
|
public static final int ALL
public static final int ONE
protected java.util.Comparator comp
protected int max_winners
public Selector()
public Selector(java.util.Comparator comp)
comp
- The optional comparator for sorting proposals.public Selector(int max_winners)
max_winners
- The number of proposals to be chosen at most.public Selector(java.util.Comparator comp, int max_winners)
comp
- The optional comparator for sorting proposals.max_winners
- The number of proposals to be chosen at most.public java.lang.Object[] select(java.lang.Object[] proposals)
protected java.lang.Object[] determineAcceptableProposals(java.lang.Object[] proposals)
proposals
- The proposals.protected void sortProposals(java.lang.Object[] proposals)
proposals
- The proposals to sort.protected java.lang.Object[] determineWinners(java.lang.Object[] proposals)
proposals
- The proposals.public boolean isAcceptable(java.lang.Object proposal)
proposal
- The proposal.