|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Skater.Skater
Field Summary | |
static double |
MAX_SCORE
|
static double |
MIN_SCORE
|
Constructor Summary | |
Skater()
Creates a default new instance of Skater |
|
Skater(java.lang.String nam,
java.lang.String nation)
Creates a new instance of Skater with name and country known |
Method Summary | |
boolean |
equals(java.lang.Object obj)
report whether two skaters are considered the same Need a policy decision here For now, consider them the same if they have the same name and country |
double |
getArtRating()
Calculate and report the skater's total artistic rating This involves dropping high and low score and getting sum of rest Assumes that any Skater has array of Artistry Scores, even if the scores themselves havn't been altered from default 0 |
java.lang.String |
getCountry()
report skater's country |
java.lang.String |
getName()
report skater's name |
double |
getNthArtScore(int n)
report Nth judge's score for this skater on artistry if invalid N is passed, for now return -1 In future, once we cover exception handling, throw an exception |
double |
getNthTechScore(int n)
report Nth judge's score for this skater on technical skill if invalid N is passed, for now return -1 In future, once we cover exception handling, throw an exception |
static int |
getNumJudges()
static method to get how many judges there are |
double |
getTechRating()
Calculate and report the skater's total technical rating This involves dropping high and low score and getting sum of rest Assumes that any Skater has array of Tech Scores, even if the scores themselves havn't been altered from default 0 |
double |
getTotalRating()
calculate and report skater's total score - artistic + technical |
int |
hashCode()
Calculate a hash code for a Skater Object Overrides Object version From what I understand, in order to make some collections classes work, if you override toString / equals you should override hashCode (Unfortunately, my decisions on toString and equals are not consistent with each other :-) ) |
static void |
main(java.lang.String[] args)
|
void |
setCountry(java.lang.String nam)
change skaters country Assumes country is ok, regardless Could use a lookup in fancier class |
void |
setName(java.lang.String nam)
change skaters name Assumes name is ok, regardless |
boolean |
setNthArtScore(int n,
double score)
set a particular judge's score for the skater for artistry Reject change if invalid judge number or invalid score |
boolean |
setNthTechScore(int n,
double score)
set a particular judge's score for the skater for artistry Reject change if invalid judge number or invalid score |
static boolean |
setNumJudges(int num)
Change the number of judges Policy Decision: Don't accept change if there have been skaters created Could be controversial - we might have different competitions with different numbers of judges but in that case, we should make numJudges non-static |
java.lang.String |
toString()
give an output friendly representation of the skater Overrides Object version Policy decision: show name, country, artistic and technical ratings if available, and total if available |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final double MAX_SCORE
public static final double MIN_SCORE
Constructor Detail |
public Skater()
public Skater(java.lang.String nam, java.lang.String nation)
Method Detail |
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 int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getName()
public java.lang.String getCountry()
public static int getNumJudges()
public double getTechRating()
public double getArtRating()
public double getTotalRating()
public double getNthArtScore(int n)
public double getNthTechScore(int n)
public void setName(java.lang.String nam)
public void setCountry(java.lang.String nam)
public static boolean setNumJudges(int num)
public boolean setNthArtScore(int n, double score)
public boolean setNthTechScore(int n, double score)
public static void main(java.lang.String[] args)
args
- the command line arguments
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |