|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--unl.cusack.estimator.EstimatorModel
The EstimatorModel is the model of an estimator. It is an abstract class, leaving the details of the estimator to the subclasses. The model assumes there is a formula f(i) to compute the ith estimate of the number to be estimated. The model stores the first index which is desired, the number of estimates to store, and the interval between intervals. For instance, if
The model maintains a list of object which are registered as listeners to this class. If the model changes, this class will inform each of the registered listeners of the fact that the model has changed, leavinf it up to each of them what they want to do about it.
Field Summary | |
protected double[] |
estimates
|
protected java.util.Set |
estimatorListeners
|
Constructor Summary | |
EstimatorModel()
The constructor, assuming an empty model |
Method Summary | |
void |
addEstimatorListener(EstimatorListener listener)
Add a listener the the list |
void |
dataChanged()
If any of the data in the model changes, this method takes care of recalculating the estimates, and informing the listeners of the fact that the model has changed. |
double |
getEstimate(int n)
Get the nth estimate from the list |
int |
getEstimatorInterval()
|
int |
getFirstEstimate()
Get the index of the first stored estimate |
double |
getMaximumEstimate()
|
double |
getMinimumEstimate()
|
int |
getNumberOfEstimates()
|
abstract void |
recalculateEstimates()
|
void |
setEstimateInterval(int n)
Set the desired interval between estimates to n |
void |
setFirstEstimate(int n)
Set the index of the first estimate to n |
void |
setNumberOfEstimates(int n)
Sets the number of estimates to n |
void |
setParameters(int n,
int f,
int i)
Set all of the parameters of the model |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected double[] estimates
protected java.util.Set estimatorListeners
Constructor Detail |
public EstimatorModel()
Method Detail |
public abstract void recalculateEstimates()
public double getEstimate(int n)
n
- the index of the desired estimate
Note: This is asking for the nth estimate that is stored in the
model, not f(n), where f is the function that computes the estimates.
public double getMaximumEstimate()
public double getMinimumEstimate()
public int getNumberOfEstimates()
public void setNumberOfEstimates(int n)
n
- the number of desired estimatespublic int getFirstEstimate()
public void setFirstEstimate(int n)
n
- the desired index of the first estimatepublic int getEstimatorInterval()
public void setEstimateInterval(int n)
n
- the desried interval between estimates.public void setParameters(int n, int f, int i)
n
- desired number of estimatesf
- desired index of first indexi
- desired interval between estimatespublic void addEstimatorListener(EstimatorListener listener)
listener
- the object desiring to listen to this classpublic void dataChanged()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |