/** * Checks whether the specified variable has been set. * @param name fully qualified name of the variable to check for. * @return <code>true</code> if the variable is set, <code>false</code> otherwise. */ public boolean isVariableSet(String name) { return getVariable(name) != null; }
public String getVariable(String name) { return configuration.getVariable(name); }
/** * Returns the value of the specified variable as a long. * @param name fully qualified name of the variable whose value should be retrieved. * @return the variable's value if set, <code>0</code> otherwise. * @throws NumberFormatException if the variable's value cannot be cast to a long. * @see #setVariable(String,long) * @see #getVariable(String,long) */ public long getLongVariable(String name) { return ConfigurationSection.getLongValue(getVariable(name)); }
/** * Returns the value of the specified variable as a {@link ValueList}. * @param name fully qualified name of the variable whose value should be retrieved. * @param separator character used to split the variable's value into a list. * @return the variable's value if set, <code>null</code> otherwise. * @see #setVariable(String,List,String) * @see #getVariable(String,List,String) */ public ValueList getListVariable(String name, String separator) { return ConfigurationSection.getListValue(getVariable(name), separator); }
/** * Returns the value of the specified variable as an integer. * @param name fully qualified name of the variable whose value should be retrieved. * @return the variable's value if set, <code>0</code> otherwise. * @throws NumberFormatException if the variable's value cannot be cast to an integer. * @see #setVariable(String,int) * @see #getVariable(String,int) */ public int getIntegerVariable(String name) { return ConfigurationSection.getIntegerValue(getVariable(name)); }
/** * Returns the value of the specified variable as a float. * @param name fully qualified name of the variable whose value should be retrieved. * @return the variable's value if set, <code>0</code> otherwise. * @throws NumberFormatException if the variable's value cannot be cast to a float. * @see #setVariable(String,float) * @see #getVariable(String,float) */ public float getFloatVariable(String name) { return ConfigurationSection.getFloatValue(getVariable(name)); }
/** * Returns the value of the specified variable as a double. * @param name fully qualified name of the variable whose value should be retrieved. * @return the variable's value if set, <code>0</code> otherwise. * @throws NumberFormatException if the variable's value cannot be cast to a double. * @see #setVariable(String,double) * @see #getVariable(String,double) */ public double getDoubleVariable(String name) { return ConfigurationSection.getDoubleValue(getVariable(name)); }
/** * Returns the value of the specified variable as a boolean. * @param name fully qualified name of the variable whose value should be retrieved. * @return the variable's value if set, <code>false</code> otherwise. * @see #setVariable(String,boolean) * @see #getVariable(String,boolean) */ public boolean getBooleanVariable(String name) { return ConfigurationSection.getBooleanValue(getVariable(name)); }
public String getVariable(MuPreference preference) { return configuration.getVariable(preference.toString()); }
public int getVariable(MuPreference preference, int value) { return configuration.getVariable(preference.toString(), value); }
public boolean getVariable(MuPreference preference, boolean value) { return configuration.getVariable(preference.toString(), value); }
public String getVariable(MuPreference preference, String value) { return configuration.getVariable(preference.toString(), value); }
public List<String> getVariable(MuPreference preference, List<String> value, String separator) { return configuration.getVariable(preference.toString(), value, separator); }
public float getVariable(MuPreference preference, float value) { return configuration.getVariable(preference.toString(), value); }
public long getVariable(MuPreference preference, long value) { return configuration.getVariable(preference.toString(), value); }
public double getVariable(MuPreference preference, double value) { return configuration.getVariable(preference.toString(), value); }
/** * Retrieves the value of the specified variable as a boolean. * <p> * If the variable isn't set, this method will set it to <code>defaultValue</code> before * returning it. If this happens, a configuration {@link ConfigurationEvent event} will * be sent to all registered LISTENERS. * </p> * @param name name of the variable to retrieve. * @param defaultValue value to use if <code>name</code> is not set. * @return the specified variable's value. * @see #setVariable(String,boolean) * @see #getBooleanVariable(String) */ public boolean getVariable(String name, boolean defaultValue) { return ConfigurationSection.getBooleanValue(getVariable(name, ConfigurationSection.getValue(defaultValue))); }
/** * Retrieves the value of the specified variable as a double. * <p> * If the variable isn't set, this method will set it to <code>defaultValue</code> before * returning it. If this happens, a configuration {@link ConfigurationEvent event} will * be sent to all registered LISTENERS. * </p> * @param name name of the variable to retrieve. * @param defaultValue value to use if <code>name</code> is not set. * @return the specified variable's value. * @throws NumberFormatException if the variable's value cannot be cast to a double. * @see #setVariable(String,double) * @see #getDoubleVariable(String) */ public double getVariable(String name, double defaultValue) { return ConfigurationSection.getDoubleValue(getVariable(name, ConfigurationSection.getValue(defaultValue))); }
/** * Retrieves the value of the specified variable as a float. * <p> * If the variable isn't set, this method will set it to <code>defaultValue</code> before * returning it. If this happens, a configuration {@link ConfigurationEvent event} will * be sent to all registered LISTENERS. * </p> * @param name name of the variable to retrieve. * @param defaultValue value to use if <code>name</code> is not set. * @return the specified variable's value. * @throws NumberFormatException if the variable's value cannot be cast to a float. * @see #setVariable(String,float) * @see #getFloatVariable(String) */ public float getVariable(String name, float defaultValue) { return ConfigurationSection.getFloatValue(getVariable(name, ConfigurationSection.getValue(defaultValue))); }
/** * Private Constructor */ private GlobalLocationHistory() { Configuration snapshot = MuConfigurations.getSnapshot(); // Restore the global history from last run int nbLocations = snapshot.getIntegerVariable(MuSnapshot.getRecentLocationsCountVariable()); for (int i=0; i<nbLocations; ++i) { String filePath = snapshot.getVariable(MuSnapshot.getRecentLocationVariable(i)); try { history.add(FileURL.getFileURL(filePath)); } catch (MalformedURLException e) { LOGGER.debug("Got invalid URL from the snapshot file: " + filePath, e); } } }