PCJ API
Version 1.2

bak.pcj.adapter
Class BooleanSortedSetToSortedSetAdapter

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended bybak.pcj.adapter.BooleanSetToSetAdapter
              extended bybak.pcj.adapter.BooleanSortedSetToSortedSetAdapter
All Implemented Interfaces:
Collection, Set, SortedSet

public class BooleanSortedSetToSortedSetAdapter
extends BooleanSetToSetAdapter
implements SortedSet

This class represents adapters of boolean sets to Java Collections Framework sets. The adapter is implemented as a wrapper around a primitive set. Thus, changes to the underlying set are reflected by this set and vice versa.

Since:
1.2
See Also:
BooleanSortedSet, SortedSet

Field Summary
 
Fields inherited from class bak.pcj.adapter.BooleanSetToSetAdapter
set
 
Constructor Summary
BooleanSortedSetToSortedSetAdapter(BooleanSortedSet set)
          Creates a new adaption of a set of boolean values to a Java Collections Framework set.
 
Method Summary
 Comparator comparator()
          Returns the comparator used by this set.
 Object first()
          Returns the lowest element of this set.
 SortedSet headSet(Object to)
          Returns the subset of values lower than a specified value.
 Object last()
          Returns the highest element of this set.
 SortedSet subSet(Object from, Object to)
          Returns the subset of values lower that a specified value and higher than or equal to another specified value.
 SortedSet tailSet(Object from)
          Returns the subset of values higher than or equal to a specified value.
 
Methods inherited from class bak.pcj.adapter.BooleanSetToSetAdapter
add, clear, contains, hashCode, iterator, remove, retainAll, size
 
Methods inherited from class java.util.AbstractSet
equals, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

BooleanSortedSetToSortedSetAdapter

public BooleanSortedSetToSortedSetAdapter(BooleanSortedSet set)
Creates a new adaption of a set of boolean values to a Java Collections Framework set.

Parameters:
set - the underlying primitive set.
Throws:
NullPointerException - if set is null.
Method Detail

comparator

public Comparator comparator()
Returns the comparator used by this set. This method always returns null, since primitive sets are sorted by their natural ordering.

Specified by:
comparator in interface SortedSet
Returns:
null.

first

public Object first()
Returns the lowest element of this set.

Specified by:
first in interface SortedSet
Returns:
the lowest element of this set.
Throws:
NoSuchElementException - if this set is empty.

headSet

public SortedSet headSet(Object to)
Returns the subset of values lower than a specified value. The returned subset is a view of this set, so changes to the subset are reflected by this set and vice versa.

Specified by:
headSet in interface SortedSet
Parameters:
to - the upper bound of the returned set (not included).
Throws:
IllegalArgumentException - if to is not permitted in this set (which can be the case with returned subsets).
ClassCastException - if to is not of class Boolean.
NullPointerException - if to is null.

last

public Object last()
Returns the highest element of this set.

Specified by:
last in interface SortedSet
Returns:
the highest element of this set.
Throws:
NoSuchElementException - if this set is empty.

subSet

public SortedSet subSet(Object from,
                        Object to)
Returns the subset of values lower that a specified value and higher than or equal to another specified value. The returned subset is a view of this set, so changes to the subset are reflected by this set and vice versa.

Specified by:
subSet in interface SortedSet
Parameters:
from - the lower bound of the returned set (included).
to - the upper bound of the returned set (not included).
Throws:
IllegalArgumentException - if from is greater than to; if from or to is not permitted in this set (which can be the case with returned subsets).
ClassCastException - if from is not of class Boolean; if to is not of class Boolean.
NullPointerException - if from is null; if to is null.

tailSet

public SortedSet tailSet(Object from)
Returns the subset of values higher than or equal to a specified value. The returned subset is a view of this set, so changes to the subset are reflected by this set and vice versa.

Specified by:
tailSet in interface SortedSet
Parameters:
from - the lower bound of the returned set (included).
Throws:
IllegalArgumentException - if from is not permitted in this set (which can be the case with returned subsets).
ClassCastException - if from is not of class Boolean.
NullPointerException - if from is null.

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