Package org.sikuli.script
Class Options
- java.lang.Object
-
- org.sikuli.script.Options
-
public class Options extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddumpOptions()all options and their values written to sysout as key = valueStringgetOption(String pName){link getOption}StringgetOption(String pName, String sDefault)if no option file is found, the option is taken as not existing
side-effect: if no options file is there, an options store will be created in memory
in this case and when the option is absent or empty, the given default will be stored
you might later save the options store to a file with saveOptions()
the default value is either the empty string, number 0 or falsedoublegetOptionDouble(String pName){link getOption}doublegetOptionDouble(String pName, double nDefault){link getOption}floatgetOptionFloat(String pName){link getOption}floatgetOptionFloat(String pName, float nDefault){link getOption}intgetOptionInteger(String pName){link getOption}intgetOptionInteger(String pName, Integer nDefault){link getOption}Map<String,String>getOptions()all options and their valuesStringgetOptionsFile()static StringgetOptionsFileDefault()booleanhasOptions()check whether options are definedstatic Optionsinit(RunTime pRunTime)booleanisOption(String pName){link getOption}booleanisOption(String pName, boolean bDefault){link getOption}booleansaveOptions()save a properties store to a file (prop: this.comingfrom = abs. filepath)booleansaveOpts(String fpOptions)save a properties store to the given filevoidsetOption(String pName, String sValue){link getOption}voidsetOptionBool(String pName, boolean bValue){link getOption}voidsetOptionDouble(String pName, double nValue){link getOption}voidsetOptionFloat(String pName, float nValue){link getOption}voidsetOptionInteger(String pName, int nValue){link getOption}
-
-
-
Constructor Detail
-
Options
public Options(String fpOptions)
-
-
Method Detail
-
getOptionsFileDefault
public static String getOptionsFileDefault()
-
getOptionsFile
public String getOptionsFile()
-
saveOptions
public boolean saveOptions()
save a properties store to a file (prop: this.comingfrom = abs. filepath)- Returns:
- success
-
saveOpts
public boolean saveOpts(String fpOptions)
save a properties store to the given file- Parameters:
fpOptions- path to a file- Returns:
- success
-
getOption
public String getOption(String pName, String sDefault)
if no option file is found, the option is taken as not existing
side-effect: if no options file is there, an options store will be created in memory
in this case and when the option is absent or empty, the given default will be stored
you might later save the options store to a file with saveOptions()
the default value is either the empty string, number 0 or false- Parameters:
pName- the option key (case-sensitive)sDefault- the default to be returned if option absent or empty- Returns:
- the associated value, the default value if absent or empty
-
getOption
public String getOption(String pName)
{link getOption}- Parameters:
pName- the option key (case-sensitive)- Returns:
- the associated value, empty string if absent
-
setOption
public void setOption(String pName, String sValue)
{link getOption}- Parameters:
pName- the option key (case-sensitive)sValue- the value to be set
-
getOptionInteger
public int getOptionInteger(String pName, Integer nDefault)
{link getOption}- Parameters:
pName- the option key (case-sensitive)nDefault- the default to be returned if option absent, empty or not convertible- Returns:
- the converted integer number, default if absent, empty or not possible
-
getOptionInteger
public int getOptionInteger(String pName)
{link getOption}- Parameters:
pName- the option key (case-sensitive)- Returns:
- the converted integer number, 0 if absent or not possible
-
setOptionInteger
public void setOptionInteger(String pName, int nValue)
{link getOption}- Parameters:
pName- the option key (case-sensitive)nValue- the value to be set
-
getOptionFloat
public float getOptionFloat(String pName, float nDefault)
{link getOption}- Parameters:
pName- the option key (case-sensitive)- Returns:
- the converted float number, default if absent or not possible
-
getOptionFloat
public float getOptionFloat(String pName)
{link getOption}- Parameters:
pName- the option key (case-sensitive)- Returns:
- the converted float number, 0 if absent or not possible
-
setOptionFloat
public void setOptionFloat(String pName, float nValue)
{link getOption}- Parameters:
pName- the option key (case-sensitive)nValue- the value to be set
-
getOptionDouble
public double getOptionDouble(String pName, double nDefault)
{link getOption}- Parameters:
pName- the option key (case-sensitive)- Returns:
- the converted float number, default if absent or not possible
-
getOptionDouble
public double getOptionDouble(String pName)
{link getOption}- Parameters:
pName- the option key (case-sensitive)- Returns:
- the converted double number, 0 if absent or not possible
-
setOptionDouble
public void setOptionDouble(String pName, double nValue)
{link getOption}- Parameters:
pName- the option key (case-sensitive)nValue- the value to be set
-
isOption
public boolean isOption(String pName, boolean bDefault)
{link getOption}- Parameters:
pName- the option key (case-sensitive)bDefault- the default to be returned if option absent or empty- Returns:
- true if option has yes or no, false for no or false (not case-sensitive)
-
isOption
public boolean isOption(String pName)
{link getOption}- Parameters:
pName- the option key (case-sensitive)- Returns:
- true only if option exists and has yes or true (not case-sensitive), in all other cases false
-
setOptionBool
public void setOptionBool(String pName, boolean bValue)
{link getOption}- Parameters:
pName- the option key (case-sensitive)bValue- the value to be set
-
hasOptions
public boolean hasOptions()
check whether options are defined- Returns:
- true if at lest one option defined else false
-
getOptions
public Map<String,String> getOptions()
all options and their values- Returns:
- a map of key-value pairs containing the found options, empty if no options file found
-
dumpOptions
public void dumpOptions()
all options and their values written to sysout as key = value
-
-