PCJ API
Version 1.2

bak.pcj
Class SynchronizedFloatCollection

java.lang.Object
  extended bybak.pcj.SynchronizedFloatCollection
All Implemented Interfaces:
FloatCollection

public class SynchronizedFloatCollection
extends Object
implements FloatCollection

This class represents synchronized collections of float values. As in the Java Collections API iterations over the collection must be synchronized on the collection itself.

Since:
1.0
See Also:
Collections.synchronizedCollection(java.util.Collection)

Field Summary
protected  FloatCollection collection
          The collection underlying this synchronized collection.
protected  Object m
          An object on which to synchronize this collection's methods.
 
Constructor Summary
SynchronizedFloatCollection(FloatCollection c)
          Creates a new synchronized collection on an existing collection.
 
Method Summary
 boolean add(float v)
          Adds an element to this collection.
 boolean addAll(FloatCollection c)
          Adds all the elements of a specified collection to this collection.
 void clear()
          Clears this collection.
 boolean contains(float v)
          Indicates whether this collection contains a specified element.
 boolean containsAll(FloatCollection c)
          Indicates whether all elements of a specified collection is contained in this collection.
 boolean equals(Object obj)
          Indicates whether this collection is equal to some object.
 int hashCode()
          Returns a hash code value for this collection.
 boolean isEmpty()
          Indicates whether this collection is empty.
 FloatIterator iterator()
          Returns an iterator over this collection.
 boolean remove(float v)
          Removes a specified element from this collection.
 boolean removeAll(FloatCollection c)
          Removes all the elements of a specified collection from this collection.
 boolean retainAll(FloatCollection c)
          Retains only the elements of a specified collection in this collection.
 int size()
          Returns the number of elements in this collection.
 float[] toArray()
          Returns the elements of this collection as an array.
 float[] toArray(float[] a)
          Returns the elements of this collection as an array.
 void trimToSize()
          Minimizes the memory used by this collection.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

collection

protected FloatCollection collection
The collection underlying this synchronized collection.


m

protected Object m
An object on which to synchronize this collection's methods.

Constructor Detail

SynchronizedFloatCollection

public SynchronizedFloatCollection(FloatCollection c)
Creates a new synchronized collection on an existing collection. The result is a collection whose elements and behaviour is the same as the existing collection's except that the new collection's methods are synchronized.

Parameters:
c - the existing collection to make synchronized.
Throws:
NullPointerException - if c is null.
Method Detail

add

public boolean add(float v)
Description copied from interface: FloatCollection
Adds an element to this collection.

Specified by:
add in interface FloatCollection
Parameters:
v - the element to add to this collection.
Returns:
true if this collection was modified as a result of adding v; returns false otherwise.
See Also:
FloatCollection.addAll(FloatCollection)

addAll

public boolean addAll(FloatCollection c)
Description copied from interface: FloatCollection
Adds all the elements of a specified collection to this collection.

Specified by:
addAll in interface FloatCollection
Parameters:
c - the collection whose elements to add to this collection.
Returns:
true if this collection was modified as a result of adding the elements of c; returns false otherwise.
See Also:
FloatCollection.add(float)

clear

public void clear()
Description copied from interface: FloatCollection
Clears this collection.

Specified by:
clear in interface FloatCollection

contains

public boolean contains(float v)
Description copied from interface: FloatCollection
Indicates whether this collection contains a specified element.

Specified by:
contains in interface FloatCollection
Parameters:
v - the element to test for containment.
Returns:
true if v is contained in this collection; returns false otherwise.
See Also:
FloatCollection.containsAll(FloatCollection)

containsAll

public boolean containsAll(FloatCollection c)
Description copied from interface: FloatCollection
Indicates whether all elements of a specified collection is contained in this collection.

Specified by:
containsAll in interface FloatCollection
Parameters:
c - the collection whose elements to test for containment.
Returns:
true if all the elements of c are contained in this collection; returns false otherwise.
See Also:
FloatCollection.contains(float)

equals

public boolean equals(Object obj)
Description copied from interface: FloatCollection
Indicates whether this collection is equal to some object.

Specified by:
equals in interface FloatCollection

hashCode

public int hashCode()
Description copied from interface: FloatCollection
Returns a hash code value for this collection.

Specified by:
hashCode in interface FloatCollection

isEmpty

public boolean isEmpty()
Description copied from interface: FloatCollection
Indicates whether this collection is empty.

Specified by:
isEmpty in interface FloatCollection
Returns:
true if this collection is empty; returns false otherwise.

iterator

public FloatIterator iterator()
Description copied from interface: FloatCollection
Returns an iterator over this collection.

Specified by:
iterator in interface FloatCollection
Returns:
an iterator over this collection.

remove

public boolean remove(float v)
Description copied from interface: FloatCollection
Removes a specified element from this collection.

Specified by:
remove in interface FloatCollection
Parameters:
v - the float value to remove from this collection.
Returns:
true if this collection was modified as a result of removing v; returns false otherwise.

removeAll

public boolean removeAll(FloatCollection c)
Description copied from interface: FloatCollection
Removes all the elements of a specified collection from this collection.

Specified by:
removeAll in interface FloatCollection
Parameters:
c - the collection whose elements to remove from this collection.
Returns:
true if this collection was modified as a result of removing the elements of c; returns false otherwise.

retainAll

public boolean retainAll(FloatCollection c)
Description copied from interface: FloatCollection
Retains only the elements of a specified collection in this collection.

Specified by:
retainAll in interface FloatCollection
Parameters:
c - the collection whose elements to retain in this collection.
Returns:
true if this collection was modified as a result of removing the elements not contained in c; returns false otherwise.

size

public int size()
Description copied from interface: FloatCollection
Returns the number of elements in this collection.

Specified by:
size in interface FloatCollection
Returns:
the number of elements in this collection.

toArray

public float[] toArray()
Description copied from interface: FloatCollection
Returns the elements of this collection as an array.

Specified by:
toArray in interface FloatCollection
Returns:
a new array containing the elements of this collection.

toArray

public float[] toArray(float[] a)
Description copied from interface: FloatCollection
Returns the elements of this collection as an array.

Specified by:
toArray in interface FloatCollection
Parameters:
a - an array to fill with the elements of this collection; if a is null or not big enough to contain all the elements of this collection, an new array is allocated, and a is not changed.
Returns:
a, if a has room for all the elements of this collection; otherwise a new array is allocated, filled with the elements of this collection, and returned.

trimToSize

public void trimToSize()
Description copied from interface: FloatCollection
Minimizes the memory used by this collection. The exact operation of this method depends on the class implementing it. Implementors may choose to ignore it completely.

Specified by:
trimToSize in interface FloatCollection

PCJ API
Version 1.2

Report a bug or request a feature.
Further information on the development and latest release of PCJ can be found at the project homepage.

Primitive Collections for Java is released under the GNU Lesser General Public License.
Copyright © 2002, 2003 Søren Bak. All Rights Reserved.

Hosted by SourceForge.net
SourceForge.net Logo