Class SimulationParameterReader
java.lang.Object
es.uam.eps.ir.relison.grid.ParametersReader
es.uam.eps.ir.relison.grid.diffusion.SimulationParameterReader
public class SimulationParameterReader extends ParametersReader
Reads a YAML file containing the configuration for simulating information diffusion.
File format:
simulations:
- protocol: ...
filters:
filter_name:
filter_param_1: ...
filter_param_2: ...
...
filter_name:
...
stop:
- protocol: ...
simulations:
- protocol: ...
filters:
filter_name:
filter_param_1: ...
filter_param_2: ...
...
filter_name:
...
stop:
- protocol: ...
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.util.List<FilterParameterReader>>
filterParams
Parameters for the different filters.private static java.lang.String
FILTERS
Identifier for filtersprivate static java.lang.String
PROTOCOL
Identifier for the protocolprivate java.util.List<ProtocolParameterReader>
protocolParams
Parameters for the different simulations.private static java.lang.String
SIMULATIONS
Identifier for the protocol listprivate static java.lang.String
STOP
Identifier for the stop conditionprivate java.util.List<StopConditionParameterReader>
stopParams
Parameters for the different stop conditions. -
Constructor Summary
Constructors Constructor Description SimulationParameterReader()
Constructor -
Method Summary
Modifier and Type Method Description java.util.Set<ProtocolParameterReader>
getCustomProtocols()
Obtains the set of custom protocols previously read.java.util.List<FilterParameterReader>
getFilterParameters(int num)
Gets the filter parameters for a given simulation.java.util.Set<ProtocolParameterReader>
getPreconfiguredProtocols()
Obtains the set of preconfigured protocols previously read.ProtocolParameterReader
getProtocolParameters(int num)
Gets the protocol parameters for a given simulation.Triplet<ProtocolParameterReader,java.util.List<FilterParameterReader>,StopConditionParameterReader>
getSimulation(int num)
Gets the different elements for a simulation.StopConditionParameterReader
getStopConditionParameters(int num)
Gets the stop condition parameters for a given simulation.int
numberSimulations()
Obtains the number of available simulations.java.lang.String
printSimulation(int num)
Obtains a string detailing the simulation parameters.void
read(java.util.Map<java.lang.String,java.lang.Object> map)
Reads the configuration parameters from a file.private void
readSimulation(java.util.Map<java.lang.String,java.lang.Object> element)
Reads the grid for a single simulation.Methods inherited from class es.uam.eps.ir.relison.grid.ParametersReader
readBoolean, readDouble, readInteger, readLong, readOrientation, readParameters, readParameterValues, readString
-
Field Details
-
protocolParams
Parameters for the different simulations. -
filterParams
Parameters for the different filters. -
stopParams
Parameters for the different stop conditions. -
SIMULATIONS
private static final java.lang.String SIMULATIONSIdentifier for the protocol list- See Also:
- Constant Field Values
-
PROTOCOL
private static final java.lang.String PROTOCOLIdentifier for the protocol- See Also:
- Constant Field Values
-
FILTERS
private static final java.lang.String FILTERSIdentifier for filters- See Also:
- Constant Field Values
-
STOP
private static final java.lang.String STOPIdentifier for the stop condition- See Also:
- Constant Field Values
-
-
Constructor Details
-
SimulationParameterReader
public SimulationParameterReader()Constructor
-
-
Method Details
-
read
public void read(java.util.Map<java.lang.String,java.lang.Object> map)Reads the configuration parameters from a file.- Parameters:
map
- a map containing the configurations for a simulation.
-
readSimulation
private void readSimulation(java.util.Map<java.lang.String,java.lang.Object> element)Reads the grid for a single simulation.- Parameters:
element
- a map containing the configuration of the simulation.
-
numberSimulations
public int numberSimulations()Obtains the number of available simulations.- Returns:
- the number of available simulations.
-
getPreconfiguredProtocols
Obtains the set of preconfigured protocols previously read.- Returns:
- The set of preconfigured protocols previously read.
-
getCustomProtocols
Obtains the set of custom protocols previously read.- Returns:
- The set of custom protocols previously read.
-
getSimulation
public Triplet<ProtocolParameterReader,java.util.List<FilterParameterReader>,StopConditionParameterReader> getSimulation(int num)Gets the different elements for a simulation.- Parameters:
num
- the index of the simulation.- Returns:
- a triplet containing:
- The parameters for the protocol
- The parameters for the filter
- The parameters for the stop condition
-
getProtocolParameters
Gets the protocol parameters for a given simulation.- Parameters:
num
- the index of the simulation.- Returns:
- the protocol parameters.
-
getFilterParameters
Gets the filter parameters for a given simulation.- Parameters:
num
- the index of the simulation.- Returns:
- the filter parameters.
-
getStopConditionParameters
Gets the stop condition parameters for a given simulation.- Parameters:
num
- the index of the simulation.- Returns:
- the stop condition parameters.
-
printSimulation
public java.lang.String printSimulation(int num)Obtains a string detailing the simulation parameters.- Parameters:
num
- the index of the simulation.- Returns:
- a string detailing the simulation parameters.
-