pub fn new(data:&ElectionData,ineligible:&[CandidateIndex]) -> Self {
        let mut atl = vec![];
        for v in &data.atl {
            atl.push(RetroscopeVoteStatus{
                pile_status: PileStatus::InPile,
                count_arrived: CountIndex(0),
                upto: 0,
                prefs: v.parties.iter().flat_map(|p|data.metadata.party(*p).candidates.iter().map(|c|*c)).collect(),
            });
        }
        let mut btl = vec![];
        for v in &data.btl {
            btl.push(RetroscopeVoteStatus{
                pile_status: PileStatus::InPile,
                count_arrived: CountIndex(0),
                upto: 0,
                prefs: v.candidates.clone(),
            });
        }
        let mut piles_by_candidate = vec![];
        let mut continuing = HashSet::default();
        for c in 0..data.metadata.candidates.len() {
            piles_by_candidate.push(RetroscopeVotePileForCandidate::default() );
            if !ineligible.contains(&CandidateIndex(c)) {
                continuing.insert(CandidateIndex(c));
            }
        }
        Retroscope{
            votes: RetroscopeVotes{ atl, btl },
            continuing,
            elected: vec![],
            count: CountIndex(usize::MAX),
            transfer_values: vec![],
            piles_by_candidate,
        }
    }
/// make a new Retroscope for the provided data
make a new Retroscope for the provided data
make a new Retroscope for the provided data
pub fn new(data:&ElectionData,ineligible:&[CandidateIndex]) -> Self {
        let mut atl = vec![];
        for v in &data.atl {
            atl.push(RetroscopeVoteStatus{
                pile_status: PileStatus::InPile,
                count_arrived: CountIndex(0),
                upto: 0,
                prefs: v.parties.iter().flat_map(|p|data.metadata.party(*p).candidates.iter().map(|c|*c)).collect(),
            });
        }
        let mut btl = vec![];
        for v in &data.btl {
            btl.push(RetroscopeVoteStatus{
                pile_status: PileStatus::InPile,
                count_arrived: CountIndex(0),
                upto: 0,
                prefs: v.candidates.clone(),
            });
        }
        let mut piles_by_candidate = vec![];
        let mut continuing = HashSet::default();
        for c in 0..data.metadata.candidates.len() {
            piles_by_candidate.push(RetroscopeVotePileForCandidate::default() );
            if !ineligible.contains(&CandidateIndex(c)) {
                continuing.insert(CandidateIndex(c));
            }
        }
        Retroscope{
            votes: RetroscopeVotes{ atl, btl },
            continuing,
            elected: vec![],
            count: CountIndex(usize::MAX),
            transfer_values: vec![],
            piles_by_candidate,
        }
    }
pub fn new ( data : & ElectionData , ineligible : & [ CandidateIndex ] ) -> Self { let mut atl = vec ! [ ] ; for v in & data . atl { atl . push ( RetroscopeVoteStatus { pile_status : PileStatus :: InPile , count_arrived : CountIndex ( 0 ) , upto : 0 , prefs : v . parties . iter ( ) . flat_map ( | p | data . metadata . party ( * p ) . candidates . iter ( ) . map ( | c | * c ) ) . collect ( ) , } ) ; } let mut btl = vec ! [ ] ; for v in & data . btl { btl . push ( RetroscopeVoteStatus { pile_status : PileStatus :: InPile , count_arrived : CountIndex ( 0 ) , upto : 0 , prefs : v . candidates . clone ( ) , } ) ; } let mut piles_by_candidate = vec ! [ ] ; let mut continuing = HashSet :: default ( ) ; for c in 0 .. data . metadata . candidates . len ( ) { piles_by_candidate . push ( RetroscopeVotePileForCandidate :: default ( ) ) ; if ! ineligible . contains ( & CandidateIndex ( c ) ) { continuing . insert ( CandidateIndex ( c ) ) ; } } Retroscope { votes : RetroscopeVotes { atl , btl } , continuing , elected : vec ! [ ] , count : CountIndex ( usize :: MAX ) , transfer_values : vec ! [ ] , piles_by_candidate , } }
make a new Retroscope for the provided data
make a new Retroscope for the provided data
data
&ElectionData
ineligible
&[CandidateIndex]
data
&ElectionData
ineligible
&[CandidateIndex]