/** * Returns the default value for the double-valued property * with the given name. * Returns the default-default value (<code>0.0</code>) if there * is no default property with the given name, or if the default * value cannot be treated as a double. * * @param name the name of the property * @return the default value of the named property */ @Override public double getDefaultDouble(String name) { return getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT); }
/** * Returns the current value of the double-valued property with the * given name. * Returns the default-default value (<code>0.0</code>) if there * is no property with the given name, or if the current value * cannot be treated as a double. * * @param name the name of the property * @return the double-valued property */ @Override public double getDouble(String name) { return getPluginPreferences(true).getDouble(name, getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT)); }
/** * Does its best at determining the default value for the given key. Checks the * given object's type and then looks in the list of defaults to see if a value * exists. If not or if there is a problem converting the value, the default default * value for that type is returned. */ private Object getDefault(String key, Object obj) { IEclipsePreferences defaults = getDefaultPreferences(); if (obj instanceof String) return defaults.get(key, STRING_DEFAULT_DEFAULT); else if (obj instanceof Integer) return new Integer(defaults.getInt(key, INT_DEFAULT_DEFAULT)); else if (obj instanceof Double) return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT)); else if (obj instanceof Float) return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT)); else if (obj instanceof Long) return new Long(defaults.getLong(key, LONG_DEFAULT_DEFAULT)); else if (obj instanceof byte[]) return defaults.getByteArray(key, BYTE_ARRAY_DEFAULT_DEFAULT); else if (obj instanceof Boolean) return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE; else return null; }
private static long getChunkCacheSize(IEclipsePreferences node) { double maxSizeMb = node.getDouble(CHUNK_CACHE_SIZE_MB, CHUNK_CACHE_SIZE_MB_DEFAULT); double maxSizePercent = node.getDouble(CHUNK_CACHE_SIZE_PERCENT, CHUNK_CACHE_SIZE_PERCENT_DEFAULT); maxSizePercent = Math.max(1.0, Math.min(50.0, maxSizePercent)); maxSizeMb = Math.max(maxSizeMb, 1.0); long m1= (long) (Runtime.getRuntime().maxMemory() / 100.0 * maxSizePercent); return Math.min(m1, (long) (maxSizeMb * 1024.0 * 1024.0)); }
private static long getChunkCacheSize(IEclipsePreferences node) { double maxSizeMb = node.getDouble(CHUNK_CACHE_SIZE_MB, CHUNK_CACHE_SIZE_MB_DEFAULT); double maxSizePercent = node.getDouble(CHUNK_CACHE_SIZE_PERCENT, CHUNK_CACHE_SIZE_PERCENT_DEFAULT); maxSizePercent = Math.max(1.0, Math.min(50.0, maxSizePercent)); maxSizeMb = Math.max(maxSizeMb, 1.0); long m1= (long) (Runtime.getRuntime().maxMemory() / 100.0 * maxSizePercent); return Math.min(m1, (long) (maxSizeMb * 1024.0 * 1024.0)); }
/** * {@inheritDoc} */ public double getDouble(String name) { return getNode().getDouble(name, DOUBLE_DEFAULT_DEFAULT); }
@Override public double getDouble(String name) { return getNode().getDouble(name, DOUBLE_DEFAULT_DEFAULT); }
/** * Returns the default double value stored in the {@link DefaultScope} for the given key * or the specified default value if the key does not appear in the {@link DefaultScope} * @param qualifier the preference qualifier * @param key the preference key * @param defaultvalue the default value * * @return the double value set in the {@link DefaultScope} for the given key, or the specified default value. */ public static synchronized double getDefaultDouble(String qualifier, String key, double defaultvalue) { return contexts[DEFAULT_CONTEXT].getNode(qualifier).getDouble(key, defaultvalue); }
/** * {@inheritDoc} */ public double getDouble(String name) { return getNode().getDouble(name, DOUBLE_DEFAULT_DEFAULT); }
@Override public double getDouble(String name) { return getNode().getDouble(name, DOUBLE_DEFAULT_DEFAULT); }
@Override public double getDouble(String name) { return getNode().getDouble(name, DOUBLE_DEFAULT_DEFAULT); }
@Override public double getDouble(String name) { return getNode().getDouble(name, DOUBLE_DEFAULT_DEFAULT); }
@Override public double getDefaultDouble(String name) { return getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT); }
/** * Returns the default value for the double-valued property * with the given name. * Returns the default-default value (<code>0.0</code>) if there * is no default property with the given name, or if the default * value cannot be treated as a double. * * @param name the name of the property * @return the default value of the named property */ @Override public double getDefaultDouble(String name) { return getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT); }
public double getDefaultDouble(String name) { return getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT); }
/** * Returns the current value of the double-valued property with the * given name. * Returns the default-default value (<code>0.0</code>) if there * is no property with the given name, or if the current value * cannot be treated as a double. * * @param name the name of the property * @return the double-valued property */ @Override public double getDouble(String name) { return getPluginPreferences(true).getDouble(name, getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT)); }
return Integer.valueOf(defaults.getInt(key, INT_DEFAULT_DEFAULT)); } else if (obj instanceof Double) { return Double.valueOf(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT)); } else if (obj instanceof Float) { return Float.valueOf(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT));
/** * Does its best at determining the default value for the given key. Checks * the given object's type and then looks in the list of defaults to see if * a value exists. If not or if there is a problem converting the value, the * default default value for that type is returned. * * @param key * the key to search * @param obj * the object who default we are looking for * @return Object or <code>null</code> */ Object getDefault(String key, Object obj) { IEclipsePreferences defaults = getDefaultPreferences(); if (obj instanceof String) { return defaults.get(key, STRING_DEFAULT_DEFAULT); } else if (obj instanceof Integer) { return Integer.valueOf(defaults.getInt(key, INT_DEFAULT_DEFAULT)); } else if (obj instanceof Double) { return Double.valueOf(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT)); } else if (obj instanceof Float) { return Float.valueOf(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT)); } else if (obj instanceof Long) { return Long.valueOf(defaults.getLong(key, LONG_DEFAULT_DEFAULT)); } else if (obj instanceof Boolean) { return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE; } else { return null; } }
/** * Does its best at determining the default value for the given key. Checks the * given object's type and then looks in the list of defaults to see if a value * exists. If not or if there is a problem converting the value, the default default * value for that type is returned. */ private Object getDefault(String key, Object obj) { IEclipsePreferences defaults = getDefaultPreferences(); if (obj instanceof String) return defaults.get(key, STRING_DEFAULT_DEFAULT); else if (obj instanceof Integer) return Integer.valueOf(defaults.getInt(key, INT_DEFAULT_DEFAULT)); else if (obj instanceof Double) return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT)); else if (obj instanceof Float) return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT)); else if (obj instanceof Long) return new Long(defaults.getLong(key, LONG_DEFAULT_DEFAULT)); else if (obj instanceof byte[]) return defaults.getByteArray(key, BYTE_ARRAY_DEFAULT_DEFAULT); else if (obj instanceof Boolean) return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE; else return null; }