|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.connectivity.KeyValueTable<K,V>
K - Key typeV - Value typepublic final class KeyValueTable<K,V>
An object that maps keys to values. A map cannot contain duplicate keys; each
key can map to at most one value.
Key-Value mappings are loaded from database via execute() method or
on first call of any data-retrieving method
The value mapping for given key can be obtained using get(Object)
method call
This object is only available in the AnyLogic Professional
| Constructor Summary | |
|---|---|
KeyValueTable(java.lang.String name,
Database database,
java.lang.String tableName,
java.lang.String keyColumn,
java.lang.String valueColumn)
Creates KeyValueTable based on the table with given
tableName |
|
| Method Summary | |
|---|---|
boolean |
containsKey(java.lang.Object key)
Returns true if this KeyValueTable contains a mapping
for the specified key. |
boolean |
containsValue(java.lang.Object value)
Returns true if this KeyValueTable maps one or more
keys to the specified value. |
void |
destroy()
Releases resources acquired by this object Also destroys all not destroyed contributors associated with this object Doest nothing if object is already destroyed |
void |
execute()
Loads (reloads) Key-Value mappings from database table This method is automatically invoked if data is not loaded on first data-retrieving method call |
V |
get(K key)
Returns the value to which the specified key is mapped, or null
if this KeyValueTable contains no mapping for the key. |
java.lang.String |
getName()
Returns the name of this object |
boolean |
isEmpty()
Returns true if this KeyValueTable contains no
key-value mappings. |
java.util.Set<K> |
keySet()
Returns a Set view of the keys contained in this table. |
int |
size()
Returns the number of key-value mappings in this KeyValueTable. |
java.lang.String |
toString()
|
java.util.Collection<V> |
values()
Returns a Collection view of the values contained in this
KeyValueTable. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public KeyValueTable(java.lang.String name,
Database database,
java.lang.String tableName,
java.lang.String keyColumn,
java.lang.String valueColumn)
KeyValueTable based on the table with given
tableName
name - object name (decoration purpose)database - database to connect totableName - name of table with Key-Value mappingskeyColumn - Key column name in the tablevalueColumn - Value column name in the table| Method Detail |
|---|
public void execute()
public V get(K key)
null
if this KeyValueTable contains no mapping for the key.
More formally, if this KeyValueTable contains a mapping from a
key k to a value v such that
(key==null ? k==null : key.equals(k)), then this method returns
v; otherwise it returns null. (There can be at most one
such mapping.)
A return value of null does not necessarily indicate that
the KeyValueTable contains no mapping for the key; it's also
possible that the KeyValueTable explicitly maps the key to
null. The containsKey operation may be used
to distinguish these two cases.
key - the key whose associated value is to be returned
null
if this KeyValueTable contains no mapping for the keypublic java.util.Set<K> keySet()
Set view of the keys contained in this table. The set
is unmodifiable.
KeyValueTablepublic boolean containsKey(java.lang.Object key)
KeyValueTable contains a mapping
for the specified key. More formally, returns true if and only
if this KeyValueTable contains a mapping for a key k
such that (key==null ? k==null : key.equals(k)). (There can
be at most one such mapping.)
key - key whose presence in this KeyValueTable is to be
tested
KeyValueTable contains a mapping
for the specified keypublic boolean containsValue(java.lang.Object value)
KeyValueTable maps one or more
keys to the specified value. More formally, returns true if
and only if this KeyValueTable contains at least one mapping to a
value v such that
(value==null ? v==null : value.equals(v)). This operation
will require time linear in the KeyValueTable size.
value - value whose presence in this KeyValueTable is to be
tested
KeyValueTable maps one or more
keys to the specified valuepublic boolean isEmpty()
KeyValueTable contains no
key-value mappings.
KeyValueTable contains no
key-value mappingspublic int size()
KeyValueTable.
If the KeyValueTable contains more than
Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
KeyValueTablepublic java.util.Collection<V> values()
Collection view of the values contained in this
KeyValueTable. The collection is unmodifiable.
KeyValueTablepublic final java.lang.String getName()
public final void destroy()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||