org.apache.mahout.math.list
Class AbstractObjectList<T>

java.lang.Object
  extended by org.apache.mahout.math.PersistentObject
      extended by org.apache.mahout.math.list.AbstractList
          extended by org.apache.mahout.math.list.AbstractObjectList<T>
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
ObjectArrayList

public abstract class AbstractObjectList<T>
extends AbstractList

Abstract base class for resizable lists holding objects or primitive data types such as int, float, etc.First see the package summary and javadoc tree view to get the broad picture.

Note that this implementation is not synchronized.

Version:
1.0, 09/24/99
Author:
wolfgang.hoschek@cern.ch
See Also:
ArrayList, Vector, Arrays, Serialized Form

Constructor Summary
AbstractObjectList()
           
 
Method Summary
 void addAllOf(Collection<T> collection)
          Appends all of the elements of the specified Collection to the receiver.
 void beforeInsertAllOf(int index, Collection<T> collection)
          Inserts all elements of the specified collection before the specified position into the receiver.
abstract  void replaceFromWith(int from, Collection<T> other)
          Replaces the part of the receiver starting at from (inclusive) with all the elements of the specified collection.
 
Methods inherited from class org.apache.mahout.math.list.AbstractList
beforeInsertDummies, checkRange, checkRangeFromTo, clear, isEmpty, mergeSort, mergeSortFromTo, quickSort, quickSortFromTo, remove, removeFromTo, reverse, setSize, size, sort, sortFromTo, trimToSize
 
Methods inherited from class org.apache.mahout.math.PersistentObject
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractObjectList

public AbstractObjectList()
Method Detail

addAllOf

public void addAllOf(Collection<T> collection)
Appends all of the elements of the specified Collection to the receiver.

Throws:
ClassCastException - if an element in the collection is not of the same parameter type of the receiver.

beforeInsertAllOf

public void beforeInsertAllOf(int index,
                              Collection<T> collection)
Inserts all elements of the specified collection before the specified position into the receiver. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices).

Parameters:
index - index before which to insert first element from the specified collection.
collection - the collection to be inserted
Throws:
ClassCastException - if an element in the collection is not of the same parameter type of the receiver.
IndexOutOfBoundsException - if index < 0 || index > size().

replaceFromWith

public abstract void replaceFromWith(int from,
                                     Collection<T> other)
Replaces the part of the receiver starting at from (inclusive) with all the elements of the specified collection. Does not alter the size of the receiver. Replaces exactly Math.max(0,Math.min(size()-from, other.size())) elements.

Parameters:
from - the index at which to copy the first element from the specified collection.
other - Collection to replace part of the receiver
Throws:
IndexOutOfBoundsException - if index < 0 || index >= size().


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.