## edu.cwru.SimpleRTS.util
Class Preferences

    java.lang.Object
      edu.cwru.SimpleRTS.util.Preferences

    public final class Preferences

extends java.lang.Object

Manages a list of preferences and allows for saving to/loading from a file.

Author:
  Tim

Method Summary
`java.util.Set<java.lang.String>` `existingPreferences()` Returns a read-only view of the names of all registered preferences.
`static Preferences` `getInstance()`
`java.lang.String` `getPreference(java.lang.String key)` Returns the value of the preference indicated by the given key, or null if no such preference is registered.
`boolean` `load(java.lang.String filename)` Attempts to load a set of preferences from a file.
`java.lang.String` `putPreference(java.lang.String key, java.lang.String value)` Registers or overwrites a preference.
`boolean` `save()` Stores the current set of preferences to the file set by `load(String)` or `saveAs(String)`.
`boolean` `saveAs(java.lang.String filename)` Sets the name of the file to which the preferences should be saved and then saves.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    public static Preferences getInstance()

### load

    public boolean load(java.lang.String filename)

  Attempts to load a set of preferences from a file.

  Parameters:
    `filename` - - the name of the file from which to load preferences
  Returns:
    whether an error occurred when opening the file

### save

    public boolean save()

  Stores the current set of preferences to the file set by `load(String)` or `saveAs(String)`.

  Returns:
    whether or not an error occurred when opening the file

### saveAs

    public boolean saveAs(java.lang.String filename)

  Sets the name of the file to which the preferences should be saved and then saves.

  Parameters:
    `filename` - - the name of the file to which to save preferences
  Returns:
    whether there was an error when opening the file

### getPreference

    public java.lang.String getPreference(java.lang.String key)

  Returns the value of the preference indicated by the given key, or null if no such preference is registered.

  Parameters:
    `key` - - the name of the preference
  Returns:
    the value of the preference or null

### putPreference

    public java.lang.String putPreference(java.lang.String key,
                                          java.lang.String value)

  Registers or overwrites a preference.

  Parameters:
    `key` - - the name of the preference
    `value` - - the value of the preference
  Returns:
    the previous value of the preference if it was overwritten, or null otherwise

### existingPreferences

    public java.util.Set<java.lang.String> existingPreferences()

  Returns a read-only view of the names of all registered preferences.

  Returns: