PCJ API
Version 1.2

bak.pcj.list
Class AbstractBooleanList

java.lang.Object
  extended bybak.pcj.AbstractBooleanCollection
      extended bybak.pcj.list.AbstractBooleanList
All Implemented Interfaces:
BooleanCollection, BooleanList
Direct Known Subclasses:
BooleanArrayDeque, BooleanArrayList, ListToBooleanListAdapter

public abstract class AbstractBooleanList
extends AbstractBooleanCollection
implements BooleanList

This class represents an abstract base for implementing lists of boolean values. All operations that can be implemented using iterators and the get() and set() methods are implemented as such. In most cases, this is hardly an efficient solution, and at least some of those methods should be overridden by sub-classes.

Since:
1.0

Constructor Summary
protected AbstractBooleanList()
          Default constructor to be invoked by sub-classes.
 
Method Summary
 boolean add(boolean v)
          Adds an element to this collection.
 void add(int index, boolean v)
          Throws UnsupportedOperationException.
 boolean addAll(int index, BooleanCollection c)
          Adds all the elements of a specified collection to this list starting at a specified index.
 boolean equals(Object obj)
          Indicates whether this collection is equal to some object.
 int hashCode()
          Returns a hash code value for this collection.
 int indexOf(boolean c)
          Returns the index of the first occurance of a specified element in this list.
 int indexOf(int index, boolean c)
          Returns the index of the first occurance of a specified element in this list after or at a specified index.
 BooleanIterator iterator()
          Returns an iterator over this collection.
 int lastIndexOf(boolean c)
          Returns the index of the last occurance of a specified element in this list.
 int lastIndexOf(int index, boolean c)
          Returns the index of the last occurance of a specified element in this list before a specified index.
 BooleanListIterator listIterator()
          Returns a list iterator over this list.
 BooleanListIterator listIterator(int index)
          Returns a list iterator over this list, starting from a specified index.
 boolean removeElementAt(int index)
          Throws UnsupportedOperationException.
 
Methods inherited from class bak.pcj.AbstractBooleanCollection
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface bak.pcj.list.BooleanList
get, set
 
Methods inherited from interface bak.pcj.BooleanCollection
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray, trimToSize
 

Constructor Detail

AbstractBooleanList

protected AbstractBooleanList()
Default constructor to be invoked by sub-classes.

Method Detail

add

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

Specified by:
add in interface BooleanCollection
Overrides:
add in class AbstractBooleanCollection

add

public void add(int index,
                boolean v)
Throws UnsupportedOperationException.

Specified by:
add in interface BooleanList
Parameters:
index - the index at which to add the element. If index == size() the element is appended to this list.
v - the boolean value to add to this list.
Throws:
UnsupportedOperationException - unconditionally.
See Also:
BooleanCollection.add(boolean), BooleanCollection.addAll(BooleanCollection), BooleanList.addAll(int,BooleanCollection)

addAll

public boolean addAll(int index,
                      BooleanCollection c)
Description copied from interface: BooleanList
Adds all the elements of a specified collection to this list starting at a specified index. The elements are inserted in the specified collection's iteration order. All elements from the specified index and forward are pushed to their successors' indices (c.size() indices).

Specified by:
addAll in interface BooleanList
Parameters:
index - the index at which to insert the elements of the specified collection. If index == size() the elements are appended to this list.
c - the collection whose elements to add to this list.
Returns:
true if this list was modified as a result of adding the elements of c; returns false otherwise.
See Also:
BooleanCollection.add(boolean), BooleanList.add(int, boolean), BooleanCollection.addAll(BooleanCollection)

indexOf

public int indexOf(boolean c)
Description copied from interface: BooleanList
Returns the index of the first occurance of a specified element in this list.

Specified by:
indexOf in interface BooleanList
Parameters:
c - the element to find.
Returns:
the index of the first occurance of the specified element in this list; returns -1, if the element is not contained in this list.

indexOf

public int indexOf(int index,
                   boolean c)
Description copied from interface: BooleanList
Returns the index of the first occurance of a specified element in this list after or at a specified index.

Specified by:
indexOf in interface BooleanList
Parameters:
c - the element to find.
index - the index at which to start the search.
Returns:
the index of the first occurance of the specified element in this list; returns -1, if the element is not contained in this list.
Since:
1.2

iterator

public BooleanIterator iterator()
Description copied from interface: BooleanCollection
Returns an iterator over this collection.

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

lastIndexOf

public int lastIndexOf(boolean c)
Description copied from interface: BooleanList
Returns the index of the last occurance of a specified element in this list.

Specified by:
lastIndexOf in interface BooleanList
Parameters:
c - the element to find.
Returns:
the index of the last occurance of the specified element in this list; returns -1, if the element is not contained in this list.

lastIndexOf

public int lastIndexOf(int index,
                       boolean c)
Description copied from interface: BooleanList
Returns the index of the last occurance of a specified element in this list before a specified index.

Specified by:
lastIndexOf in interface BooleanList
Parameters:
c - the element to find.
index - the index at which to start the search. Note that the element at index is not included in the search.
Returns:
the index of the last occurance of the specified element in this list; returns -1, if the element is not contained in this list.

listIterator

public BooleanListIterator listIterator()
Description copied from interface: BooleanList
Returns a list iterator over this list.

Specified by:
listIterator in interface BooleanList
Returns:
a list iterator over this list.

listIterator

public BooleanListIterator listIterator(int index)
Description copied from interface: BooleanList
Returns a list iterator over this list, starting from a specified index.

Specified by:
listIterator in interface BooleanList
Parameters:
index - the index at which to begin the iteration.
Returns:
a list iterator over this list.

removeElementAt

public boolean removeElementAt(int index)
Throws UnsupportedOperationException.

Specified by:
removeElementAt in interface BooleanList
Parameters:
index - the index of the element to remove.
Returns:
the value of the element removed.
Throws:
UnsupportedOperationException - unconditionally.

equals

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

Specified by:
equals in interface BooleanCollection

hashCode

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

Specified by:
hashCode in interface BooleanCollection

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