public abstract class Model extends Object
public class SIRModel implements Model {
public void run() {
// perform model specific step here
}
-
-
Field Summary
Fields
Modifier and Type
Field and Description
private Lookup
lookup
private String
model
private List<Parameter>
parameters
private List<Prior>
priors
-
Constructor Summary
Constructors
Constructor and Description
Model()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods
Modifier and Type
Method and Description
abstract void
finalise()
End the model.
String
getParameterValue(String name)
Get the value of a parameter for the model given the parameter name (as defined in the config file).
Boolean
getParameterValueAsBoolean(String name)
Get the value (as a boolean) of a parameter for the model given the parameter name (as defined in the config
file).
Double
getParameterValueAsDouble(String name)
Get the value (as a double) of a parameter for the model given the parameter name (as defined in the config
file).
Integer
getParameterValueAsInteger(String name)
Get the value (as an integer) of a parameter for the model given the parameter name (as defined in the config
file).
UniformPrior
getUniformPrior(String name)
Get the prior of a paramter for the model given the parameter name (as defined in the config file).
boolean
hasParameter(String name)
Determine whether or not a parameter exists in the config file.
abstract void
init()
Initialise the model.
abstract void
run()
Run the model.
void
setModelConfiguration(String model)
Set the xml string for the element in the configuration file.
void
setModelDataLookup(Lookup lookup)
Set the lookup object that allows access to the data files specified in the configuration file.
void
setModelParameters(List<Parameter> parameters)
Set the list of parameters for the model.
void
setModelPriors(List<Prior> priors)
Set the list of priors for the model.
-
-
Method Detail
-
setModelConfiguration
public final void setModelConfiguration(String model)
Set the xml string for the element in the configuration file.
- Parameters:
model
- a string representation of the xml section defining the configuration of the model.
-
setModelDataLookup
public final void setModelDataLookup(Lookup lookup)
Set the lookup object that allows access to the data files specified in the configuration file.
- Parameters:
lookup
- the XML element corresponding to the Model element in the config.
-
setModelParameters
public final void setModelParameters(List<Parameter> parameters)
Set the list of parameters for the model.
- Parameters:
parameters
- a collection of parameters for the model.
-
setModelPriors
public final void setModelPriors(List<Prior> priors)
Set the list of priors for the model.
- Parameters:
priors
- a collection of priors for the model.
-
getUniformPrior
public final UniformPrior getUniformPrior(String name)
Get the prior of a paramter for the model given the parameter name (as defined in the config file).
- Parameters:
name
- the name of the parameter.
- Returns:
- the prior defeind in the configuration file.
-
hasParameter
public final boolean hasParameter(String name)
Determine whether or not a parameter exists in the config file.
- Parameters:
name
- the name of the parameter.
- Returns:
- true if the parameter exists in the config file, false otherwise.
-
getParameterValue
public final String getParameterValue(String name)
Get the value of a parameter for the model given the parameter name (as defined in the config file).
- Parameters:
name
- the name of the parameter.
- Returns:
- a string value of the value for the parameter.
-
getParameterValueAsDouble
public final Double getParameterValueAsDouble(String name)
Get the value (as a double) of a parameter for the model given the parameter name (as defined in the config
file).
- Parameters:
name
- the name of the parameter.
- Returns:
- a string value of the value for the parameter.
-
getParameterValueAsInteger
public final Integer getParameterValueAsInteger(String name)
Get the value (as an integer) of a parameter for the model given the parameter name (as defined in the config
file).
- Parameters:
name
- the name of the parameter.
- Returns:
- a string value of the value for the parameter.
-
getParameterValueAsBoolean
public final Boolean getParameterValueAsBoolean(String name)
Get the value (as a boolean) of a parameter for the model given the parameter name (as defined in the config
file).
- Parameters:
name
- the name of the parameter.
- Returns:
- a string value of the value for the parameter.
-
init
public abstract void init()
Initialise the model. This method is called by the framework before calling the models run method to allow the
implementation of the model to perform any initialisation required.
-
run
public abstract void run()
Run the model. This is the entry point to the model from the framework, up til now the framework has read any
configuration files and processed data mentioned therein.
-
finalise
public abstract void finalise()
End the model. This method is called by the framework after the model has finished running.
Copyright © 2015 University of Glasgow. All rights reserved.