SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.datastructure.list
Class VectorList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<Vector>
              extended by com.numericalmethod.suanshu.datastructure.list.VectorList
All Implemented Interfaces:
DeepCopyable, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Vector>, java.util.Collection<Vector>, java.util.List<Vector>, java.util.RandomAccess

public class VectorList
extends java.util.ArrayList<Vector>
implements DeepCopyable

This data structure represents a list of Vectors.

It is a wrapper for ArrayList<Vector> and has a set of utility functions for convenient.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
VectorList()
          Construct an empty list of Vectors.
VectorList(Vector[] list)
          Copy constructor to copy from an array of Vectors.
VectorList(VectorList list)
          Copy constructor to copy from another list of Vectors.
 
Method Summary
 VectorList deepCopy()
          Get a deep copy of this VectorList instance.
 Vector[] toArray()
          Get an array of all the elements in this list.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

VectorList

public VectorList()
Construct an empty list of Vectors.


VectorList

public VectorList(VectorList list)
Copy constructor to copy from another list of Vectors. The new instance is a deep copy.

Parameters:
list - a list of Vectors

VectorList

public VectorList(Vector[] list)
Copy constructor to copy from an array of Vectors. The two data structures reference the same instances of vectors, hence a shallow copy.

Parameters:
list - a list of Vectors
Method Detail

toArray

public Vector[] toArray()
Get an array of all the elements in this list. The returned array is not independent. Both the array and this reference the same set of elements.

This method acts as bridge between array-based and collection-based APIs.

Specified by:
toArray in interface java.util.Collection<Vector>
Specified by:
toArray in interface java.util.List<Vector>
Overrides:
toArray in class java.util.ArrayList<Vector>
Returns:
an array containing all the elements in this list

deepCopy

public VectorList deepCopy()
Get a deep copy of this VectorList instance. The elements themselves are copied.

Specified by:
deepCopy in interface DeepCopyable
Returns:
a deep copy of this VectorList instance

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.