Interface COM.odi.odmg.Collection

public interface Collection
extends IPersistent, Cloneable
The Collection interface is the super interface of all collection interfaces. This interface encapsulates the operations on a collection.

Unlike java.lang.Vector, a search for an object in a collection uses == for comparison, rather than Object.equals(). For example, Collection.remove(Object o) removes the object o itself, and not any other object that equals o.

All methods throw the following exceptions:

COM.odi.odmg.TransactionNotInProgressException If there is no transaction in progress.

COM.odi.ObjectStoreException If the current thread is not associated with a transaction or if the instance in question is not associated with the current thread.

Methods that modify persistent objects throw this exception:

COM.odi.odmg.DatabaseIsReadOnlyException If there is a readonly transaction in progress or if the database is open for readonly.

See Also:
Set, List, Bag, VArray

Method Index

 o add(Object)
Equivalent to the ODMG method insert_element().
 o contains(Object)
Equivalent to the ODMG method boolean contains_element().
 o elements()
Equivalent to the ODMG method Iterator create_Iterator().
 o existsElement(String)
This is an ODMG OQL method that is not supported.
 o isEmpty()
Equivalent to the ODMG method boolean is_Empty().
 o query(String)
This is an ODMG OQL method that is not supported.
 o remove(Object)
Equivalent to the ODMG method void remove_element().
 o select(String)
This is an ODMG OQL method that is not supported.
 o selectElement(String)
This is an ODMG OQL method that is not supported.
 o size()
Equivalent to the ODMG method long cardinality().

Methods

 o size
  public abstract int size()
Equivalent to the ODMG method long cardinality().

Returns:
Returns the size of this collection.
 o isEmpty
  public abstract boolean isEmpty()
Equivalent to the ODMG method boolean is_Empty().

Returns:
Returns true if this collection is empty, and false otherwise.
 o add
  public abstract void add(Object obj)
Equivalent to the ODMG method insert_element().

Parameters:
obj - The object to be added.
Throws: ObjectNotExportedException
If the collection and the object being added are in different segments and the object is not exported.
Throws: ObjectNotPersistenceCapableException
If the object is not persistence-capable.
 o remove
  public abstract Object remove(Object obj)
Equivalent to the ODMG method void remove_element().

Parameters:
obj - The object to be removed.
Returns:
Returns the object that was removed from the collection. If no object is removed, returns null.
 o contains
  public abstract boolean contains(Object obj)
Equivalent to the ODMG method boolean contains_element().

Parameters:
obj - The object to find in the collection.
Returns:
Returns true if the object is contained in this collection, and false otherwise.
 o elements
  public abstract Enumeration elements()
Equivalent to the ODMG method Iterator create_Iterator().

Returns:
Returns an enumeration of the elements in the collection.
 o selectElement
  public abstract Object selectElement(String predicate)
This is an ODMG OQL method that is not supported.

Throws: ODMGException
Always.
 o select
  public abstract Enumeration select(String predicate)
This is an ODMG OQL method that is not supported.

Throws: ODMGException
Always.
 o query
  public abstract Collection query(String predicate)
This is an ODMG OQL method that is not supported.

Throws: ODMGException
Always.
 o existsElement
  public abstract boolean existsElement(String predicate)
This is an ODMG OQL method that is not supported.

Throws: ODMGException
Always.

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