Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

com::sleepycat::collections::StoredMap Class Reference

Inheritance diagram for com::sleepycat::collections::StoredMap:

com::sleepycat::collections::StoredContainer com::sleepycat::collections::StoredSortedMap

Public Member Functions

 StoredMap (Database database, EntryBinding keyBinding, EntryBinding valueBinding, boolean writeAllowed)
 StoredMap (Database database, EntryBinding keyBinding, EntryBinding valueBinding, PrimaryKeyAssigner keyAssigner)
 StoredMap (Database database, EntryBinding keyBinding, EntityBinding valueEntityBinding, boolean writeAllowed)
 StoredMap (Database database, EntryBinding keyBinding, EntityBinding valueEntityBinding, PrimaryKeyAssigner keyAssigner)
Object get (Object key)
Object put (Object key, Object value)
Object append (Object value)
Object remove (Object key)
boolean containsKey (Object key)
boolean containsValue (Object value)
void putAll (Map map)
Set keySet ()
Set entrySet ()
Collection values ()
Collection duplicates (Object key)
boolean equals (Object other)
String toString ()

Package Functions

void initAfterClone ()

Detailed Description

A Map view of a Database.

Note that this class does not conform to the standard Java collections interface in the following ways:

In addition to the standard Map methods, this class provides the following methods for stored maps only. Note that the use of these methods is not compatible with the standard Java collections interface.

Author:
Mark Hayes

Definition at line 46 of file StoredMap.java.


Constructor & Destructor Documentation

com::sleepycat::collections::StoredMap::StoredMap Database  database,
EntryBinding  keyBinding,
EntryBinding  valueBinding,
boolean  writeAllowed
[inline]
 

Creates a map view of a Database.

Parameters:
database is the Database underlying the new collection.
keyBinding is the binding used to translate between key buffers and key objects.
valueBinding is the binding used to translate between value buffers and value objects.
writeAllowed is true to create a read-write collection or false to create a read-only collection.
Exceptions:
IllegalArgumentException if formats are not consistently defined or a parameter is invalid.
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Definition at line 72 of file StoredMap.java.

com::sleepycat::collections::StoredMap::StoredMap Database  database,
EntryBinding  keyBinding,
EntryBinding  valueBinding,
PrimaryKeyAssigner  keyAssigner
[inline]
 

Creates a map view of a Database with a PrimaryKeyAssigner. Writing is allowed for the created map.

Parameters:
database is the Database underlying the new collection.
keyBinding is the binding used to translate between key buffers and key objects.
valueBinding is the binding used to translate between value buffers and value objects.
keyAssigner is used by the append method to assign primary keys.
Exceptions:
IllegalArgumentException if formats are not consistently defined or a parameter is invalid.
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Definition at line 101 of file StoredMap.java.

com::sleepycat::collections::StoredMap::StoredMap Database  database,
EntryBinding  keyBinding,
EntityBinding  valueEntityBinding,
boolean  writeAllowed
[inline]
 

Creates a map entity view of a Database.

Parameters:
database is the Database underlying the new collection.
keyBinding is the binding used to translate between key buffers and key objects.
valueEntityBinding is the binding used to translate between key/value buffers and entity value objects.
writeAllowed is true to create a read-write collection or false to create a read-only collection.
Exceptions:
IllegalArgumentException if formats are not consistently defined or a parameter is invalid.
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Definition at line 130 of file StoredMap.java.

com::sleepycat::collections::StoredMap::StoredMap Database  database,
EntryBinding  keyBinding,
EntityBinding  valueEntityBinding,
PrimaryKeyAssigner  keyAssigner
[inline]
 

Creates a map entity view of a Database with a PrimaryKeyAssigner. Writing is allowed for the created map.

Parameters:
database is the Database underlying the new collection.
keyBinding is the binding used to translate between key buffers and key objects.
valueEntityBinding is the binding used to translate between key/value buffers and entity value objects.
keyAssigner is used by the append method to assign primary keys.
Exceptions:
IllegalArgumentException if formats are not consistently defined or a parameter is invalid.
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Definition at line 159 of file StoredMap.java.


Member Function Documentation

Object com::sleepycat::collections::StoredMap::append Object  value  )  [inline]
 

Appends a given value returning the newly assigned key. If a PrimaryKeyAssigner is associated with Store for this map, it will be used to assigned the returned key. Otherwise the Store must be a QUEUE or RECNO database and the next available record number is assigned as the key. This method does not exist in the standard Map interface.

Note that for the JE product, QUEUE and RECNO databases are not supported, and therefore a PrimaryKeyAssigner must be associated with the map in order to call this method.

Parameters:
value the value to be appended.
Returns:
the assigned key.
Exceptions:
UnsupportedOperationException if the collection is indexed, or if the collection is read-only, or if the Store has no PrimaryKeyAssigner and is not a QUEUE or RECNO database.
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Definition at line 284 of file StoredMap.java.

References com::sleepycat::collections::DataView::append().

boolean com::sleepycat::collections::StoredMap::containsKey Object  key  )  [inline]
 

Returns true if this map contains the specified key. This method conforms to the Map#containsKey interface.

Exceptions:
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Reimplemented from com::sleepycat::collections::StoredContainer.

Definition at line 322 of file StoredMap.java.

boolean com::sleepycat::collections::StoredMap::containsValue Object  value  )  [inline]
 

Returns true if this map contains the specified value. When an entity binding is used, this method returns whether the map contains the primary key and value mapping of the entity. This method conforms to the Map#containsValue interface.

Exceptions:
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Reimplemented from com::sleepycat::collections::StoredContainer.

Definition at line 336 of file StoredMap.java.

Collection com::sleepycat::collections::StoredMap::duplicates Object  key  )  [inline]
 

Returns a new collection containing the values mapped to the given key in this map. This collection's iterator() method is particularly useful for iterating over the duplicates for a given key, since this is not supported by the standard Map interface. This method does not exist in the standard Map interface.

Note that the return value is a StoredCollection and must be treated as such; for example, its iterators must be explicitly closed.

If no mapping for the given key is present, an empty collection is returned. If duplicates are not allowed, at most a single value will be in the collection returned. If duplicates are allowed, the returned collection's add() method may be used to add values for the given key.

Parameters:
key is the key for which values are to be returned.
Exceptions:
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Definition at line 464 of file StoredMap.java.

References com::sleepycat::collections::DataView::valueSetView().

Set com::sleepycat::collections::StoredMap::entrySet  )  [inline]
 

Returns a set view of the mappings contained in this map. A java.util.SortedSet is returned if the map is ordered. The returned collection will be read-only if the map is read-only. This method conforms to the Map#entrySet() interface.

Note that the return value is a StoredCollection and must be treated as such; for example, its iterators must be explicitly closed.

Returns:
a StoredEntrySet or a StoredSortedEntrySet for this map.
Exceptions:
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.
See also:
isOrdered

isWriteAllowed

Definition at line 413 of file StoredMap.java.

Referenced by equals(), collections::ship::index::SampleViews::getPartEntrySet(), collections::ship::index::SampleViews::getShipmentEntrySet(), collections::ship::index::SampleViews::getSupplierEntrySet(), and toString().

boolean com::sleepycat::collections::StoredMap::equals Object  other  )  [inline]
 

Compares the specified object with this map for equality. A value comparison is performed by this method and the stored values are compared rather than calling the equals() method of each element. This method conforms to the Map#equals interface.

Exceptions:
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Definition at line 485 of file StoredMap.java.

References entrySet().

Object com::sleepycat::collections::StoredMap::get Object  key  )  [inline]
 

Returns the value to which this map maps the specified key. If duplicates are allowed, this method returns the first duplicate, in the order in which duplicates are configured, that maps to the specified key.

This method conforms to the Map#get interface.

Exceptions:
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Reimplemented from com::sleepycat::collections::StoredContainer.

Definition at line 226 of file StoredMap.java.

void com::sleepycat::collections::StoredMap::initAfterClone  )  [inline, package]
 

Override this method to initialize view-dependent fields.

Reimplemented from com::sleepycat::collections::StoredContainer.

Definition at line 177 of file StoredMap.java.

Set com::sleepycat::collections::StoredMap::keySet  )  [inline]
 

Returns a set view of the keys contained in this map. A java.util.SortedSet is returned if the map is ordered. The returned collection will be read-only if the map is read-only. This method conforms to the Map#keySet() interface.

Note that the return value is a StoredCollection and must be treated as such; for example, its iterators must be explicitly closed.

Returns:
a StoredKeySet or a StoredSortedKeySet for this map.
Exceptions:
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.
See also:
isOrdered

isWriteAllowed

Definition at line 390 of file StoredMap.java.

Object com::sleepycat::collections::StoredMap::put Object  key,
Object  value
[inline]
 

Associates the specified value with the specified key in this map (optional operation). If duplicates are allowed and the specified key is already mapped to a value, this method appends the new duplicate after the existing duplicates. This method conforms to the Map#put interface.

The key parameter may be null if an entity binding is used and the key will be derived from the value (entity) parameter. If an entity binding is used and the key parameter is non-null, then the key parameter must be equal to the key derived from the value parameter.

Returns:
the previous value associated with specified key, or null if there was no mapping for the key or if duplicates are allowed.
Exceptions:
UnsupportedOperationException if the collection is indexed, or if the collection is read-only.
IllegalArgumentException if an entity value binding is used and the primary key of the value given is different than the existing stored primary key.
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Definition at line 256 of file StoredMap.java.

Referenced by putAll().

void com::sleepycat::collections::StoredMap::putAll Map  map  )  [inline]
 

Copies all of the mappings from the specified map to this map (optional operation). When duplicates are allowed, the mappings in the specified map are effectively appended to the existing mappings in this map, that is no previously existing mappings in this map are replaced. This method conforms to the Map#putAll interface.

Exceptions:
UnsupportedOperationException if the collection is read-only, or if the collection is indexed.
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Definition at line 354 of file StoredMap.java.

References put().

Object com::sleepycat::collections::StoredMap::remove Object  key  )  [inline]
 

Removes the mapping for this key from this map if present (optional operation). If duplicates are allowed, this method removes all duplicates for the given key. This method conforms to the Map#remove interface.

Exceptions:
UnsupportedOperationException if the collection is read-only.
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Definition at line 308 of file StoredMap.java.

String com::sleepycat::collections::StoredMap::toString  )  [inline]
 

Converts the map to a string representation for debugging. WARNING: All mappings will be converted to strings and returned and therefore the returned string may be very large.

Returns:
the string representation.
Exceptions:
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.

Definition at line 512 of file StoredMap.java.

References entrySet().

Collection com::sleepycat::collections::StoredMap::values  )  [inline]
 

Returns a collection view of the values contained in this map. A java.util.SortedSet is returned if the map is ordered and the value/entity binding can be used to derive the map's key from its value/entity object. The returned collection will be read-only if the map is read-only. This method conforms to the Map#values() interface.

Note that the return value is a StoredCollection and must be treated as such; for example, its iterators must be explicitly closed.

Returns:
a StoredValueSet or a StoredSortedValueSet for this map.
Exceptions:
RuntimeExceptionWrapper if a com.sleepycat.db.DatabaseException is thrown.
See also:
isOrdered

isWriteAllowed

Definition at line 438 of file StoredMap.java.

Referenced by collections::ship::tuple::SampleViews::getPartSet(), collections::ship::sentity::SampleViews::getPartSet(), collections::ship::marshal::SampleViews::getPartSet(), collections::ship::factory::SampleViews::getPartSet(), collections::ship::entity::SampleViews::getPartSet(), collections::ship::tuple::SampleViews::getShipmentSet(), collections::ship::sentity::SampleViews::getShipmentSet(), collections::ship::marshal::SampleViews::getShipmentSet(), collections::ship::factory::SampleViews::getShipmentSet(), collections::ship::entity::SampleViews::getShipmentSet(), collections::ship::tuple::SampleViews::getSupplierSet(), collections::ship::sentity::SampleViews::getSupplierSet(), collections::ship::marshal::SampleViews::getSupplierSet(), collections::ship::factory::SampleViews::getSupplierSet(), and collections::ship::entity::SampleViews::getSupplierSet().


The documentation for this class was generated from the following file:
Generated on Sun Dec 25 12:15:01 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2