public class Configuration extends Object
Class containing current Net2Plan-wide options, and methods to work with them.
In the current version the available options are:
workspace\BuiltInExamples.jar
fileIn addition, due to the close relation to JOM library, some JOM-specific options can be configured:
Important: Values are stored in String
format. Users are
responsible to make conversions to the appropiate type (i.e. double
).
Important: Users should not access this class directly. All interfaces
for implementing user-made code (i.e. algorithms) include a map so-called
net2planParameters
as input parameter, where users can find the
current configuration of the tool (e.g. IAlgorithm.executeAlgorithm()
) .
Modifier and Type | Field and Description |
---|---|
static double |
precisionFactor |
Constructor and Description |
---|
Configuration() |
Modifier and Type | Method and Description |
---|---|
static void |
check(SortedMap<String,String> net2planParameters)
Checks the given options for validity.
|
static String |
getDefaultIlpSolverName()
Returns the default solver defined for ILP programs
|
static String |
getDefaultSolverLibraryName(String solver)
Returns the default name of the library file (to set as solverLibraryName in JOM calls), defined by the user
for the given solver name.
|
static SortedMap<String,String> |
getNet2PlanOptions()
Returns the current map of Net2Plan-wide options.
|
static List<Triple<String,String,String>> |
getNet2PlanParameters()
Returns the list of Net2Plan-wide parameters, where the first item of each element
is the parameter name, the second one is the parameter value, and the third
one is the parameter description.
|
static String |
getOption(String option)
Returns the value of an option.
|
static SortedMap<String,String> |
getOptions()
Returns the current map of options (inlcuding ones those from plugins).
|
static void |
readFromOptionsDefaultFile()
Reads options from the default file.
|
static void |
readFromOptionsFile(File f)
Reads options from a given file.
|
static void |
saveOptions()
Saves current options to the file system.
|
static void |
setDefaultSolverLibraryName(String solver,
String name)
Sets the default name of the library file (to set as solverLibraryName in JOM calls).
|
static void |
setOption(String option,
String value)
Puts the value for an option.
|
static void |
setOptions(Map<String,String> options)
Puts the value a set of options.
|
static void |
updateSolverLibraryNameParameter(Map<String,String> parameters)
Goes through this map of parameters and, if both the parameters solverName and solverLibraryName exist, and solverLibraryName
equals "", then sets the value of such parameter to the default library file set by the user (in user->options) for such solver.
|
public static void check(SortedMap<String,String> net2planParameters)
net2planParameters
- A key-value map with Net2Plan
-wide configuration optionspublic static String getDefaultIlpSolverName()
public static String getDefaultSolverLibraryName(String solver)
solver
- The name of the solver (case insensitive)public static SortedMap<String,String> getNet2PlanOptions()
public static List<Triple<String,String,String>> getNet2PlanParameters()
Returns the list of Net2Plan-wide parameters, where the first item of each element is the parameter name, the second one is the parameter value, and the third one is the parameter description.
It is possible to define type-specific parameters if the default value is set according to the following rules (but user is responsible of checking in its own code):
.class
or .jar
file where the code is located, the class name,
and a set of parameters (pair of key-values separated by commas, where individual
key and value are separated with an equal symbol. The same applies to reports (#report#),
event generators (#eventGenerator#) and event processors (#eventProcessor#).public static String getOption(String option)
option
- Option namepublic static SortedMap<String,String> getOptions()
public static void readFromOptionsDefaultFile() throws IOException
IOException
- If the specified file cannot be loadedpublic static void readFromOptionsFile(File f) throws IOException
f
- Options fileIOException
- If the specified file cannot be loadedpublic static void saveOptions()
public static void setDefaultSolverLibraryName(String solver, String name)
solver
- Name of the solvername
- The file name that will be defined at the Net2Plan options.public static void setOption(String option, String value)
option
- Option namevalue
- Option valuepublic static void setOptions(Map<String,String> options)
options
- Option name and value pairspublic static void updateSolverLibraryNameParameter(Map<String,String> parameters)
parameters
- The map of parameters, that may be modified in the solverLibraryName keyCopyright © 2018. All rights reserved.