coins.aflow.util
Class FAList

java.lang.Object
  extended bycoins.aflow.util.FAList
All Implemented Interfaces:
java.util.Collection

public class FAList
extends java.lang.Object
implements java.util.Collection

Title:

Description: 1 based list that prohibits the remove operation.

Since many indexes in COINS are 1 based, it should be convenient to use a list whose base is 1. Collection of such indexed objects are often expressed in terms of BitVector, and the meaning of the bits in the vector should be maintained by such a 1-based list, which serves as a map between the bit space and the space of indexed objects. Removal of elements in such a list, which results in re-indexing of list elements, will break the map and is not desirable. This list therefore prohibits such a removal.

Copyright: Copyright (c) 2002

Company:


Constructor Summary
FAList()
          Creates a new FAList instance.
FAList(int initialCapacity)
          Creates a new FAList instance with given initial capacity.
 
Method Summary
 boolean add(java.lang.Object pElement)
           
 boolean addAll(java.util.Collection pCollection)
          Inserts the specified element at the specified position in this list.
 boolean addAll(int pIndex, java.util.Collection pCollection)
           
 void clear()
          Removes all of the elements from this list.
 boolean contains(java.lang.Object pObj)
           
 boolean containsAll(java.util.Collection pCollection)
           
 java.lang.Object deref(int index)
          Sets the indexth entry of this list to null.
 boolean equals(java.lang.Object pObj)
           
 java.lang.Object get(int pIndex)
           
 int hashCode()
           
 int indexOf(java.lang.Object elem)
          Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
 boolean isEmpty()
          Tests whether this list has any elements.
 java.util.Iterator iterator()
          Returns the iterator over this list.
 int lastIndexOf(java.lang.Object pObj)
           
 java.util.ListIterator listIterator()
           
 java.util.ListIterator listIterator(int pIndex)
           
 java.lang.Object remove(int pIndex)
           
 boolean remove(java.lang.Object pObj)
           
 boolean removeAll(java.util.Collection pCollection)
           
 boolean retainAll(java.util.Collection pCollection)
           
 java.lang.Object set(int pIndex, java.lang.Object pElement)
           
 int size()
          Returns the number of elements in this list.
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] pObj)
           
 java.util.List toList()
          Returns the ordinary java.util.List's view of this list.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FAList

public FAList()
Creates a new FAList instance.


FAList

public FAList(int initialCapacity)
Creates a new FAList instance with given initial capacity.

Method Detail

add

public boolean add(java.lang.Object pElement)
Specified by:
add in interface java.util.Collection

addAll

public boolean addAll(java.util.Collection pCollection)
Inserts the specified element at the specified position in this list.

Specified by:
addAll in interface java.util.Collection
Throws:
java.lang.IndexOutOfBoundsException - if the index is not positive or is greater than the size of this list.

addAll

public boolean addAll(int pIndex,
                      java.util.Collection pCollection)

clear

public void clear()
Removes all of the elements from this list. This list will be empty after this call returns.

Specified by:
clear in interface java.util.Collection

contains

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

containsAll

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

equals

public boolean equals(java.lang.Object pObj)
Specified by:
equals in interface java.util.Collection

hashCode

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

get

public java.lang.Object get(int pIndex)

indexOf

public int indexOf(java.lang.Object elem)
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index. * @param elem element to search for.

Returns:
the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.

isEmpty

public boolean isEmpty()
Tests whether this list has any elements.

Specified by:
isEmpty in interface java.util.Collection
Returns:
true if this list is empty.

iterator

public java.util.Iterator iterator()
Returns the iterator over this list.

Specified by:
iterator in interface java.util.Collection
Returns:
the iterator over this list.

lastIndexOf

public int lastIndexOf(java.lang.Object pObj)

listIterator

public java.util.ListIterator listIterator()

listIterator

public java.util.ListIterator listIterator(int pIndex)

remove

public java.lang.Object remove(int pIndex)

remove

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

removeAll

public boolean removeAll(java.util.Collection pCollection)
Specified by:
removeAll in interface java.util.Collection

retainAll

public boolean retainAll(java.util.Collection pCollection)
Specified by:
retainAll in interface java.util.Collection

set

public java.lang.Object set(int pIndex,
                            java.lang.Object pElement)

deref

public java.lang.Object deref(int index)
Sets the indexth entry of this list to null.

Parameters:
index - index that is set to null.
Returns:
the original indexth element.
Throws:
java.lang.IndexOutOfBoundsException - if the index is not positive or is greater than the size of this list.

size

public int size()
Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE - 1.

Specified by:
size in interface java.util.Collection
Returns:
the number of elements in this list.

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection

toArray

public java.lang.Object[] toArray(java.lang.Object[] pObj)
Specified by:
toArray in interface java.util.Collection

toString

public java.lang.String toString()

toList

public java.util.List toList()
Returns the ordinary java.util.List's view of this list. The zero'th index becomes accessible. The member objects' indexes do not change.