Package com.luciad.util
Class TLcdAssocList
java.lang.Object
com.luciad.util.TLcdAssocList
- All Implemented Interfaces:
ILcdAssocSet
,Serializable
This class provides an implementation of
ILcdAssocSet
.- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a new empty TLcdAssocList.TLcdAssocList
(ILcdAssoc[] aAssocArray) Creates a newTLcdAssocList
from an array ofILcdAssoc
objects.TLcdAssocList
(ILcdAssocSet aAssocSet) Creates a newTLcdAssocList
that has the same key/value pairs as the the given ILcdAssocSet.TLcdAssocList
(Object[] aKeys, Object[] aValues) Creates a newTLcdAssocList
from an array of keys and an array of values. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an association to this set.elements()
int
Gets the value associated with the given key.boolean
Tests if the set has a value for the given key.keys()
void
Adds an association having with a given value and a given key to this set.Removes the association with the given key.void
Removes all the associations.void
Sets the associations as an array ofILcdAssoc
objects.int
size()
-
Constructor Details
-
TLcdAssocList
public TLcdAssocList()Creates a new empty TLcdAssocList. -
TLcdAssocList
Creates a newTLcdAssocList
from an array of keys and an array of values. If the arrays have different sizes, the longest one will be truncated.- Parameters:
aKeys
- the list of keys.aValues
- the corresponding list of values.
-
TLcdAssocList
Creates a newTLcdAssocList
that has the same key/value pairs as the the given ILcdAssocSet. The ILcdAssoc objects are copied as well.- Parameters:
aAssocSet
- the ILcdAssoc to be copied.
-
TLcdAssocList
Creates a newTLcdAssocList
from an array ofILcdAssoc
objects.- Parameters:
aAssocArray
- the ILcdAssoc objects to be inserted.
-
-
Method Details
-
size
public int size()- Specified by:
size
in interfaceILcdAssocSet
- Returns:
- the number of associations in this
ILcdAssocSet
.
-
keys
- Specified by:
keys
in interfaceILcdAssocSet
- Returns:
- an enumeration of the keys.
-
elements
- Specified by:
elements
in interfaceILcdAssocSet
- Returns:
- an enumeration of the values.
-
getAssocs
- Specified by:
getAssocs
in interfaceILcdAssocSet
- Returns:
- the associations as an array of
ILcdAssoc
objects.
-
setAssocs
Description copied from interface:ILcdAssocSet
Sets the associations as an array ofILcdAssoc
objects.- Specified by:
setAssocs
in interfaceILcdAssocSet
-
add
Description copied from interface:ILcdAssocSet
Adds an association to this set. If an association with the same key already exists, it will be replaced by the given one.- Specified by:
add
in interfaceILcdAssocSet
- Parameters:
aAssoc
- the association to be added.
-
put
Description copied from interface:ILcdAssocSet
Adds an association having with a given value and a given key to this set. If an association with the same key already exists, it will be replaced by the given one.- Specified by:
put
in interfaceILcdAssocSet
- Parameters:
aKey
- the key.aValue
- the value.
-
remove
Description copied from interface:ILcdAssocSet
Removes the association with the given key. If the given association does not exist, no action will be performed.- Specified by:
remove
in interfaceILcdAssocSet
- Parameters:
aKey
- the key of the association to be removed.- Returns:
- the value corresponding to the key, or
null
if the key does not exist.
-
removeAll
public void removeAll()Description copied from interface:ILcdAssocSet
Removes all the associations.- Specified by:
removeAll
in interfaceILcdAssocSet
-
findIndex
-
hasValue
Description copied from interface:ILcdAssocSet
Tests if the set has a value for the given key.- Specified by:
hasValue
in interfaceILcdAssocSet
- Parameters:
aKey
- the key to look up.- Returns:
- true if the given key has a corresponding value, false otherwise.
-
getValue
Description copied from interface:ILcdAssocSet
Gets the value associated with the given key.- Specified by:
getValue
in interfaceILcdAssocSet
- Parameters:
aKey
- the key to look up.- Returns:
- the value corresponding to the key, or
null
if the key does not exist.
-
cloneAsILcdAssocSet
- Specified by:
cloneAsILcdAssocSet
in interfaceILcdAssocSet
- Returns:
- a clone of this
ILcdAssocSet
.
-