Created
January 15, 2014 15:48
-
-
Save coffeejay/8438613 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A class representation of a BallotBox using an ArrayListBag. | |
* | |
* @author Jay Deuskar | |
*/ | |
public class BallotBox{ | |
private BagInterface<Ballot> ballots; | |
public BallotBox(){ | |
ballots = new ArrayListBag<Ballot>(); | |
} | |
public int getSize(){ | |
return ballots.getCurrentSize(); | |
} | |
public boolean isEmpty(){ | |
return ballots.isEmpty(); | |
} | |
public boolean add(Ballot ballot){ | |
return ballots.add(ballot); | |
} | |
public Ballot remove (){ | |
return ballots.remove(); | |
} | |
public boolean remove(Ballot ballot){ | |
return ballots.remove(ballot); | |
} | |
public void clear(){ | |
ballots.clear(); | |
} | |
public int getFrequencyOf(Ballot ballot){ | |
return ballots.getFrequencyOf(ballot); | |
} | |
public boolean contains(Ballot ballot){ | |
return ballots.contains(ballot); | |
} | |
public Object[] toArray(){ | |
return (Object[])ballots.toArray(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment