genopt.util
Class Preference

java.lang.Object
  extended by genopt.util.Preference

public class Preference
extends java.lang.Object

Object to read and store user preference.

This project was carried out at:

and supported by

GenOpt Copyright (c) 1998-2011, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

Version:
GenOpt(R) 3.1.0 (December 8, 2011)

Author:
Michael Wetter

Field Summary
protected  java.io.File file
          Preference file
protected  java.util.TreeMap<java.lang.String,java.lang.String> list
          list with settings
private static java.lang.String[][] MAP
          valid keywords
 
Constructor Summary
Preference(java.io.File preferenceFile)
          constructor
 
Method Summary
 void clear()
          Removes all mappings
 java.lang.Object get(java.lang.Object key)
          Returns the value to which this map maps the specified key.
static void main(java.lang.String[] args)
           
 java.lang.String put(java.lang.String key, java.lang.String value)
          Associates the specified value with the specified key in this map.
private  void setDefault()
          Sets default values.
 void write()
          Writes the Preference file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAP

private static final java.lang.String[][] MAP
valid keywords


list

protected java.util.TreeMap<java.lang.String,java.lang.String> list
list with settings


file

protected java.io.File file
Preference file

Constructor Detail

Preference

public Preference(java.io.File preferenceFile)
constructor

Parameters:
preferenceFile - the Preference file
Method Detail

setDefault

private void setDefault()
Sets default values.


put

public java.lang.String put(java.lang.String key,
                            java.lang.String value)
Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced.

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key.

get

public java.lang.Object get(java.lang.Object key)
Returns the value to which this map maps the specified key. Returns null if the map contains no mapping for this key. A return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

Parameters:
key - key whose associated value is to be returned.
Returns:
the value to which this map maps the specified key, or null if the map contains no mapping for the key.

clear

public void clear()
Removes all mappings


write

public void write()
Writes the Preference file


main

public static void main(java.lang.String[] args)