All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface uhr.core.tron.PropMap

public interface PropMap
extends ConvenientStringMap, Cloneable, Serializable
This interface defines a configurable key value data structure similar to Hashtable. Its outstanding characteristic is it can also automatically support tree like behavior, allowing it be used as a param, tree, etc. We expect to add more configurable properties.

Keys must be Strings with no spaces allowed. All configurable properties have sensible defaults. The configurable properties are:

 
    isNullValueAllowed()
    isOrderedKeys()
    getNestedKeySeparator()
 
The implementation should have a no arg constructor and other constructors for configuration.

NOTE - We are planning to remove this since replaced by Flexitron. First we will add the ability to auto create with nested keys.


Method Index

 o clone()
Returns a shallow copy of the object.
 o containsKey(String)
Returns true if the collection contains the key, false if not.
 o containsValue(Object)
Returns true if the collection contains the value, false if not.
 o findFirstKey(Object)
Returns the first key found for the value, or null if not found.
 o get(String)
Returns the value to which the specified key is mapped in this collection.
 o getKeys()
Returns an enumeration of the keys in this collection.
 o getNestedKeySeparator()
Returns the nested key separator or null if none in use.
 o getSize()
Returns the number of key values in the collection, which may be zero.
 o insertBefore(String, Object, String)
Inserts the key and value before the keyBefore.
 o isEmpty()
Returns true if the collection is empty or false if not.
 o isNullValueAllowed()
Returns true if null values are allowed, false if not.
 o isOrderedKeys()
Returns true if ordered keys are maintained, false if not.
 o isTree()
Returns true if a non-null nested key separator has been set.
 o put(String, Object)
Puts the value in the collection and associates it with the key for retrival.
 o removeAll()
Removes all keys and values from the collection.
 o removeKey(String)
Removes the key and its value.
 o removeValue(Object)
Removes all occurances of the key for this value.
 o toString()
Returns a comma delimited string of key/values, for example: "[Name=Pantajeli, Age=11]".

Methods

 o isNullValueAllowed
 public abstract boolean isNullValueAllowed()
Returns true if null values are allowed, false if not. The default is false.

Returns:
whether null values are allowed or not.
 o isOrderedKeys
 public abstract boolean isOrderedKeys()
Returns true if ordered keys are maintained, false if not. The default is false.

If true the keys are maintained in the order added. This allows the order of keys to be preserved, instead of being random. An example of usefulness is to preserve the order of a visual tree or list.

Returns:
whether ordered keys are maintained or not.
 o getNestedKeySeparator
 public abstract String getNestedKeySeparator()
Returns the nested key separator or null if none in use. The default is null.

The separator is used for reads and writes with nested keys, such as "State.County.Town". This allows very efficient use of keys for tree structures. This is only useful if a tree is being used and single keys don't have the separator. The default is null, meaning none. Common, safe key separators are "." and "/".

If a key separator has been set, reads and writes will use automatic nesting, which occurs if a separator is present in the key.

For example put("Georgia.Dekalb.Clarkston", "2000") would put "2000" into the path using the key. The call get("Georgia.Dekalb.Clarkston") would return "2000", as expected. But the call get("Georgia.Dekalb") returns an OmniTron, and can be followed by omniTron.get("Clarkston") which returns "2000". Thus nested OmniTrons can be used to create a clean, easy to use, tree structure.

Returns:
the nested key separator or null if none.
 o isTree
 public abstract boolean isTree()
Returns true if a non-null nested key separator has been set. The default is false.

Returns:
whether a nested key separator is in use fot a tree data structure or not.
 o put
 public abstract Object put(String key,
                            Object value)
Puts the value in the collection and associates it with the key for retrival. Any previous value is overwritten.

Parameters:
key - the unique identifier for the value.
value - the Object to associate with the key.
Returns:
the previous value with the key, or null if none or the value was null.
 o insertBefore
 public abstract void insertBefore(String key,
                                   Object value,
                                   String keyBefore)
Inserts the key and value before the keyBefore. This is only allowed for ordered collections. The keyBefore must already be in the collection and the key must not already be in the collection.

Parameters:
key - the unique identifier for the value.
value - the Object to associate with the key.
keyBefore - the key to insert the key/value before.
 o removeKey
 public abstract Object removeKey(String key)
Removes the key and its value.

Parameters:
key - the key to remove.
Returns:
the value removed, or null if none or the value was null.
 o removeValue
 public abstract int removeValue(Object value)
Removes all occurances of the key for this value. If the value is null and null values are allowed, then all keys with null values are removed, so be careful. :-)

Parameters:
value - the value to remove all occurances of.
Returns:
the number of keys removed.
 o removeAll
 public abstract void removeAll()
Removes all keys and values from the collection. Has no effect on the configuration.

 o get
 public abstract Object get(String key)
Returns the value to which the specified key is mapped in this collection.

Parameters:
key - the key of the value to retrieve.
Returns:
the value for the key, or null if not found or null if the value was null.
 o getKeys
 public abstract Enumeration getKeys()
Returns an enumeration of the keys in this collection.

Returns:
an enumeration of all the keys, in order if ordered keys.
 o getSize
 public abstract int getSize()
Returns the number of key values in the collection, which may be zero. Note this doesn't include children if a tree.

Returns:
the size of the collection.
 o isEmpty
 public abstract boolean isEmpty()
Returns true if the collection is empty or false if not.

Returns:
true if empty or false if not.
 o containsKey
 public abstract boolean containsKey(String key)
Returns true if the collection contains the key, false if not.

Parameters:
key - the key to test.
Returns:
true if the collection contains the key, false if not.
 o containsValue
 public abstract boolean containsValue(Object value)
Returns true if the collection contains the value, false if not. Note that if null values are allowed and the value is null, then the value may be associated with more than one key.

Parameters:
value - the value to test.
Returns:
true if the collection contains the value, false if not.
 o findFirstKey
 public abstract String findFirstKey(Object value)
Returns the first key found for the value, or null if not found. This may be only useful for ordered keys.

Parameters:
value - the value to use to find the key.
Returns:
the key found or null if not foubd.
 o toString
 public abstract String toString()
Returns a comma delimited string of key/values, for example: "[Name=Pantajeli, Age=11]". If a tree then a tree format is used. Both are designed to be easily readable.

Returns:
the String representation of the collection.
Overrides:
toString in class Object
 o clone
 public abstract Object clone()
Returns a shallow copy of the object.

Returns:
a shallow copy of the object.
Overrides:
clone in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index