ilog.cpl.util
Class IlpDefaultValueMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          extended by ilog.cpl.util.IlpDefaultValueMap
All Implemented Interfaces:
IlpValueMap, Serializable, Cloneable, Map

public class IlpDefaultValueMap
extends HashMap
implements IlpValueMap

CPL mapping table implementation using hash map.

Note that this implementation does not ensure consistency between the key and value type declaration and the content of the map itself.

Compatibility Note: In JViews 8.0, this class was moved from ilog.cpl.service to ilog.cpl.util.

Since:
JViews 8.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
IlpDefaultValueMap(Class keyClass, Class valueClass)
          Constructs a new, empty mapping.
IlpDefaultValueMap(Class keyClass, Class valueClass, Map map)
          Constructs a new mapping from the given map.
 
Method Summary
 boolean addValue(Object key, Object value)
          Adds a new key-value set.
 Object clone()
          Returns a shallow copy of this instance: the keys and values themselves are not cloned.
 Class getKeyClass()
          Returns the Java type of the keys used in this mapping.
 Object getValue(Object key)
          Returns the value of the mapping for a specific key.
 Class getValueClass()
          Returns the type of the values returned by this mapping.
 
Methods inherited from class java.util.HashMap
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

IlpDefaultValueMap

public IlpDefaultValueMap(Class keyClass,
                          Class valueClass)
Constructs a new, empty mapping.

Parameters:
keyClass - The Java type of the keys in the mapping.
valueClass - The Java type of the values returned by the mapping.

IlpDefaultValueMap

public IlpDefaultValueMap(Class keyClass,
                          Class valueClass,
                          Map map)
Constructs a new mapping from the given map.

Parameters:
keyClass - The Java type of the keys in the mapping.
valueClass - The Java type of the values returned by the mapping.
map - The map to be copied into this one.
Method Detail

clone

public Object clone()
Returns a shallow copy of this instance: the keys and values themselves are not cloned.

Overrides:
clone in class HashMap
Returns:
A shallow copy of this mapping.

getKeyClass

public Class getKeyClass()
Returns the Java type of the keys used in this mapping.

Specified by:
getKeyClass in interface IlpValueMap
Returns:
The Java type of the keys.

getValueClass

public Class getValueClass()
Returns the type of the values returned by this mapping. As this type may be any kind of Object, the result of this method is an Object.

Specified by:
getValueClass in interface IlpValueMap
Returns:
The type of the returned values.

getValue

public Object getValue(Object key)
Returns the value of the mapping for a specific key.

Specified by:
getValue in interface IlpValueMap
Parameters:
key - The key for which to get the value.
Returns:
Value associated with the key.

addValue

public boolean addValue(Object key,
                        Object value)
Adds a new key-value set.

Specified by:
addValue in interface IlpValueMap
Parameters:
key - The key for the mapping. The key may be null.
value - The value to be added. The value may be null.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.