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.
Constructor and Description |
---|
Configuration() |
Modifier and Type | Method and Description |
---|---|
static void |
check(Map<String,String> net2planParameters)
Checks the given OPTIONS for validity.
|
static Map<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 Map<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 |
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.
|
public static void check(Map<String,String> net2planParameters)
net2planParameters
- A key-value map with Net2Plan
-wide configuration OPTIONSpublic static Map<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 Map<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 setOption(String option, String value)
option
- Option namevalue
- Option valuepublic static void setOptions(Map<String,String> options)
options
- Option name and value pairs