/// <summary> /// Please implement this method to return a deep clone of the current object /// </summary> /// <returns></returns> public Ballot GetClone() { Ballot b = new Ballot(ID, Candidates); b.Voter = Voter; b.Choice = Choice; b.ScannedCandidate = ScannedCandidate; return b; }
public BallotCollection(int voterNo, int candidateNo, Ballot[] ballots, Voter[] voters) { VotersNo = voterNo; CandidatesNo = candidateNo; Ballots = new Ballot[voterNo]; Voters = new Voter[voterNo]; for (int i = 0; i < VotersNo; i++) { Ballots[i] = ballots[i].GetClone(); Voters[i] = voters[i].GetClone(); } }
public BallotCollection(int voterNo, int candidateNo) { VotersNo = voterNo; CandidatesNo = candidateNo; TableInitialization(); Ballots = new Ballot[voterNo]; Voters = new Voter[voterNo]; for (int i = 0; i < VotersNo; i++) { int[] candidates = new int[candidateNo]; for (int j = 0; j < candidateNo; j++) { candidates[j] = j; // SwitchBoardMapping2[i + candidateNo + j].Value; } Ballots[i] = new Ballot(i, candidates); Voters[i] = new Voter(i); } }