com.partnersoft.data
Class Naming<V>
java.lang.Object
com.partnersoft.data.Naming<V>
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map<java.lang.String,V>
public class Naming<V>
- extends java.lang.Object
- implements java.util.Map<java.lang.String,V>, java.lang.Cloneable
An auto-sorted, string-indexed association.
A "naming" is an association between unique names and (possibly non-unique)
values. In Java terms, it is a special case of String-indexed
Map, where the keys are compared and looked up
case-insensitively. Thus, it implements Map<String, V>.
This use of the term "naming" has nothing whatsoever to do with
Naming.
This implementation does not automatically sort the entries by name; instead
order is based on the order of the original data (if copied from lists or a
Map) or based on insertion order. Removing a value, then putting it in again,
will place it at the end of the list. We may add additional re-ordering
methods later to help with e.g. GUI interfaces.
Use com.partnersoft.data.SortedNaming if you want your values
auto-sorted.
Copyright 2003-2006 Partner Software, Inc.
- Version:
- $Id$
- Author:
- Paul Reavis
| Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
|
Constructor Summary |
Naming()
|
Naming(java.util.List<java.lang.String> names,
java.util.List<V> values)
|
Naming(java.util.List<java.lang.String> names,
java.util.List<V> values,
boolean orderPreserving)
|
Naming(java.util.Map<? extends java.lang.String,? extends V> map)
|
Naming(java.lang.String[] names,
V[] values)
|
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Naming
public Naming()
Naming
public Naming(java.util.List<java.lang.String> names,
java.util.List<V> values)
Naming
public Naming(java.util.List<java.lang.String> names,
java.util.List<V> values,
boolean orderPreserving)
- Parameters:
names - values - orderPreserving -
Naming
public Naming(java.util.Map<? extends java.lang.String,? extends V> map)
Naming
public Naming(java.lang.String[] names,
V[] values)
clear
public void clear()
- Specified by:
clear in interface java.util.Map<java.lang.String,V>
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKey in interface java.util.Map<java.lang.String,V>
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValue in interface java.util.Map<java.lang.String,V>
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,V>> entrySet()
- Specified by:
entrySet in interface java.util.Map<java.lang.String,V>
equals
public boolean equals(java.lang.Object nother)
- Specified by:
equals in interface java.util.Map<java.lang.String,V>- Overrides:
equals in class java.lang.Object
get
public V get(java.lang.Object key)
- Specified by:
get in interface java.util.Map<java.lang.String,V>
hashCode
public int hashCode()
- Specified by:
hashCode in interface java.util.Map<java.lang.String,V>- Overrides:
hashCode in class java.lang.Object
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface java.util.Map<java.lang.String,V>
keySet
public java.util.Set<java.lang.String> keySet()
- Specified by:
keySet in interface java.util.Map<java.lang.String,V>
put
public V put(java.lang.String key,
V value)
- Specified by:
put in interface java.util.Map<java.lang.String,V>
putAll
public void putAll(java.util.Map<? extends java.lang.String,? extends V> t)
- Specified by:
putAll in interface java.util.Map<java.lang.String,V>
remove
public V remove(java.lang.Object key)
- Specified by:
remove in interface java.util.Map<java.lang.String,V>
size
public int size()
- Specified by:
size in interface java.util.Map<java.lang.String,V>
values
public java.util.Collection<V> values()
- Specified by:
values in interface java.util.Map<java.lang.String,V>
setValue
public void setValue(java.lang.String key,
V value)
getValue
public V getValue(java.lang.String key)
removeValue
public V removeValue(java.lang.String key)
getSize
public int getSize()
getNameAt
public java.lang.String getNameAt(int i)
getValueAt
public V getValueAt(int index)
setOrderPreserving
public void setOrderPreserving(boolean orderPreserving)
- Not sure what to do here, so it just logs a warning.
- Parameters:
orderPreserving -
createUniqueNameWithPrefix
public java.lang.String createUniqueNameWithPrefix(java.lang.String prefix)
- Parameters:
prefix -
- Returns:
-
- Throws:
java.lang.UnsupportedOperationException - because it's not implemented.
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
clone
public java.lang.Object clone()
- Overrides:
clone in class java.lang.Object