break; case 'F': put(key.substring(2), prefs.getFloat(key, (Float) 0f)); break; case 'S':
@Override public synchronized float getFloat(String key, float defaultValue) { return this.preferences.getFloat(key, defaultValue); }
@Override public synchronized float getFloat(String key, float defaultValue) { return this.preferences.getFloat(key, defaultValue); }
@Override public float getFloat(String key, float def) { return actualPreferences.getFloat(key, def); }
private float getSpeedLineWidth() { return preferences.getFloat("speedLineWidth", 5.0f); }
public float getFloat(String key, float def) { return preferences.getFloat(key, def); }
public float getFloat(String key, float def) { return preferences.getFloat(key, def); }
public float getFloat(String key, float def) { return preferences.getFloat(key, def); }
protected float getLineWidth() { return preferences.getFloat("lineWidth", 3.0f); }
public static EngineParam load(final Preferences prefs) { return of( prefs.getInt(POPULATION_SIZE_KEY, DEFAULT._populationSize), prefs.getInt(TOURNAMENT_SIZE_KEY, DEFAULT._tournamentSize), prefs.getFloat(MUTATION_RATE_KEY, DEFAULT._mutationRate), prefs.getFloat(MUTATION_MULTITUDE_KEY, DEFAULT._mutationMultitude), prefs.getInt(POLYGON_LENGTH_KEY, DEFAULT._polygonLength), prefs.getInt(POLYGON_COUNT_KEY, DEFAULT._polygonCount), new Dimension( prefs.getInt(REFERENCE_IMAGE_WIDTH_KEY, DEFAULT._referenceImageSize.width), prefs.getInt(REFERENCE_IMAGE_HEIGHT_KEY, DEFAULT._referenceImageSize.height) ) ); }
/** * @return the amount of vertical space to print between lines. */ public static float getLineAscentCorrection() { return getPreferences().getFloat(PROP_LINE_ASCENT_CORRECTION, 1.0f); }
@Override // from Config public float getValue (String name, float defval) { return _prefs.getFloat(name, super.getValue(name, defval)); }
public static float getFloat(String name, float defaultValue) { Preferences prefs = getPrefs(); if (prefs != null) { return prefs.getFloat(name, defaultValue); } else { return defaultValue; } }
/** @see java.util.prefs.Preferences#getFloat(String, float) */ public float getFloat(final String key, final float def) { return p.getFloat(safeKey(key), def); }
/** @see java.util.prefs.Preferences#getFloat(String, float) */ public float getFloat(final String key, final float def) { return p.getFloat(safeKey(key), def); }
/** * Sets the value of the specified preference, overriding the value defined in the * configuration files shipped with the application. */ public void setValue (String name, float value) { Float oldValue = null; if (_prefs.get(name, null) != null || _props.getProperty(name) != null) { oldValue = Float.valueOf(_prefs.getFloat(name, super.getValue(name, 0f))); } _prefs.putFloat(name, value); _propsup.firePropertyChange(name, oldValue, Float.valueOf(value)); }
/** * Gets the float. * * @param key * the key * @param def * the def * @return the float * @see java.util.prefs.Preferences#getFloat(java.lang.String, float) */ public static float getFloat(final String key, final float def) { try { return systemRoot.getFloat(fixKey(key), def); } catch (final Exception e) { // just eat the exception to avoid any system // crash on system issues return def; } }
public void setup(RankingFunction function) { sizeTransformer = (RankingNodeSizeTransformer) function.getTransformer(); final String MIN_SIZE = "RankingSizeTransformerPanel_" + sizeTransformer.getClass().getSimpleName() + "_min"; final String MAX_SIZE = "RankingSizeTransformerPanel_" + sizeTransformer.getClass().getSimpleName() + "_max"; float minSizeStart = NbPreferences.forModule(RankingSizeTransformerPanel.class).getFloat(MIN_SIZE, sizeTransformer.getMinSize()); float maxSizeStart = NbPreferences.forModule(RankingSizeTransformerPanel.class).getFloat(MAX_SIZE, sizeTransformer.getMaxSize()); sizeTransformer.setMinSize(minSizeStart); sizeTransformer.setMaxSize(maxSizeStart); minSize.setValue(minSizeStart); maxSize.setValue(maxSizeStart); minSize.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sizeTransformer.setMinSize((Float) minSize.getValue()); NbPreferences.forModule(RankingSizeTransformerPanel.class).putFloat(MIN_SIZE, (Float) minSize.getValue()); } }); maxSize.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { sizeTransformer.setMaxSize((Float) maxSize.getValue()); NbPreferences.forModule(RankingSizeTransformerPanel.class).putFloat(MAX_SIZE, (Float) maxSize.getValue()); } }); }
Preferences prefs = Gdx.app.getPreferences("my-preferences"); prefs.putBoolean("bool", true); prefs.putInteger("int", 1234); prefs.putLong("long", Long.MAX_VALUE); prefs.putFloat("float", 1.2345f); prefs.putString("string", "test!"); if(prefs.getBoolean("bool") != true) throw new GdxRuntimeException("bool failed"); if(prefs.getInteger("int") != 1234) throw new GdxRuntimeException("int failed"); if(prefs.getLong("long") != Long.MAX_VALUE) throw new GdxRuntimeException("long failed"); if(prefs.getFloat("float") != 1.2345f) throw new GdxRuntimeException("float failed"); if(!prefs.getString("string").equals("test!")) throw new GdxRuntimeException("string failed");