Package skyview.executive
Class Settings
- java.lang.Object
-
- skyview.executive.Settings
-
public class Settings extends Object
This class defines a singleton where SkyView preferences/settings Testchange... can be set and gotten from anywhere in the system. A setting is simply a key=string value. When there is to be more than one value for the key it should be specified as string1,string2,string3. A comma is not allowed as a character within a setting. Keys are case insensitive.When specified in the command line Settings may sometimes be set with just the keyword. This is treated as equivalent to key=1.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
add(String key, String value)
Add a setting to a list -- but only if it is not already in the list.static void
addArgs(String[] args)
Add settings from a list of arguments.static void
addToken(String arg)
Add a single argument tokenstatic String
get(String key)
Get a value corresponding to the keystatic String
get(String key, String dft)
Get a values corresponding to a key or the defaultstatic String[]
getArray(String key)
Get the values corresponding to a key as an array of strings.static String[]
getKeys()
Return the array of keys in the current settingsstatic boolean
has(String key)
Check if the given key has been setstatic HashMap<String,String>
pop()
Give a copy of the current settings and pop the stackstatic void
push(HashMap<String,String> top)
static void
put(String key, String value)
Save a key and valuestatic void
restore()
Restore a previously saved state.static void
save()
Save the current state of the settings for a later restorationstatic void
suggest(String key, String value)
This method works like put except that it does not add a pair if the keys is in the _nullvalues setting or if the Setting is already set (unless it is set to the special value "default")static void
updateFromFile(String settingsFile)
Try to read settings from a file
-
-
-
Method Detail
-
updateFromFile
public static void updateFromFile(String settingsFile)
Try to read settings from a file
-
addArgs
public static void addArgs(String[] args)
Add settings from a list of arguments. This is probably the argument list given to main, but needn't be.
-
addToken
public static void addToken(String arg)
Add a single argument token
-
get
public static String get(String key, String dft)
Get a values corresponding to a key or the default
-
getArray
public static String[] getArray(String key)
Get the values corresponding to a key as an array of strings. Returns null rather than a 0 length array if the value is not set.
-
suggest
public static void suggest(String key, String value)
This method works like put except that it does not add a pair if the keys is in the _nullvalues setting or if the Setting is already set (unless it is set to the special value "default")
-
save
public static void save()
Save the current state of the settings for a later restoration
-
add
public static void add(String key, String value)
Add a setting to a list -- but only if it is not already in the list.
-
has
public static boolean has(String key)
Check if the given key has been set
-
getKeys
public static String[] getKeys()
Return the array of keys in the current settings
-
restore
public static void restore()
Restore a previously saved state.
-
pop
public static HashMap<String,String> pop()
Give a copy of the current settings and pop the stack
-
-