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
-
add(Object)
- Equivalent to the ODMG method insert_element().
-
contains(Object)
- Equivalent to the ODMG method boolean contains_element().
-
elements()
- Equivalent to the ODMG method Iterator create_Iterator().
-
existsElement(String)
- This is an ODMG OQL method that is not supported.
-
isEmpty()
- Equivalent to the ODMG method boolean is_Empty().
-
query(String)
- This is an ODMG OQL method that is not supported.
-
remove(Object)
- Equivalent to the ODMG method void remove_element().
-
select(String)
- This is an ODMG OQL method that is not supported.
-
selectElement(String)
- This is an ODMG OQL method that is not supported.
-
size()
- Equivalent to the ODMG method long cardinality().
size
public abstract int size()
- Equivalent to the ODMG method long cardinality().
- Returns:
- Returns the size of this collection.
isEmpty
public abstract boolean isEmpty()
- Equivalent to the ODMG method boolean is_Empty().
- Returns:
- Returns true if this collection is empty, and false otherwise.
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.
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.
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.
elements
public abstract Enumeration elements()
- Equivalent to the ODMG method Iterator create_Iterator().
- Returns:
- Returns an enumeration of the elements in the collection.
selectElement
public abstract Object selectElement(String predicate)
- This is an ODMG OQL method that is not supported.
- Throws: ODMGException
- Always.
select
public abstract Enumeration select(String predicate)
- This is an ODMG OQL method that is not supported.
- Throws: ODMGException
- Always.
query
public abstract Collection query(String predicate)
- This is an ODMG OQL method that is not supported.
- Throws: ODMGException
- Always.
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.