votes
    Preparing search index...

    Class Nanson<C>

    Type Parameters

    • C extends string

    Hierarchy

    • RoundBallotMethodTb<C>
      • Nanson
    Index

    Constructors

    • Type Parameters

      • C extends string

      Parameters

      • input: {
            ballots: Ballot<C>[];
            candidates: C[];
            tieBreakers?: TbEntry<C, AnyCtor<C>>[];
        }

      Returns Nanson<C>

    Properties

    ballots: Ballot<C>[]
    candidates: C[]
    isRandom: boolean = false
    needsBallot: true
    needsMatrix: boolean = false

    Accessors

    Methods

    • Returns C[][]

    • Result of the vote. The first item lists the winners of the vote.

      For example this ranking means that Bear wins, Sheep is second and Lion third [ [ 'Bear' ], [ 'Sheep' ], [ 'Lion' ] ]

      Returns C[][]

    • Apply tiebreakers sequentially to a set of tied candidates. Returns qualified survivors, eliminated losers, and a trace of each step. If unresolvable, all pending are returned as eliminated.

      Parameters

      • pending: C[]

      Returns { eliminated: C[]; qualified: C[]; tieBreakSteps: TieBreakStep<C>[] }

    • Return a new instance of the same method restricted to a subset of candidates. Ballots are filtered to remove candidates not in the subset; unranked candidates are NOT appended (preserves only opinions voters expressed).

      Type Parameters

      • D extends string

      Parameters

      • candidates: D[]

      Returns BallotMethod<D>

    • Type Parameters

      • D extends string

      Parameters

      • candidates: D[]

      Returns D[][]