pub fn resolve(&self, tied_candidates: &mut [CandidateIndex], granularity: TieResolutionGranularityNeeded) {
        for decision in &self.tie_resolutions {
            let deemed_order : Vec<CandidateIndex> = decision.iter().filter(|&c|tied_candidates.contains(c)).cloned().collect();
            if deemed_order.len()==tied_candidates.len() {
                tied_candidates.copy_from_slice(&deemed_order);
                return;
            }
            if granularity==TieResolutionGranularityNeeded::LowestSeparated(1) && decision.len()==2 && deemed_order.len()==2 {
                // This is sufficient. One will be excluded and this should not re-arise.
                let last = decision[0]; // this is least favoured candidate, so should go at the start of the list, which is in ascending order.
                let order_with_last_first = [last].into_iter().chain(tied_candidates.iter().cloned().filter(|&c|c!=last)).collect::<Vec<_>>();
                tied_candidates.copy_from_slice(&order_with_last_first);
                return;
            }
        }
        tied_candidates.sort_by_key(|c|c.0);
    }
/// Sort tied_candidates appropriately (low to high)
Sort tied_candidates appropriately (low to high)
Sort tied_candidates appropriately ( low to high )
pub fn resolve(&self, tied_candidates: &mut [CandidateIndex], granularity: TieResolutionGranularityNeeded) {
        for decision in &self.tie_resolutions {
            let deemed_order : Vec<CandidateIndex> = decision.iter().filter(|&c|tied_candidates.contains(c)).cloned().collect();
            if deemed_order.len()==tied_candidates.len() {
                tied_candidates.copy_from_slice(&deemed_order);
                return;
            }
            if granularity==TieResolutionGranularityNeeded::LowestSeparated(1) && decision.len()==2 && deemed_order.len()==2 {
                // This is sufficient. One will be excluded and this should not re-arise.
                let last = decision[0]; // this is least favoured candidate, so should go at the start of the list, which is in ascending order.
                let order_with_last_first = [last].into_iter().chain(tied_candidates.iter().cloned().filter(|&c|c!=last)).collect::<Vec<_>>();
                tied_candidates.copy_from_slice(&order_with_last_first);
                return;
            }
        }
        tied_candidates.sort_by_key(|c|c.0);
    }
pub fn resolve ( & self , tied_candidates : & mut [ CandidateIndex ] , granularity : TieResolutionGranularityNeeded ) { for decision in & self . tie_resolutions { let deemed_order : Vec < CandidateIndex > = decision . iter ( ) . filter ( | & c | tied_candidates . contains ( c ) ) . cloned ( ) . collect ( ) ; if deemed_order . len ( ) == tied_candidates . len ( ) { tied_candidates . copy_from_slice ( & deemed_order ) ; return ; } if granularity == TieResolutionGranularityNeeded :: LowestSeparated ( 1 ) && decision . len ( ) == 2 && deemed_order . len ( ) == 2 { // This is sufficient. One will be excluded and this should not re-arise. let last = decision [ 0 ] ; // this is least favoured candidate, so should go at the start of the list, which is in ascending order. let order_with_last_first = [ last ] . into_iter ( ) . chain ( tied_candidates . iter ( ) . cloned ( ) . filter ( | & c | c != last ) ) . collect :: < Vec < _ > > ( ) ; tied_candidates . copy_from_slice ( & order_with_last_first ) ; return ; } } tied_candidates . sort_by_key ( | c | c . 0 ) ; }
Sort tied_candidates appropriately (low to high)
Sort tied_candidates appropriately ( low to high )
&self
tied_candidates
&mut [CandidateIndex]
granularity
TieResolutionGranularityNeeded
&self
tied_candidates
&mut [CandidateIndex]
granularity
TieResolutionGranularityNeeded