Class DoublePreference


  • public class DoublePreference
    extends Preference
    A class which represents a double-valued preference
    • Constructor Summary

      Constructors 
      Constructor Description
      DoublePreference​(java.lang.String name, double value)
      Create a DoublePreference object tracking the preference with the given name and default value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double get()
      Get the current value of the preferences file entry, or the default if no entry exists.
      protected boolean hasChanged()
      Check if the value has changed since last being checked, or if this is the first time this method was called and the value has changed from the default.
      protected void putDefaultValue()
      Put an entry with the default value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DoublePreference

        public DoublePreference​(java.lang.String name,
                                double value)
        Create a DoublePreference object tracking the preference with the given name and default value. Calling this function does not yet modify the preferences file.
        Parameters:
        name - The string id of the preference
        value - The default value
    • Method Detail

      • hasChanged

        protected boolean hasChanged()
        Check if the value has changed since last being checked, or if this is the first time this method was called and the value has changed from the default.
        Specified by:
        hasChanged in class Preference
        Returns:
        true if the value has changed, false otherwise
      • putDefaultValue

        protected void putDefaultValue()
        Put an entry with the default value.
        Specified by:
        putDefaultValue in class Preference
      • get

        public double get()
        Get the current value of the preferences file entry, or the default if no entry exists.
        Returns:
        The value of the preference
        See Also:
        Preferences.getDouble(String, double)