org.objectweb.jonas_ejb.container.jorm
Class Set

java.lang.Object
  extended by org.objectweb.jonas_ejb.container.jorm.GenClassImpl
      extended by org.objectweb.jonas_ejb.container.jorm.Set
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.Set, org.objectweb.jorm.api.PAccessor, org.objectweb.jorm.api.PGenClassAccessor, org.objectweb.jorm.api.PIndexedElemFactory

public class Set
extends GenClassImpl
implements java.util.Set

This class is a basic implementation of the java.util.Set based on the generic class implementation (GenClassImpl) and the Collection implementation. This class can be used to represent a relation between bean.

Author:
S.Chassande-Barrioz : Initial developer, Helene Joanin : fix bugs in the toArray(...) methods

Nested Class Summary
 
Nested classes/interfaces inherited from class org.objectweb.jonas_ejb.container.jorm.GenClassImpl
GenClassImpl.ElementIterator
 
Field Summary
 
Fields inherited from class org.objectweb.jonas_ejb.container.jorm.GenClassImpl
deletedLength, ectx, gcm, isModified, listener, pb, pIndexedElems, selectForUpdate, size
 
Constructor Summary
Set()
           
 
Method Summary
 boolean add(java.lang.Object o)
          Before adding the object into the set, it checks that the new element does not exist.
 boolean add(java.lang.Object o, boolean callListener)
           
 boolean addAll(java.util.Collection collection)
          It iterates over the collection parameter to add each element in the collection.
 void clear()
          It removes all elements.
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection collection)
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object o)
           
 boolean remove(java.lang.Object o, boolean callListener)
           
 boolean removeAll(java.util.Collection collection)
          It iterates over the collection parameter to remove each element in the collection.
 boolean retainAll(java.util.Collection collection)
          For each element of the current collection, it checks if it exist into the collection parameter.
 int size()
           
 java.lang.Object[] toArray()
          It returns an array of the elements.
 java.lang.Object[] toArray(java.lang.Object[] objects)
          It returns an array of the elements.
 
Methods inherited from class org.objectweb.jonas_ejb.container.jorm.GenClassImpl
createPIndexedElem, gcAdd, gcClear, gcContains, gcDeref, gcGetElement, gcGetPBinding, gcGetRealIndex, gcGetSize, gcIsModified, gcIterator, gcIterator, gcObject2ref, gcRemove, getListener, getMemoryInstance, paAdd, paDeltaSupported, paGetNbElem, paIterator, paSetNbElem, printState, read, reset, setEntityContext, setListener, setPBinding, setPClassMapping, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Constructor Detail

Set

public Set()
Method Detail

add

public boolean add(java.lang.Object o)
Before adding the object into the set, it checks that the new element does not exist.

Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Parameters:
o - is the element to add
Returns:
true is the element has been added, and false is the element already exists in the set.

add

public boolean add(java.lang.Object o,
                   boolean callListener)

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.Set

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.Set

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set

toArray

public java.lang.Object[] toArray()
It returns an array of the elements.

Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set
Returns:
array of the elements

toArray

public java.lang.Object[] toArray(java.lang.Object[] objects)
It returns an array of the elements. It is built by an iteration over the existing elements.

Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set
Parameters:
objects - the array into which the elements of this collection are to be stored
Returns:
array of the elements

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set

remove

public boolean remove(java.lang.Object o,
                      boolean callListener)

containsAll

public boolean containsAll(java.util.Collection collection)
Specified by:
containsAll in interface java.util.Collection
Specified by:
containsAll in interface java.util.Set

addAll

public boolean addAll(java.util.Collection collection)
It iterates over the collection parameter to add each element in the collection.

Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.Set
Parameters:
collection - the collection of elements to add

removeAll

public boolean removeAll(java.util.Collection collection)
It iterates over the collection parameter to remove each element in the collection.

Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.Set
Parameters:
collection - The collection of elements to remove

retainAll

public boolean retainAll(java.util.Collection collection)
For each element of the current collection, it checks if it exist into the collection parameter. If it does not found then it is removed from the current collection.

Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.Set

clear

public void clear()
It removes all elements.

Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.Set