Interface ImmutableCompletePreference
-
- All Superinterfaces:
ImmutablePreference
,Preference
- All Known Subinterfaces:
ImmutableLinearPreference
- All Known Implementing Classes:
ImmutableCompletePreferenceImpl
,ImmutableLinearPreferenceImpl
public interface ImmutableCompletePreference extends ImmutablePreference
An immutable preference which represents a complete pre-order, also called a weak order. for each couple of alternatives (a,b) we can find an order a ≥ b or b ≥ a.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ImmutableList<ImmutableSet<Alternative>>
asEquivalenceClasses()
ImmutableSet<Alternative>
getAlternatives(int rank)
int
getRank(Alternative a)
The rank of an alternative is one plus the number of alternatives strictly preferred to it.-
Methods inherited from interface io.github.oliviercailloux.j_voting.preferences.ImmutablePreference
asGraph, getAlternatives
-
Methods inherited from interface io.github.oliviercailloux.j_voting.preferences.Preference
getVoter
-
-
-
-
Method Detail
-
getRank
int getRank(Alternative a)
The rank of an alternative is one plus the number of alternatives strictly preferred to it.- Parameters:
a
- is anAlternative
- Returns:
- the rank of this alternative (a number between 1 and n) where
n is the total number of
Alternative
instances. - Throws:
IllegalArgumentException
- if a is not contained in this preference
-
getAlternatives
ImmutableSet<Alternative> getAlternatives(int rank)
- Parameters:
rank
- at least 1.- Returns:
- the
Aternative
set at this rank. Empty set id there is no alternative at this rank. - Throws:
IllegalArgumentException
- if rank is less than one.
-
asEquivalenceClasses
ImmutableList<ImmutableSet<Alternative>> asEquivalenceClasses()
- Returns:
- Same data but in an Immutable list object A set of alternative is strictly prefered to next sets. All the alternatives in a set are considered ex-aequo.
-
-