Save This Page
Home » mahout-collections-1.0-src » org.apache.mahout.math.list » [javadoc | source]
org.apache.mahout.math.list
abstract public class: AbstractList [javadoc | source]
java.lang.Object
   org.apache.mahout.math.PersistentObject
      org.apache.mahout.math.list.AbstractList

All Implemented Interfaces:
    Cloneable, Serializable

Direct Known Subclasses:
    ObjectArrayList, AbstractObjectList

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.

Method from org.apache.mahout.math.list.AbstractList Summary:
beforeInsertDummies,   checkRange,   checkRangeFromTo,   clear,   isEmpty,   mergeSort,   mergeSortFromTo,   quickSort,   quickSortFromTo,   remove,   removeFromTo,   reverse,   setSize,   size,   sort,   sortFromTo,   trimToSize
Methods from org.apache.mahout.math.PersistentObject:
clone
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.mahout.math.list.AbstractList Detail:
 abstract protected  void beforeInsertDummies(int index,
    int length)
    Inserts length dummy elements before the specified position into the receiver. Shifts the element currently at that position (if any) and any subsequent elements to the right. This method must set the new size to be size()+length.
 protected static  void checkRange(int index,
    int theSize) 
    Checks if the given index is in range.
 protected static  void checkRangeFromTo(int from,
    int to,
    int theSize) 
    Checks if the given range is within the contained array's bounds.
 public  void clear() 
    Removes all elements from the receiver. The receiver will be empty after this call returns, but keep its current capacity.
 public boolean isEmpty() 
 public final  void mergeSort() 
    Sorts the receiver into ascending order. This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.

    The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance, and can approach linear performance on nearly sorted lists.

    You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set. It is generally better to call sort() or sortFromTo(...) instead, because those methods automatically choose the best sorting algorithm.

 abstract public  void mergeSortFromTo(int from,
    int to)
    Sorts the receiver into ascending order. This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.

    The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance, and can approach linear performance on nearly sorted lists.

    You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set. It is generally better to call sort() or sortFromTo(...) instead, because those methods automatically choose the best sorting algorithm.

 public final  void quickSort() 
    Sorts the receiver into ascending order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

    You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set. It is generally better to call sort() or sortFromTo(...) instead, because those methods automatically choose the best sorting algorithm.

 abstract public  void quickSortFromTo(int from,
    int to)
    Sorts the specified range of the receiver into ascending order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

    You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set. It is generally better to call sort() or sortFromTo(...) instead, because those methods automatically choose the best sorting algorithm.

 public  void remove(int index) 
    Removes the element at the specified position from the receiver. Shifts any subsequent elements to the left.
 abstract public  void removeFromTo(int fromIndex,
    int toIndex)
    Removes from the receiver all elements whose index is between from, inclusive and to, inclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the list by (to - from + 1) elements.
 abstract public  void reverse()
    Reverses the elements of the receiver. Last becomes first, second last becomes second first, and so on.
 public  void setSize(int newSize) 
    Sets the size of the receiver. If the new size is greater than the current size, new null or zero items are added to the end of the receiver. If the new size is less than the current size, all components at index newSize and greater are discarded. This method does not release any superfluos internal memory. Use method trimToSize to release superfluos internal memory.
 abstract public int size()
 public final  void sort() 
    Sorts the receiver into ascending order. The sorting algorithm is dynamically chosen according to the characteristics of the data set. This implementation simply calls sortFromTo(...). Override sortFromTo(...) if you can determine which sort is most appropriate for the given data set.
 public  void sortFromTo(int from,
    int to) 
    Sorts the specified range of the receiver into ascending order. The sorting algorithm is dynamically chosen according to the characteristics of the data set. This default implementation simply calls quickSort. Override this method if you can determine which sort is most appropriate for the given data set.
 public  void trimToSize() 
    Trims the capacity of the receiver to be the receiver's current size. Releases any superfluos internal memory. An application can use this operation to minimize the storage of the receiver.

    This default implementation does nothing. Override this method in space efficient implementations.