jaige
Class Statistic

java.lang.Object
  extended by jaige.Statistic
All Implemented Interfaces:
java.lang.Comparable<Statistic>

public class Statistic
extends java.lang.Object
implements java.lang.Comparable<Statistic>

A Statistic is a simple structure used to hold numerical data. It contains the statistics name, a unit if necessary, and an array of values. The array of values is assumed to have the same length as the number of players it represents. This structure can be reused when appropriate.

Copyright: Copyright (c) Jaige 2007

Version:
1.0
Author:
Rob Taft

Constructor Summary
Statistic(java.lang.String name)
          Creates a new Statistic with the specified name.
Statistic(java.lang.String name, java.lang.String unit, java.lang.Number[] values)
          Creates a new Statistic with the specified name, unit, and values.
 
Method Summary
 int compareTo(Statistic s)
          Compares the name of this statistic to the name of the supplied statistic
 boolean equals(java.lang.Object s)
           
 java.lang.String getName()
          Returns the name of this statistic.
 java.lang.String getUnit()
          Gets the unit that this statistic is in
 java.lang.Number[] getValues()
          Gets the values associated with this statistic
 void setName(java.lang.String name)
          Sets the name of this statistic
 void setUnit(java.lang.String unit)
          Sets the unit that this statistic is in
 void setValues(java.lang.Number[] values)
          Sets the values associated with this statistic
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Statistic

public Statistic(java.lang.String name,
                 java.lang.String unit,
                 java.lang.Number[] values)
Creates a new Statistic with the specified name, unit, and values.

Parameters:
name - String Name of this statistic
unit - String The unit of this statistic. ie: ms, sec, cm, etc.
values - Number[] The values associated with this statistic.

Statistic

public Statistic(java.lang.String name)
Creates a new Statistic with the specified name.

Parameters:
name - String Name of this statistic
Method Detail

getName

public java.lang.String getName()
Returns the name of this statistic.

Returns:
String name of this statistic

setName

public void setName(java.lang.String name)
Sets the name of this statistic

Parameters:
name - String name of this statistic

getUnit

public java.lang.String getUnit()
Gets the unit that this statistic is in

Returns:
String the unit that this statistic is in

setUnit

public void setUnit(java.lang.String unit)
Sets the unit that this statistic is in

Parameters:
unit - String the unit that this statistic is in

getValues

public java.lang.Number[] getValues()
Gets the values associated with this statistic

Returns:
Number[] the values associated with this statistic

setValues

public void setValues(java.lang.Number[] values)
Sets the values associated with this statistic

Parameters:
values - Number[] the values associated with this statistic

compareTo

public int compareTo(Statistic s)
Compares the name of this statistic to the name of the supplied statistic

Specified by:
compareTo in interface java.lang.Comparable<Statistic>
Parameters:
s - Statistic statstic to compare to.
Returns:
int a negative integer, zero, or a positive integer as this statistic is less than, equal to, or greater than the specified statistic

equals

public boolean equals(java.lang.Object s)
Overrides:
equals in class java.lang.Object