OpMath

com.opmath.util.datastruct
Class ComparableVector

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--com.opmath.util.datastruct.ComparableVector
All Implemented Interfaces:
Cloneable, Collection, ComparableList, List, Serializable
Direct Known Subclasses:
SortedTableIndex

public class ComparableVector
extends Vector
implements ComparableList

An object which can serve as a DisplayTable column, implemented by extending java.util.Vector.

ComparableVector implements the ComparableList interface, thus it provides a storage structure for columns of a DisplayTable with exactly the access methods required by the containing class.

This class is the simplest and most literal implementation of the ComparableList interface, in that it uses its own, explicity-declared local storage for the column data. Other implementations of the ComparableList interface can do other things ...

Copyright: (c) 2002 The Open Math Company Limited

The Terms of Distribution of this software are stipulated in the javadoc Overview for this project.

Since:
J2SE 1.3
Version:
utilities-v011
Author:
Bruno Beloff bruno.beloff@opmath.com
See Also:
Serialized Form

Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ComparableVector()
          Constructs an empty ComparableVector so that its internal data array has size 10 and its standard capacity increment is zero.
ComparableVector(Collection c)
          Constructs a ComparableVector containing the elements of the specified collection, in the order they are returned by the collection's iterator.
ComparableVector(int initialCapacity)
          Constructs an empty ComparableVector with the specified initial capacity and with its capacity increment equal to zero.
ComparableVector(int initialCapacity, int capacityIncrement)
          Constructs an empty ComparableVector with the specified initial capacity and capacity increment.
 
Method Summary
 boolean add(Comparable element)
          Appends the specified element to the end of this list.
 Comparable set(int index, Comparable element)
          Replaces the element at the specified position in this ComparableVector with the specified element.
 String toString()
          Returns a new String, detailing the contents of this ComparableVector instance.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.opmath.util.datastruct.ComparableList
clear, elements, get, indexOf, size
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

ComparableVector

public ComparableVector()
Constructs an empty ComparableVector so that its internal data array has size 10 and its standard capacity increment is zero.

Since:
J2SE 1.3

ComparableVector

public ComparableVector(Collection c)
Constructs a ComparableVector containing the elements of the specified collection, in the order they are returned by the collection's iterator.

Parameters:
c - a Collection used to populate the ComparableVector.
Since:
J2SE 1.3

ComparableVector

public ComparableVector(int initialCapacity)
Constructs an empty ComparableVector with the specified initial capacity and with its capacity increment equal to zero.

Parameters:
initialCapacity - the initial capacity of the ComparableVector.
Since:
J2SE 1.3

ComparableVector

public ComparableVector(int initialCapacity,
                        int capacityIncrement)
Constructs an empty ComparableVector with the specified initial capacity and capacity increment.

Parameters:
initialCapacity - the initial capacity of the ComparableVector.
capacityIncrement - the amount by which the capacity is increased when the ComparableVector overflows.
Since:
J2SE 1.3
Method Detail

set

public Comparable set(int index,
                      Comparable element)
               throws ArrayIndexOutOfBoundsException
Replaces the element at the specified position in this ComparableVector with the specified element.

Specified by:
set in interface ComparableList
Parameters:
index - the int index of element to replace.
element - the Comparable element to be stored at the specified position.
Returns:
the Comparable element previously stored at this location.
Throws:
ArrayIndexOutOfBoundsException - an exception thrown if the index is out of range (index < 0 || index >= size()).
Since:
J2SE 1.3

add

public boolean add(Comparable element)
Appends the specified element to the end of this list.

Lists may place limitations on what elements may be added to this list. In particular, some lists will refuse to add null elements, and others will impose restrictions on the type of elements that may be added.

Specified by:
add in interface ComparableList
Parameters:
element - the Comparable to be added.
Returns:
true (as per the general contract of the Collection.add method).
Since:
J2SE 1.3

toString

public String toString()
Returns a new String, detailing the contents of this ComparableVector instance.

Specified by:
toString in interface ComparableList
Overrides:
toString in class Vector
Returns:
a String.
Since:
J2SE 1.3

OpMath

Submit a bug or feature to Open Math
Copyright © 2002 Open Math Company Limited, Brighton, UK