
io.github.oliviercailloux.j_voting.preferences.ImmutableCompletePreference Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of j-voting Show documentation
Show all versions of j-voting Show documentation
General classes for dealing with social choice theory.
The newest version!
package io.github.oliviercailloux.j_voting.preferences;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import io.github.oliviercailloux.j_voting.Alternative;
/**
* 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.
*/
public interface ImmutableCompletePreference extends ImmutablePreference {
/**
* The rank of an alternative is one plus the number of alternatives strictly
* preferred to it.
*
* @param a is an Alternative
* @return 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
*/
public int getRank(Alternative a);
/**
*
* @param rank at least 1.
* @return the Aternative
set at this rank. Empty set id there is
* no alternative at this rank.
* @throws IllegalArgumentException if rank is less than one.
*/
public ImmutableSet getAlternatives(int rank);
/**
*
* @return 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.
*/
public ImmutableList> asEquivalenceClasses();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy