net.lenkaspace.creeper.model
Class CRParameters
java.lang.Object
net.lenkaspace.creeper.model.CRParameters
public class CRParameters
- extends java.lang.Object
A class that stores parameters of the experiments. Models should extensively use a sublcass
of CRParameters to read their parameters. CRReportController will automatically write the
parameters into a text file when saving reports.
A sublcass should set the singleton instance of this class and load all its parameters for a
seemless integration. This way, there is always only 1 instance of CRParameters and
all classes that request CRParameters.getSingleton() get the new class singleton.
For example:
private static MyParameters singletonReference;
public static MyParameters getSingleton() {
if (singletonReference == null) {
singletonReference = new Parameters();
//-- set all variables from the CRParameters
CRParameters origParams = CRParameters.getSingleton();
singletonReference.scenario = origParams.scenario;
singletonReference.reportFolderName = origParams.reportFolderName;
singletonReference.numOfTrials = origParams.numOfTrials;
singletonReference.numOfRuns = origParams.numOfRuns;
singletonReference.trialDuration = origParams.trialDuration;
singletonReference.setController(origParams.getController());
//-- rewrite CRParameters reference
CRParameters.setSingletonReference(singletonReference);
}
return singletonReference;
}
- Version:
- 2.0
- Author:
- Lenka Pitonakova contact@lenkaspace.net
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
scenario
public java.lang.String scenario
reportFolderName
public java.lang.String reportFolderName
trialDuration
public int trialDuration
numOfRuns
public int numOfRuns
numOfTrials
public int numOfTrials
CRParameters
public CRParameters()
getSingleton
public static CRParameters getSingleton()
toString
public java.lang.String toString()
- Generate a string that lists all parameters. Subclasses should override this
to add their own parameters.
- Overrides:
toString
in class java.lang.Object
saveSelf
public void saveSelf()
- Save all parameters to parameters.txt
checkSelf
public boolean checkSelf()
- Check that all parameters have been set. Subclasses should override this
to add their own checks.
- Returns:
- true if all parameters set
setController
public void setController(CRController controller_)
getController
public CRController getController()