org.gvsig.i18n.utils
Class DoubleProperties

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.TreeMap
          extended byorg.gvsig.i18n.utils.OrderedProperties
              extended byorg.gvsig.i18n.utils.DoubleProperties
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable, java.util.SortedMap

public class DoubleProperties
extends OrderedProperties

The DoubleProperties class represents a set of properties. It provides the same functionality as its parent class, Properties. Besides that, it also provides an efficient method to get the key associated with a value.

Author:
cesar
See Also:
Serialized Form

Constructor Summary
DoubleProperties()
           
DoubleProperties(OrderedProperties defaults)
           
 
Method Summary
 java.lang.String getAssociatedKey(java.lang.String value)
          Gets the key associated with the provided value.
 java.util.ArrayList getAssociatedKeys(java.lang.String value)
          Returns the keys associated with the provided value.
 void load(java.io.InputStream stream)
          Reads a property list from an input stream.
 java.lang.Object remove(java.lang.Object key)
           
 java.lang.Object setProperty(java.lang.String key, java.lang.String value)
          Adds the given key/value pair to this properties.
 
Methods inherited from class org.gvsig.i18n.utils.OrderedProperties
getProperty, getProperty, list, list, load, propertyNames, store, store
 
Methods inherited from class java.util.TreeMap
clear, clone, comparator, containsKey, containsValue, entrySet, firstKey, get, headMap, keySet, lastKey, put, putAll, size, subMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Constructor Detail

DoubleProperties

public DoubleProperties()

DoubleProperties

public DoubleProperties(OrderedProperties defaults)
Method Detail

load

public void load(java.io.InputStream stream)
          throws java.io.IOException
Description copied from class: OrderedProperties
Reads a property list from an input stream. The stream should have the following format:
An empty line or a line starting with # or ! is ignored. An backslash (\) at the end of the line makes the line continueing on the next line (but make sure there is no whitespace after the backslash). Otherwise, each line describes a key/value pair.
The chars up to the first whitespace, = or : are the key. You can include these caracters in the key, if you precede them with a backslash (\). The key is followed by optional whitespaces, optionally one = or :, and optionally some more whitespaces. The rest of the line is the resource belonging to the key.
Escape sequences \t, \n, \r, \\, \", \', \!, \#, \ (a space), and unicode characters with the \\uxxxx notation are detected, and converted to the corresponding single character.
# This is a comment
key     = value
k\:5      \ a string starting with space and ending with newline\n
# This is a multiline specification; note that the value contains
# no white space.
weekdays: Sunday,Monday,Tuesday,Wednesday,\\
       Thursday,Friday,Saturday
# The safest way to include a space at the end of a value:
label   = Name:\\u0020

Overrides:
load in class OrderedProperties
Parameters:
stream - the input stream
Throws:
java.io.IOException - if an error occurred when reading the input

setProperty

public java.lang.Object setProperty(java.lang.String key,
                                    java.lang.String value)
Description copied from class: OrderedProperties
Adds the given key/value pair to this properties. This calls the hashtable method put.

Overrides:
setProperty in class OrderedProperties
Parameters:
key - the key for this property
value - the value for this property
Returns:
The old value for the given key
See Also:
OrderedProperties.getProperty(String)

getAssociatedKey

public java.lang.String getAssociatedKey(java.lang.String value)
Gets the key associated with the provided value. If there are several associated keys, returns one of them.

Parameters:
value -
Returns:
The key associated with the provided value, or null if the value is not present in the dictionary. If there are several associated keys, returns one of them.

getAssociatedKeys

public java.util.ArrayList getAssociatedKeys(java.lang.String value)
Returns the keys associated with the provided value. If there are several associated keys, returns one of them.

Parameters:
value -
Returns:
An ArrayList containing the keys associated with the provided value, or null if the value is not present in the dictionary.

remove

public java.lang.Object remove(java.lang.Object key)