Interface COM.odi.coll.Dictionary_int

public interface Dictionary_int
extends Bag
A Dictionary_int is an unordered collection, in which each element is associated with a key of type int. There can be many elements with the same value, like any bag. There can also be many elements with the same key, unless the SIGNAL_DUP_KEYS behavior is set. However, there can be only one element with a particular key and value. Null elements are not allowed.

See Also:
Collection, Bag

Variable Index

 o DONT_MAINTAIN_CARDINALITY
This behavior flag indicates that the dictionary does not keep track of its own cardinality (the number of elements in the collection) by increasing and decreasing a counter when elements are inserted and deleted.
 o SIGNAL_DUP_KEYS
This behavior flag indicates that duplicate keys are not allowed in the dictionary.

Method Index

 o contains(int, Object)
Indicates whether or not there is at least one element in the dictionary that has the specified key and value.
 o countValues(int)
Obtains the number of entries in the dictionary that have the specified key.
 o insert(int, Object)
Inserts an element with the specified key value into the dictionary.
 o pick(int)
Obtains an element that has the specified key in the dictionary.
 o remove(int, Object)
Removes an element from the dictionary, with exactly the specified key and value.
 o removeValue(int, int)
Removes n entries from the dictionary that have the given key.
 o retrieveKey(Cursor)
Obtains the key associated with the element that the cursor is positioned at.
 o set(Dictionary_int)
Sets the contents of this dictionary to be the same as the contents of otherDictionary.

Variables

 o SIGNAL_DUP_KEYS
  public final static int SIGNAL_DUP_KEYS
This behavior flag indicates that duplicate keys are not allowed in the dictionary. When SIGNAL_DUP_KEYS is specified, an attempt to insert an element with a key that is already present throws DuplicateKeyException. The default is that it is okay for two distinct elements in a dictionary to have the same key.

 o DONT_MAINTAIN_CARDINALITY
  public final static int DONT_MAINTAIN_CARDINALITY
This behavior flag indicates that the dictionary does not keep track of its own cardinality (the number of elements in the collection) by increasing and decreasing a counter when elements are inserted and deleted. The reason for not maintaining the cardinality is to improve the concurrency behavior of insertions and deletions. An attempt to obtain the cardinality computes the cardinality by counting the elements. You can use the cardinalityEstimate() and updateCardinality() methods to obtain and update approximations of the cardinality.

Methods

 o insert
  public abstract void insert(int k,
                              Object o)
Inserts an element with the specified key value into the dictionary. If there is already an element in the dictionary with the same key and the same value, this method does nothing.

Parameters:
k - The key of the element to be inserted.
o - The element to insert.

Throws: DuplicateKeyException
If the dictionary has SIGNAL_DUP_KEYS behavior and some element of the dictionary already has this key.
Throws: ModifyTransientCollectionException
If the collection is transient.
Throws: NullPointerException
If the element is null.
Throws: ObjectNotExportedException
If the collection and the key, or the collection and the value being inserted, are in different segments and the item is not exported.
Throws: ObjectNotPersistenceCapableException
If the object is not persistence-capable.
 o remove
  public abstract void remove(int k,
                              Object o)
Removes an element from the dictionary, with exactly the specified key and value. If there is no element with this key and value, this method does nothing.

Parameters:
k - The key of the element to be removed.
o - The element to remove.

Throws: ModifyTransientCollectionException
If the collection is transient.
 o removeValue
  public abstract Object removeValue(int k,
                                     int n)
Removes n entries from the dictionary that have the given key. If there are fewer than n such entries, remove all of them. If there are no such entries, this method does nothing.

Returns:
One of the elements that was removed, or null if no element was removed.
Throws: ModifyTransientCollectionException
If the collection is transient.
 o countValues
  public abstract int countValues(int k)
Obtains the number of entries in the dictionary that have the specified key.

Parameters:
k - The key for which you want to know how many elements there are.

Returns:
The number of elements with the specified key.
 o contains
  public abstract boolean contains(int k,
                                   Object o)
Indicates whether or not there is at least one element in the dictionary that has the specified key and value.

Parameters:
k - The key that you are inquiring about.
o - The element value that you are inquiring about.

Returns:
True if there is at least one element in the dictionary with the specified key and value. False if otherwise.
 o retrieveKey
  public abstract int retrieveKey(Cursor c)
Obtains the key associated with the element that the cursor is positioned at. It is your responsibility to ensure that the cursor is valid.

Parameters:
c - The cursor for which you want the current key.

Returns:
The key associated with the pointed-to element.

Throws: NullCursorException
If the cursor is null.
 o pick
  public abstract Object pick(int key)
Obtains an element that has the specified key in the dictionary. If there is more than one such element, this method picks an arbitrary one. If there is no such element and the dictionary has PICK_FROM_EMPTY_RETURNS_NULL behavior, this method returns null. If there is no such element and the dictionary does not have PICK_FROM_EMPTY_RETURNS_NULL behavior, this method throws NoSuchElementException.

Parameters:
key - The key to search for.

Throws: NoSuchElementException
If the key is not found and PICK_FROM_EMPTY_RETURNS_NULL behavior is on.
 o set
  public abstract void set(Dictionary_int otherDictionary)
Sets the contents of this dictionary to be the same as the contents of otherDictionary. ObjectStore makes the dictionary empty, and then inserts each of the elements of otherDictionary into the collection.

Parameters:
otherDictionary - The dictionary whose elements you want to place in this dictionary.

Throws: ModifyTransientCollectionException
If this dictionary is transient.
Throws: ObjectNotExportedException
If there are objects in otherDictionary that are not exported and are stored in a different segment from this dictionary.

Copyright © 1996, 1997, 1998 Object Design, Inc. All rights reserved.