fn resolve_ties_require_all_different<Tally:Clone+Eq+Hash+Ord+Display+FromStr>(tied_candidates: &mut [CandidateIndex],transcript:  &Transcript<Tally>,just_consider_major_counts:bool) -> bool {
    for count in transcript.counts.iter().rev() {
        if count.reason_completed || !just_consider_major_counts {
            let mut observed = HashSet::new();
            for candidate in tied_candidates.iter() {
                observed.insert(count.status.tallies.candidate[candidate.0].clone());
            }
            if observed.len()==tied_candidates.len() { // All different!
                tied_candidates.sort_by_key(|candidate|count.status.tallies.candidate[candidate.0].clone());
                return true;
            }
        }
    }
    false
}
/// Sort candidates low to high based on some prior period when they each had a different tally.
/// Return true iff ties are resolved.
Sort candidates low to high based on some prior period when they each had a different tally.
Return true iff ties are resolved.
Sort candidates low to high based on some prior period when they each had a different tally . Return true iff ties are resolved .
fn resolve_ties_require_all_different<Tally:Clone+Eq+Hash+Ord+Display+FromStr>(tied_candidates: &mut [CandidateIndex],transcript:  &Transcript<Tally>,just_consider_major_counts:bool) -> bool {
    for count in transcript.counts.iter().rev() {
        if count.reason_completed || !just_consider_major_counts {
            let mut observed = HashSet::new();
            for candidate in tied_candidates.iter() {
                observed.insert(count.status.tallies.candidate[candidate.0].clone());
            }
            if observed.len()==tied_candidates.len() { // All different!
                tied_candidates.sort_by_key(|candidate|count.status.tallies.candidate[candidate.0].clone());
                return true;
            }
        }
    }
    false
}
fn resolve_ties_require_all_different < Tally : Clone + Eq + Hash + Ord + Display + FromStr > ( tied_candidates : & mut [ CandidateIndex ] , transcript : & Transcript < Tally > , just_consider_major_counts : bool ) -> bool { for count in transcript . counts . iter ( ) . rev ( ) { if count . reason_completed || ! just_consider_major_counts { let mut observed = HashSet :: new ( ) ; for candidate in tied_candidates . iter ( ) { observed . insert ( count . status . tallies . candidate [ candidate . 0 ] . clone ( ) ) ; } if observed . len ( ) == tied_candidates . len ( ) { // All different! tied_candidates . sort_by_key ( | candidate | count . status . tallies . candidate [ candidate . 0 ] . clone ( ) ) ; return true ; } } } false }
Sort candidates low to high based on some prior period when they each had a different tally.
Sort candidates low to high based on some prior period when they each had a different tally .
tied_candidates
&mut [CandidateIndex]
transcript
&Transcript<Tally>
just_consider_major_counts
bool
tied_candidates
&mut [CandidateIndex]
transcript
&Transcript<Tally>
just_consider_major_counts
bool