cdx.scorebot.scoring.logic
Class TestNumPair

java.lang.Object
  extended by cdx.scorebot.scoring.logic.TestNumPair
All Implemented Interfaces:
java.lang.Cloneable

public class TestNumPair
extends java.lang.Object
implements java.lang.Cloneable

stores a test and the number of results to track

Author:
David Underhill

Constructor Summary
TestNumPair(java.lang.String testToTrackName, int numResultsToKeep)
          instantiate a TestNumPair
 
Method Summary
 void clearResults()
          removes all known results
 java.lang.Object clone()
          Returns a clone of this TestNumPair.
 boolean equals(java.lang.Object o)
           
 int getNumResultsToKeep()
          gets the number of results to track
 TestEvent getResult(int index)
          gets the specified result (0 = most recent)
 java.util.Vector<TestEvent> getResults()
          gets the results this stores (index 0 = most recent)
 java.lang.String getTestItemNameToTrack()
          gets the name of the test item whose results are to be tracked
 boolean hasAllResults()
          whether or not this TestNumResult has a value for each of the results it can hold
 boolean trackResult(TestEvent e)
          adds the specified result to the TestEvents being tracked if the specified result came from the test item being tracked by this TestNumPair
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestNumPair

public TestNumPair(java.lang.String testToTrackName,
                   int numResultsToKeep)
instantiate a TestNumPair

Parameters:
testToTrackName - the name of the test item whose results are to be tracked
numResultsToKeep - the number of results to track
Method Detail

equals

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

clearResults

public void clearResults()
removes all known results


clone

public java.lang.Object clone()
Returns a clone of this TestNumPair. The copy will contain a reference to a clone of the internal test results vector, not a reference to the original internal test results vector of this TestNumPair object.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this TestNumPair

getResult

public TestEvent getResult(int index)
gets the specified result (0 = most recent)

Parameters:
index - the number of the test to get (0 = most recent)
Returns:
the TestEvent from the specified number of runs ago (0 = most recent) or null if that TestEvent does not exist

getResults

public java.util.Vector<TestEvent> getResults()
gets the results this stores (index 0 = most recent)

Returns:
the TestEvents from the all runs which this is tracking

hasAllResults

public boolean hasAllResults()
whether or not this TestNumResult has a value for each of the results it can hold


trackResult

public boolean trackResult(TestEvent e)
adds the specified result to the TestEvents being tracked if the specified result came from the test item being tracked by this TestNumPair

Parameters:
e - the TestEvent to add to the results being tracked (if it is from the appropriate Test)
Returns:
true if the event was added to be tracked or false if it did not apply to this pair

getNumResultsToKeep

public int getNumResultsToKeep()
gets the number of results to track


getTestItemNameToTrack

public java.lang.String getTestItemNameToTrack()
gets the name of the test item whose results are to be tracked