|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object candidate.Candidate
public class Candidate
Constructor Summary | |
---|---|
Candidate()
Creates a default new instance of Candidate |
|
Candidate(java.lang.String nm)
creates a new instance of a candidate given a name. |
Method Summary | |
---|---|
void |
addOneVote()
add one vote to the candidate |
int |
compareTo(java.lang.Object obj)
Compares two Candidates - based on number of votes received - needed for sorting - required since implements Comparable interface returns positive if passed object comparing to is less, zero if object comparing to is equal, negative if passed object comparing to is greater. |
boolean |
equals(java.lang.Object obj)
determine if a passed Candidate has the same contents as the calling object (all contents). |
java.lang.String |
getName()
report candidates name |
int |
getNumVotes()
report candidate's number of votes |
boolean |
matches(Candidate toCompare)
determine if a passed Candidate has the same name as the calling object (just name - could be used for finding the right candidate in a collection of candidates). |
boolean |
matches(java.lang.String toCompare)
determine if a passed Sting is the same as the candidate name in the calling object (just name - could be used for finding the right candidate in a collection of candidates). |
void |
resetVotes()
reset vote total to zero |
java.lang.String |
toString()
produce a friendly string version of the object |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Candidate()
public Candidate(java.lang.String nm)
Method Detail |
---|
public java.lang.String getName()
public int getNumVotes()
public void addOneVote()
public void resetVotes()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean matches(Candidate toCompare)
public boolean matches(java.lang.String toCompare)
public int compareTo(java.lang.Object obj)
compareTo
in interface java.lang.Comparable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |