org.objectweb.jorm.facility.meminst.genclass.api
Interface Set

All Known Implementing Classes:
Set

public interface Set

Author:
Sebastien Chassande-Barrioz

Method Summary
 boolean add(java.lang.Object o, java.lang.Object connection)
          Adds the specified element to this set if it is not already present (optional operation).
 boolean addAll(Set c, java.lang.Object connection)
          Adds all of the elements in the specified collection to this set if they're not already present (optional operation).
 void clear(java.lang.Object connection)
          Removes all of the elements from this set (optional operation).
 boolean contains(java.lang.Object o, java.lang.Object connection)
          Returns true if this set contains the specified element.
 boolean containsAll(Set c, java.lang.Object connection)
          Returns true if this set contains all of the elements of the specified collection.
 boolean isEmpty(java.lang.Object connection)
          Returns true if this set contains no elements.
 java.util.Iterator iterator(java.lang.Object connection)
          Returns an iterator over the elements in this set.
 boolean remove(java.lang.Object o, java.lang.Object connection)
          Removes the specified element from this set if it is present (optional operation).
 boolean removeAll(Set c, java.lang.Object connection)
          Removes from this set all of its elements that are contained in the specified collection (optional operation).
 boolean retainAll(Set c, java.lang.Object connection)
          Retains only the elements in this set that are contained in the specified collection (optional operation).
 int size(java.lang.Object connection)
          Returns the number of elements in this set (its cardinality).
 java.lang.Object[] toArray(java.lang.Object connection)
          Returns an array containing all of the elements in this set.
 java.lang.Object[] toArray(java.lang.Object[] a, java.lang.Object connection)
          Returns an array containing all of the elements in this set whose runtime type is that of the specified array.
 

Method Detail

size

public int size(java.lang.Object connection)
         throws PException
Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
Parameters:
connection - used to access the data store
Returns:
the number of elements in this set (its cardinality).
Throws:
PException - a internal jorm error occured

isEmpty

public boolean isEmpty(java.lang.Object connection)
                throws PException
Returns true if this set contains no elements.
Parameters:
connection - used to access the data store
Returns:
true if this set contains no elements.
Throws:
PException - a internal jorm error occured

contains

public boolean contains(java.lang.Object o,
                        java.lang.Object connection)
                 throws PException
Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that (o==null ? e==null : o.equals(e)).
Parameters:
o - element whose presence in this set is to be tested.
connection - used to access the data store
Returns:
true if this set contains the specified element.
Throws:
PException - a internal jorm error occured

iterator

public java.util.Iterator iterator(java.lang.Object connection)
                            throws PException
Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).
Parameters:
connection - used to access the data store
Returns:
an iterator over the elements in this set.
Throws:
PException - a internal jorm error occured

toArray

public java.lang.Object[] toArray(java.lang.Object connection)
                           throws PException
Returns an array containing all of the elements in this set. Obeys the general contract of the Collection.toArray method.
Parameters:
connection - used to access the data store
Returns:
an array containing all of the elements in this set.
Throws:
PException - a internal jorm error occured

toArray

public java.lang.Object[] toArray(java.lang.Object[] a,
                                  java.lang.Object connection)
                           throws PException
Returns an array containing all of the elements in this set whose runtime type is that of the specified array. Obeys the general contract of the Collection.toArray(Object[]) method.
Parameters:
a - the array into which the elements of this set are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
connection - used to access the data store
Returns:
an array containing the elements of this set.
Throws:
ArrayStoreException - the runtime type of a is not a supertype of the runtime type of every element in this set.
PException - a internal jorm error occured

add

public boolean add(java.lang.Object o,
                   java.lang.Object connection)
            throws PException
Adds the specified element to this set if it is not already present (optional operation). More formally, adds the specified element, o, to this set if this set contains no element e such that (o==null ? e==null : o.equals(e)). If this set already contains the specified element, the call leaves this set unchanged and returns false. In combination with the restriction on constructors, this ensures that sets never contain duplicate elements.

The stipulation above does not imply that sets must accept all elements; sets may refuse to add any particular element, including null, and throwing an exception, as described in the specification for Collection.add. Individual set implementations should clearly document any restrictions on the the elements that they may contain.

Parameters:
o - element to be added to this set.
connection - used to access the data store
Returns:
true if this set did not already contain the specified element.
Throws:
java.lang.UnsupportedOperationException - if the add method is not supported by this set.
ClassCastException - if the class of the specified element prevents it from being added to this set.
java.lang.IllegalArgumentException - if some aspect of this element prevents it from being added to this set.
PException - a internal jorm error occured

remove

public boolean remove(java.lang.Object o,
                      java.lang.Object connection)
               throws PException
Removes the specified element from this set if it is present (optional operation). More formally, removes an element e such that (o==null ? e==null : o.equals(e)), if the set contains such an element. Returns true if the set contained the specified element (or equivalently, if the set changed as a result of the call). (The set will not contain the specified element once the call returns.)
Parameters:
o - object to be removed from this set, if present.
connection - used to access the data store
Returns:
true if the set contained the specified element.
Throws:
java.lang.UnsupportedOperationException - if the remove method is not supported by this set.
PException - a internal jorm error occured

containsAll

public boolean containsAll(Set c,
                           java.lang.Object connection)
                    throws PException
Returns true if this set contains all of the elements of the specified collection. If the specified collection is also a set, this method returns true if it is a subset of this set.
Parameters:
c - collection to be checked for containment in this set.
connection - used to access the data store
Returns:
true if this set contains all of the elements of the specified collection.
Throws:
PException - a internal jorm error occured

addAll

public boolean addAll(Set c,
                      java.lang.Object connection)
               throws PException
Adds all of the elements in the specified collection to this set if they're not already present (optional operation). If the specified collection is also a set, the addAll operation effectively modifies this set so that its value is the union of the two sets. The behavior of this operation is unspecified if the specified collection is modified while the operation is in progress.
Parameters:
c - collection whose elements are to be added to this set.
connection - used to access the data store
Returns:
true if this set changed as a result of the call.
Throws:
java.lang.UnsupportedOperationException - if the addAll method is not supported by this set.
ClassCastException - if the class of some element of the specified collection prevents it from being added to this set.
java.lang.IllegalArgumentException - if some aspect of some element of the specified collection prevents it from being added to this set.
PException - a internal jorm error occured
See Also:
#add(Object)

retainAll

public boolean retainAll(Set c,
                         java.lang.Object connection)
                  throws PException
Retains only the elements in this set that are contained in the specified collection (optional operation). In other words, removes from this set all of its elements that are not contained in the specified collection. If the specified collection is also a set, this operation effectively modifies this set so that its value is the intersection of the two sets.
Parameters:
c - collection that defines which elements this set will retain.
connection - used to access the data store
Returns:
true if this collection changed as a result of the call.
Throws:
java.lang.UnsupportedOperationException - if the retainAll method is not supported by this Collection.
PException - a internal jorm error occured
See Also:
#remove(Object)

removeAll

public boolean removeAll(Set c,
                         java.lang.Object connection)
                  throws PException
Removes from this set all of its elements that are contained in the specified collection (optional operation). If the specified collection is also a set, this operation effectively modifies this set so that its value is the asymmetric set difference of the two sets.
Parameters:
c - collection that defines which elements will be removed from this set.
connection - used to access the data store
Returns:
true if this set changed as a result of the call.
Throws:
java.lang.UnsupportedOperationException - if the removeAll method is not supported by this Collection.
PException - a internal jorm error occured
See Also:
#remove(Object)

clear

public void clear(java.lang.Object connection)
           throws PException
Removes all of the elements from this set (optional operation). This set will be empty after this call returns (unless it throws an exception).
Parameters:
connection - used to access the data store
Throws:
java.lang.UnsupportedOperationException - if the clear method is not supported by this set.
PException - a internal jorm error occured