You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by sr...@apache.org on 2009/11/25 04:36:02 UTC

svn commit: r883973 [11/14] - in /lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix: ./ bitvector/ buffer/ function/ list/ list/adapter/ map/

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/ObjectArrayList.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/ObjectArrayList.java?rev=883973&r1=883972&r2=883973&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/ObjectArrayList.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/ObjectArrayList.java Wed Nov 25 03:35:59 2009
@@ -18,23 +18,23 @@
  */
 @Deprecated
 public class ObjectArrayList extends AbstractList {
-	/**
-	 * The array buffer into which the elements of the list are stored.
-	 * The capacity of the list is the length of this array buffer.
-	 * @serial
-	 */
-	protected Object[] elements;
-	
-	/**
-	 * The size of the list.
-	 * @serial
-	 */
-	protected int size;
+  /**
+   * The array buffer into which the elements of the list are stored.
+   * The capacity of the list is the length of this array buffer.
+   * @serial
+   */
+  protected Object[] elements;
+  
+  /**
+   * The size of the list.
+   * @serial
+   */
+  protected int size;
 /**
  * Constructs an empty list.
  */
 public ObjectArrayList() {
-	this(10);
+  this(10);
 }
 /**
  * Constructs a list containing the specified elements. 
@@ -46,7 +46,7 @@
  * @param elements the array to be backed by the the constructed list
  */
 public ObjectArrayList(Object[] elements) {
-	elements(elements);
+  elements(elements);
 }
 /**
  * Constructs an empty list with the specified initial capacity.
@@ -54,8 +54,8 @@
  * @param   initialCapacity   the number of elements the receiver can hold without auto-expanding itself by allocating new internal memory.
  */
 public ObjectArrayList(int initialCapacity) {
-	this(new Object[initialCapacity]);
-	size=0;
+  this(new Object[initialCapacity]);
+  size=0;
 }
 /**
  * Appends the specified element to the end of this list.
@@ -63,8 +63,8 @@
  * @param element element to be appended to this list.
  */
 public void add(Object element) {
-	if (size == elements.length) ensureCapacity(size + 1); 
-	elements[size++] = element;
+  if (size == elements.length) ensureCapacity(size + 1); 
+  elements[size++] = element;
 }
 /**
  * Appends the part of the specified list between <code>from</code> (inclusive) and <code>to</code> (inclusive) to the receiver.
@@ -75,7 +75,7 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>other.size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=other.size())</tt>).
  */
 public void addAllOfFromTo(ObjectArrayList other, int from, int to) {
-	beforeInsertAllOfFromTo(size, other, from, to);
+  beforeInsertAllOfFromTo(size, other, from, to);
 }
 /**
  * Inserts the specified element before the specified position into the receiver. 
@@ -87,13 +87,13 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>index &lt; 0 || index &gt; size()</tt>).
  */
 public void beforeInsert(int index, Object element) {
-	// overridden for performance only.
-	if (index > size || index < 0) 
-		throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
-	ensureCapacity(size + 1);
-	System.arraycopy(elements, index, elements, index+1, size-index);
-	elements[index] = element;
-	size++;
+  // overridden for performance only.
+  if (index > size || index < 0) 
+    throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
+  ensureCapacity(size + 1);
+  System.arraycopy(elements, index, elements, index+1, size-index);
+  elements[index] = element;
+  size++;
 }
 /**
  * Inserts the part of the specified list between <code>otherFrom</code> (inclusive) and <code>otherTo</code> (inclusive) before the specified position into the receiver. 
@@ -108,9 +108,9 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>index &lt; 0 || index &gt; size()</tt>).
  */
 public void beforeInsertAllOfFromTo(int index, ObjectArrayList other, int from, int to) {
-	int length=to-from+1;
-	this.beforeInsertDummies(index, length);
-	this.replaceFromToWithFrom(index, index+length-1, other, from);
+  int length=to-from+1;
+  this.beforeInsertDummies(index, length);
+  this.replaceFromToWithFrom(index, index+length-1, other, from);
 }
 /**
  * Inserts length dummies before the specified position into the receiver. 
@@ -121,13 +121,13 @@
  * @param length number of dummies to be inserted.
  */
 protected void beforeInsertDummies(int index, int length) {
-	if (index > size || index < 0) 
-		throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
-	if (length > 0) {
-		ensureCapacity(size + length);
-	    System.arraycopy(elements, index, elements, index + length, size-index);
-		size += length;
-	}
+  if (index > size || index < 0) 
+    throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
+  if (length > 0) {
+    ensureCapacity(size + length);
+      System.arraycopy(elements, index, elements, index + length, size-index);
+    size += length;
+  }
 }
 /**
  * Searches the receiver for the specified value using
@@ -141,18 +141,18 @@
  *
  * @param key the value to be searched for.
  * @return index of the search key, if it is contained in the receiver;
- *	       otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>.  The <i>insertion
- *	       point</i> is defined as the the point at which the value would
- * 	       be inserted into the receiver: the index of the first
- *	       element greater than the key, or <tt>receiver.size()</tt>, if all
- *	       elements in the receiver are less than the specified key.  Note
- *	       that this guarantees that the return value will be &gt;= 0 if
- *	       and only if the key is found.
+ *         otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>.  The <i>insertion
+ *         point</i> is defined as the the point at which the value would
+ *          be inserted into the receiver: the index of the first
+ *         element greater than the key, or <tt>receiver.size()</tt>, if all
+ *         elements in the receiver are less than the specified key.  Note
+ *         that this guarantees that the return value will be &gt;= 0 if
+ *         and only if the key is found.
  * @see Comparable
  * @see java.util.Arrays
  */
 public int binarySearch(Object key) {
-	return this.binarySearchFromTo(key, 0, size-1);
+  return this.binarySearchFromTo(key, 0, size-1);
 }
 /**
  * Searches the receiver for the specified value using
@@ -169,30 +169,30 @@
  * @param from the leftmost search position, inclusive.
  * @param to the rightmost search position, inclusive.
  * @return index of the search key, if it is contained in the receiver;
- *	       otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>.  The <i>insertion
- *	       point</i> is defined as the the point at which the value would
- * 	       be inserted into the receiver: the index of the first
- *	       element greater than the key, or <tt>receiver.size()</tt>, if all
- *	       elements in the receiver are less than the specified key.  Note
- *	       that this guarantees that the return value will be &gt;= 0 if
- *	       and only if the key is found.
+ *         otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>.  The <i>insertion
+ *         point</i> is defined as the the point at which the value would
+ *          be inserted into the receiver: the index of the first
+ *         element greater than the key, or <tt>receiver.size()</tt>, if all
+ *         elements in the receiver are less than the specified key.  Note
+ *         that this guarantees that the return value will be &gt;= 0 if
+ *         and only if the key is found.
  * @see Comparable
  * @see java.util.Arrays
  */
 public int binarySearchFromTo(Object key, int from, int to) {
-	int low = from;
-	int high = to;
+  int low = from;
+  int high = to;
 
-	while (low <= high) {
-		int mid =(low + high)/2;
-		Object midVal = elements[mid];
-		int cmp = ((Comparable)midVal).compareTo(key);
-
-		if (cmp < 0) low = mid + 1;
-		else if (cmp > 0) high = mid - 1;
-		else return mid; // key found
-	}
-	return -(low + 1);  // key not found.
+  while (low <= high) {
+    int mid =(low + high)/2;
+    Object midVal = elements[mid];
+    int cmp = ((Comparable)midVal).compareTo(key);
+
+    if (cmp < 0) low = mid + 1;
+    else if (cmp > 0) high = mid - 1;
+    else return mid; // key found
+  }
+  return -(low + 1);  // key not found.
 }
 /**
  * Searches the receiver for the specified value using
@@ -214,21 +214,21 @@
  * @param to the rightmost search position, inclusive.
  * @param comparator the comparator by which the receiver is sorted.
  * @throws ClassCastException if the receiver contains elements that are not
- *	       <i>mutually comparable</i> using the specified comparator.
+ *         <i>mutually comparable</i> using the specified comparator.
  * @return index of the search key, if it is contained in the receiver;
- *	       otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>.  The <i>insertion
- *	       point</i> is defined as the the point at which the value would
- * 	       be inserted into the receiver: the index of the first
- *	       element greater than the key, or <tt>receiver.size()</tt>, if all
- *	       elements in the receiver are less than the specified key.  Note
- *	       that this guarantees that the return value will be &gt;= 0 if
- *	       and only if the key is found.
+ *         otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>.  The <i>insertion
+ *         point</i> is defined as the the point at which the value would
+ *          be inserted into the receiver: the index of the first
+ *         element greater than the key, or <tt>receiver.size()</tt>, if all
+ *         elements in the receiver are less than the specified key.  Note
+ *         that this guarantees that the return value will be &gt;= 0 if
+ *         and only if the key is found.
  * @see org.apache.mahout.matrix.Sorting
  * @see java.util.Arrays
  * @see java.util.Comparator
  */
 public int binarySearchFromTo(Object key, int from, int to, java.util.Comparator comparator) {
-	return org.apache.mahout.matrix.Sorting.binarySearchFromTo(this.elements,key,from,to,comparator);
+  return org.apache.mahout.matrix.Sorting.binarySearchFromTo(this.elements,key,from,to,comparator);
 }
 /**
  * Returns a copy of the receiver such that the copy and the receiver <i>share</i> the same elements, but do not share the same array to index them;
@@ -238,9 +238,9 @@
  * @return  a copy of the receiver.
  */
 public Object clone() {
-	ObjectArrayList v = (ObjectArrayList)super.clone();
-	v.elements = (Object[]) elements.clone();
-	return v;
+  ObjectArrayList v = (ObjectArrayList)super.clone();
+  v.elements = (Object[]) elements.clone();
+  return v;
 }
 /**
  * Returns true if the receiver contains the specified element.
@@ -250,7 +250,7 @@
  * @param testForEquality if true -> test for equality, otherwise for identity.
  */
 public boolean contains(Object elem, boolean testForEquality) {
-	return indexOfFromTo(elem,0,size-1, testForEquality) >=0;
+  return indexOfFromTo(elem,0,size-1, testForEquality) >=0;
 }
 /**
  * Returns a copy of the receiver; call <code>clone()</code> and casts the result.
@@ -261,7 +261,7 @@
  * @return  a copy of the receiver.
  */
 public ObjectArrayList copy() {
-	return (ObjectArrayList) clone();
+  return (ObjectArrayList) clone();
 }
 /**
  * Deletes the first element from the receiver that matches the specified element.
@@ -276,8 +276,8 @@
  * @param element the element to be deleted.
  */
 public void delete(Object element, boolean testForEquality) {
-	int index = indexOfFromTo(element, 0, size-1, testForEquality);
-	if (index>=0) removeFromTo(index,index);
+  int index = indexOfFromTo(element, 0, size-1, testForEquality);
+  if (index>=0) removeFromTo(index,index);
 }
 /**
  * Returns the elements currently stored, including invalid elements between size and capacity, if any.
@@ -288,7 +288,7 @@
  * @return the elements currently stored.
  */
 public Object[] elements() {
-	return elements;
+  return elements;
 }
 /**
  * Sets the receiver's elements to be the specified array (not a copy of it).
@@ -301,9 +301,9 @@
  * @return the receiver itself.
  */
 public ObjectArrayList elements(Object[] elements) {
-	this.elements=elements;
-	this.size=elements.length;
-	return this;
+  this.elements=elements;
+  this.size=elements.length;
+  return this;
 }
 /**
  * Ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory.
@@ -312,7 +312,7 @@
  * @param   minCapacity   the desired minimum capacity.
  */
 public void ensureCapacity(int minCapacity) {
-	elements = org.apache.mahout.matrix.Arrays.ensureCapacity(elements,minCapacity);
+  elements = org.apache.mahout.matrix.Arrays.ensureCapacity(elements,minCapacity);
 }
 /**
 * Compares the specified Object with the receiver for equality.
@@ -328,7 +328,7 @@
 * @return true if the specified Object is equal to the receiver.
 */
 public boolean equals(Object otherObj) { //delta
-	return equals(otherObj, true);
+  return equals(otherObj, true);
 }
 /**
 * Compares the specified Object with the receiver for equality.
@@ -346,27 +346,27 @@
 * @return true if the specified Object is equal to the receiver.
 */
 public boolean equals(Object otherObj, boolean testForEquality) { //delta
-	if (! (otherObj instanceof ObjectArrayList)) {return false;}
-	if (this==otherObj) return true;
-	if (otherObj==null) return false;
-	ObjectArrayList other = (ObjectArrayList) otherObj;
-	if (elements==other.elements()) return true;
-	if (size!=other.size()) return false;
-
-	Object[] otherElements = other.elements();
-	Object[] theElements = elements;
-	if (! testForEquality) {
-		for (int i=size; --i >= 0; ) {
-			if (theElements[i] != otherElements[i]) return false;
-		}
-	}
-	else {
-		for (int i=size; --i >= 0; ) {
-			if (!(theElements[i]==null ? otherElements[i]==null : theElements[i].equals(otherElements[i]))) return false;
-		}
-	}
+  if (! (otherObj instanceof ObjectArrayList)) {return false;}
+  if (this==otherObj) return true;
+  if (otherObj==null) return false;
+  ObjectArrayList other = (ObjectArrayList) otherObj;
+  if (elements==other.elements()) return true;
+  if (size!=other.size()) return false;
+
+  Object[] otherElements = other.elements();
+  Object[] theElements = elements;
+  if (! testForEquality) {
+    for (int i=size; --i >= 0; ) {
+      if (theElements[i] != otherElements[i]) return false;
+    }
+  }
+  else {
+    for (int i=size; --i >= 0; ) {
+      if (!(theElements[i]==null ? otherElements[i]==null : theElements[i].equals(otherElements[i]))) return false;
+    }
+  }
 
-	return true;
+  return true;
 
 }
 /**
@@ -377,8 +377,8 @@
  * @param val the value to be stored in the specified elements of the receiver.
  */
 public void fillFromToWith(int from, int to, Object val) {
-	checkRangeFromTo(from,to,this.size);
-	for (int i=from; i<=to;) setQuick(i++,val); 
+  checkRangeFromTo(from,to,this.size);
+  for (int i=from; i<=to;) setQuick(i++,val); 
 }
 /**
  * Applies a procedure to each element of the receiver, if any.
@@ -387,11 +387,11 @@
  * @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise. 
  */
 public boolean forEach(ObjectProcedure procedure) {
-	Object[] theElements = elements;
-	int theSize = size;
-	
-	for (int i=0; i<theSize;) if (! procedure.apply(theElements[i++])) return false;
-	return true;
+  Object[] theElements = elements;
+  int theSize = size;
+  
+  for (int i=0; i<theSize;) if (! procedure.apply(theElements[i++])) return false;
+  return true;
 }
 /**
  * Returns the element at the specified position in the receiver.
@@ -400,9 +400,9 @@
  * @exception IndexOutOfBoundsException index is out of range (index &lt; 0 || index &gt;= size()).
  */
 public Object get(int index) {
-	if (index >= size || index < 0)
-		throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
-	return elements[index];
+  if (index >= size || index < 0)
+    throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
+  return elements[index];
 }
 /**
  * Returns the element at the specified position in the receiver; <b>WARNING:</b> Does not check preconditions. 
@@ -413,7 +413,7 @@
  * @param index index of element to return.
  */
 public Object getQuick(int index) {
-	return elements[index];
+  return elements[index];
 }
 /**
  * Returns the index of the first occurrence of the specified
@@ -425,7 +425,7 @@
  * @return  the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.
  */
 public int indexOf(Object element, boolean testForEquality) {
-	return this.indexOfFromTo(element, 0, size-1, testForEquality);
+  return this.indexOfFromTo(element, 0, size-1, testForEquality);
 }
 /**
  * Returns the index of the first occurrence of the specified
@@ -442,22 +442,22 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public int indexOfFromTo(Object element, int from, int to, boolean testForEquality) {
-	if (size==0) return -1;
-	checkRangeFromTo(from, to, size);
+  if (size==0) return -1;
+  checkRangeFromTo(from, to, size);
 
-	Object[] theElements = elements;
-	if (testForEquality && element!=null) {
-		for (int i = from ; i <= to; i++) {
-		    if (element.equals(theElements[i])) {return i;} //found
-		}
-
-	}
-	else {
-		for (int i = from ; i <= to; i++) {
-		    if (element==theElements[i]) {return i;} //found
-		}
-	}
-	return -1; //not found
+  Object[] theElements = elements;
+  if (testForEquality && element!=null) {
+    for (int i = from ; i <= to; i++) {
+        if (element.equals(theElements[i])) {return i;} //found
+    }
+
+  }
+  else {
+    for (int i = from ; i <= to; i++) {
+        if (element==theElements[i]) {return i;} //found
+    }
+  }
+  return -1; //not found
 }
 /**
  * Determines whether the receiver is sorted ascending, according to the <i>natural ordering</i> of its
@@ -473,14 +473,14 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public boolean isSortedFromTo(int from, int to) {
-	if (size==0) return true;
-	checkRangeFromTo(from, to, size);
-	
-	Object[] theElements = elements;
-	for (int i=from+1; i<=to; i++ ) {
-		if (((Comparable)theElements[i]).compareTo((Comparable) theElements[i-1]) < 0) return false;
-	}
-	return true;
+  if (size==0) return true;
+  checkRangeFromTo(from, to, size);
+  
+  Object[] theElements = elements;
+  for (int i=from+1; i<=to; i++ ) {
+    if (((Comparable)theElements[i]).compareTo((Comparable) theElements[i-1]) < 0) return false;
+  }
+  return true;
 }
 /**
  * Returns the index of the last occurrence of the specified
@@ -492,7 +492,7 @@
  * @return  the index of the last occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.
  */
 public int lastIndexOf(Object element, boolean testForEquality) {
-	return lastIndexOfFromTo(element, 0, size-1, testForEquality);
+  return lastIndexOfFromTo(element, 0, size-1, testForEquality);
 }
 /**
  * Returns the index of the last occurrence of the specified
@@ -508,22 +508,22 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public int lastIndexOfFromTo(Object element, int from, int to, boolean testForEquality) {
-	if (size==0) return -1;
-	checkRangeFromTo(from, to, size);
+  if (size==0) return -1;
+  checkRangeFromTo(from, to, size);
 
-	Object[] theElements = elements;
-	if (testForEquality && element!=null) {
-		for (int i = to ; i >= from; i--) {
-		    if (element.equals(theElements[i])) {return i;} //found
-		}
-
-	}
-	else {
-		for (int i = to ; i >= from; i--) {
-		    if (element==theElements[i]) {return i;} //found
-		}
-	}
-	return -1; //not found
+  Object[] theElements = elements;
+  if (testForEquality && element!=null) {
+    for (int i = to ; i >= from; i--) {
+        if (element.equals(theElements[i])) {return i;} //found
+    }
+
+  }
+  else {
+    for (int i = to ; i >= from; i--) {
+        if (element==theElements[i]) {return i;} //found
+    }
+  }
+  return -1; //not found
 }
 /**
  * Sorts the specified range of the receiver into
@@ -551,9 +551,9 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public void mergeSortFromTo(int from, int to) {
-	if (size==0) return;
-	checkRangeFromTo(from, to, size);
-	java.util.Arrays.sort(elements, from, to+1);
+  if (size==0) return;
+  checkRangeFromTo(from, to, size);
+  java.util.Arrays.sort(elements, from, to+1);
 }
 /**
  * Sorts the receiver according
@@ -577,17 +577,17 @@
  * @param to the index of the last element (inclusive) to be sorted.
  * @param c the comparator to determine the order of the receiver.
  * @throws ClassCastException if the array contains elements that are not
- *	       <i>mutually comparable</i> using the specified comparator.
+ *         <i>mutually comparable</i> using the specified comparator.
  * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt>
  * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or
- *	       <tt>toIndex &gt; a.length</tt>
+ *         <tt>toIndex &gt; a.length</tt>
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  * @see Comparator
  */
 public void mergeSortFromTo(int from, int to, java.util.Comparator c) {
-	if (size==0) return;
-	checkRangeFromTo(from, to, size);
-	java.util.Arrays.sort(elements, from, to+1, c);
+  if (size==0) return;
+  checkRangeFromTo(from, to, size);
+  java.util.Arrays.sort(elements, from, to+1, c);
 }
 /**
  * Returns a new list of the part of the receiver between <code>from</code>, inclusive, and <code>to</code>, inclusive.
@@ -597,13 +597,13 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
 */
 public ObjectArrayList partFromTo(int from, int to) {
-	if (size==0) return new ObjectArrayList(0);
+  if (size==0) return new ObjectArrayList(0);
 
-	checkRangeFromTo(from, to, size);
+  checkRangeFromTo(from, to, size);
 
-	Object[] part = new Object[to-from+1];
-	System.arraycopy(elements, from, part, 0, to-from+1);
-	return new ObjectArrayList(part);
+  Object[] part = new Object[to-from+1];
+  System.arraycopy(elements, from, part, 0, to-from+1);
+  return new ObjectArrayList(part);
 }
 /**
  * Sorts the specified range of the receiver into
@@ -629,9 +629,9 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public void quickSortFromTo(int from, int to) {
-	if (size==0) return;
-	checkRangeFromTo(from, to, size);
-	org.apache.mahout.matrix.Sorting.quickSort(elements, from, to+1);
+  if (size==0) return;
+  checkRangeFromTo(from, to, size);
+  org.apache.mahout.matrix.Sorting.quickSort(elements, from, to+1);
 }
 /**
  * Sorts the receiver according
@@ -652,17 +652,17 @@
  * @param to the index of the last element (inclusive) to be sorted.
  * @param c the comparator to determine the order of the receiver.
  * @throws ClassCastException if the array contains elements that are not
- *	       <i>mutually comparable</i> using the specified comparator.
+ *         <i>mutually comparable</i> using the specified comparator.
  * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt>
  * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or
- *	       <tt>toIndex &gt; a.length</tt>
+ *         <tt>toIndex &gt; a.length</tt>
  * @see Comparator
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public void quickSortFromTo(int from, int to, java.util.Comparator c) {
-	if (size==0) return;
-	checkRangeFromTo(from, to, size);
-	org.apache.mahout.matrix.Sorting.quickSort(elements, from, to+1, c);
+  if (size==0) return;
+  checkRangeFromTo(from, to, size);
+  org.apache.mahout.matrix.Sorting.quickSort(elements, from, to+1, c);
 }
 /**
 * Removes from the receiver all elements that are contained in the specified list.
@@ -673,17 +673,17 @@
 * @return <code>true</code> if the receiver changed as a result of the call.
 */
 public boolean removeAll(ObjectArrayList other, boolean testForEquality) {
-	if (other.size==0) return false; //nothing to do
-	int limit = other.size-1;
-	int j=0;
-	Object[] theElements = elements;
-	for (int i=0; i<size ; i++) {
-		if (other.indexOfFromTo(theElements[i], 0, limit, testForEquality) < 0) theElements[j++]=theElements[i];
-	}
-
-	boolean modified = (j!=size);
-	setSize(j);
-	return modified;
+  if (other.size==0) return false; //nothing to do
+  int limit = other.size-1;
+  int j=0;
+  Object[] theElements = elements;
+  for (int i=0; i<size ; i++) {
+    if (other.indexOfFromTo(theElements[i], 0, limit, testForEquality) < 0) theElements[j++]=theElements[i];
+  }
+
+  boolean modified = (j!=size);
+  setSize(j);
+  return modified;
 }
 /**
  * Removes from the receiver all elements whose index is between
@@ -696,14 +696,14 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public void removeFromTo(int from, int to) {
-	checkRangeFromTo(from, to, size);
-	int numMoved = size - to - 1;
-	if (numMoved >= 0) {
-		System.arraycopy(elements, to+1, elements, from, numMoved);
-		fillFromToWith(from+numMoved, size-1, null); //delta
-	}
-	int width = to-from+1;
-	if (width>0) size -= width;
+  checkRangeFromTo(from, to, size);
+  int numMoved = size - to - 1;
+  if (numMoved >= 0) {
+    System.arraycopy(elements, to+1, elements, from, numMoved);
+    fillFromToWith(from+numMoved, size-1, null); //delta
+  }
+  int width = to-from+1;
+  if (width>0) size -= width;
 }
 /**
  * Replaces a number of elements in the receiver with the same number of elements of another list.
@@ -716,12 +716,12 @@
  * @param otherFrom position of first element within other list to be copied.
  */
 public void replaceFromToWithFrom(int from, int to, ObjectArrayList other, int otherFrom) {
-	int length=to-from+1;
-	if (length>0) {
-		checkRangeFromTo(from, to, size);
-		checkRangeFromTo(otherFrom,otherFrom+length-1,other.size);
-		System.arraycopy(other.elements, otherFrom, elements, from, length);
-	}
+  int length=to-from+1;
+  if (length>0) {
+    checkRangeFromTo(from, to, size);
+    checkRangeFromTo(otherFrom,otherFrom+length-1,other.size);
+    System.arraycopy(other.elements, otherFrom, elements, from, length);
+  }
 }
 /**
 * Replaces the part between <code>from</code> (inclusive) and <code>to</code> (inclusive) with the other list's
@@ -767,39 +767,39 @@
 * </pre>
 */
 public void replaceFromToWithFromTo(int from, int to, ObjectArrayList other, int otherFrom, int otherTo) {
-	if (otherFrom>otherTo) {
-		throw new IndexOutOfBoundsException("otherFrom: "+otherFrom+", otherTo: "+otherTo);
-	}
-	if (this==other && to-from!=otherTo-otherFrom) { // avoid stumbling over my own feet
-		replaceFromToWithFromTo(from, to, partFromTo(otherFrom, otherTo), 0, otherTo-otherFrom);
-		return;
-	}
-	
-	int length=otherTo-otherFrom+1;
-	int diff=length;
-	int theLast=from-1;
-
-	//System.out.println("from="+from);
-	//System.out.println("to="+to);
-	//System.out.println("diff="+diff);
-	
-	if (to>=from) {
-		diff -= (to-from+1);
-		theLast=to;
-	}
-	
-	if (diff>0) {
-		beforeInsertDummies(theLast+1, diff);
-	}
-	else {
-		if (diff<0) {
-			removeFromTo(theLast+diff, theLast-1);
-		}
-	}
-
-	if (length>0) {
-		System.arraycopy(other.elements, otherFrom, elements, from, length);
-	}
+  if (otherFrom>otherTo) {
+    throw new IndexOutOfBoundsException("otherFrom: "+otherFrom+", otherTo: "+otherTo);
+  }
+  if (this==other && to-from!=otherTo-otherFrom) { // avoid stumbling over my own feet
+    replaceFromToWithFromTo(from, to, partFromTo(otherFrom, otherTo), 0, otherTo-otherFrom);
+    return;
+  }
+  
+  int length=otherTo-otherFrom+1;
+  int diff=length;
+  int theLast=from-1;
+
+  //System.out.println("from="+from);
+  //System.out.println("to="+to);
+  //System.out.println("diff="+diff);
+  
+  if (to>=from) {
+    diff -= (to-from+1);
+    theLast=to;
+  }
+  
+  if (diff>0) {
+    beforeInsertDummies(theLast+1, diff);
+  }
+  else {
+    if (diff<0) {
+      removeFromTo(theLast+diff, theLast-1);
+    }
+  }
+
+  if (length>0) {
+    System.arraycopy(other.elements, otherFrom, elements, from, length);
+  }
 }
 /**
  * Replaces the part of the receiver starting at <code>from</code> (inclusive) with all the elements of the specified collection.
@@ -811,12 +811,12 @@
  * @exception IndexOutOfBoundsException index is out of range (index &lt; 0 || index &gt;= size()).
  */
 public void replaceFromWith(int from, java.util.Collection other) {
-	checkRange(from,size);
-	java.util.Iterator e = other.iterator();
-	int index=from;
-	int limit = Math.min(size-from, other.size());
-	for (int i=0; i<limit; i++)
-	    elements[index++] = e.next(); //delta
+  checkRange(from,size);
+  java.util.Iterator e = other.iterator();
+  int index=from;
+  int limit = Math.min(size-from, other.size());
+  for (int i=0; i<limit; i++)
+      elements[index++] = e.next(); //delta
 }
 /**
 * Retains (keeps) only the elements in the receiver that are contained in the specified other list.
@@ -828,39 +828,39 @@
 * @return <code>true</code> if the receiver changed as a result of the call.
 */
 public boolean retainAll(ObjectArrayList other, boolean testForEquality) {
-	if (other.size==0) {
-		if (size==0) return false;
-		setSize(0);
-		return true;
-	}
-	
-	int limit = other.size-1;
-	int j=0;
-	Object[] theElements = elements;
-
-	for (int i=0; i<size ; i++) {
-		if (other.indexOfFromTo(theElements[i], 0, limit, testForEquality) >= 0) theElements[j++]=theElements[i];
-	}
-
-	boolean modified = (j!=size);
-	setSize(j);
-	return modified;
+  if (other.size==0) {
+    if (size==0) return false;
+    setSize(0);
+    return true;
+  }
+  
+  int limit = other.size-1;
+  int j=0;
+  Object[] theElements = elements;
+
+  for (int i=0; i<size ; i++) {
+    if (other.indexOfFromTo(theElements[i], 0, limit, testForEquality) >= 0) theElements[j++]=theElements[i];
+  }
+
+  boolean modified = (j!=size);
+  setSize(j);
+  return modified;
 }
 /**
  * Reverses the elements of the receiver.
  * Last becomes first, second last becomes second first, and so on.
  */
 public void reverse() {
-	Object tmp;
-	int limit=size/2;
-	int j=size-1;
-	
-	Object[] theElements = elements;
-	for (int i=0; i<limit;) { //swap
-		tmp=theElements[i];
-		theElements[i++]=theElements[j];
-		theElements[j--]=tmp;
-	}
+  Object tmp;
+  int limit=size/2;
+  int j=size-1;
+  
+  Object[] theElements = elements;
+  for (int i=0; i<limit;) { //swap
+    tmp=theElements[i];
+    theElements[i++]=theElements[j];
+    theElements[j--]=tmp;
+  }
 }
 /**
  * Replaces the element at the specified position in the receiver with the specified element.
@@ -868,12 +868,12 @@
  * @param index index of element to replace.
  * @param element element to be stored at the specified position.
  * @exception IndexOutOfBoundsException index is out of range (index
- * 		  &lt; 0 || index &gt;= size()).
+ *       &lt; 0 || index &gt;= size()).
 */
 public void set(int index, Object element) {
-	if (index >= size || index < 0)
-		throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
-	elements[index] = element;
+  if (index >= size || index < 0)
+    throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
+  elements[index] = element;
 }
 /**
  * Replaces the element at the specified position in the receiver with the specified element; <b>WARNING:</b> Does not check preconditions.
@@ -885,7 +885,7 @@
  * @param element element to be stored at the specified position.
  */
 public void setQuick(int index, Object element) {
-	elements[index] = element;
+  elements[index] = element;
 }
 /**
  * Randomly permutes the part of the receiver between <code>from</code> (inclusive) and <code>to</code> (inclusive). 
@@ -894,21 +894,21 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public void shuffleFromTo(int from, int to) {
-	if (size == 0) return;
-	checkRangeFromTo(from, to, size);
-	
-	org.apache.mahout.jet.random.Uniform gen = new org.apache.mahout.jet.random.Uniform(new org.apache.mahout.jet.random.engine.DRand(new java.util.Date()));
-	Object tmpElement;
-	Object[] theElements = elements;
-	int random;
-	for (int i = from; i < to; i++) {
-		random = gen.nextIntFromTo(i, to);
-
-		//swap(i, random)
-		tmpElement = theElements[random];
-		theElements[random] = theElements[i];
-		theElements[i] = tmpElement;
-	}
+  if (size == 0) return;
+  checkRangeFromTo(from, to, size);
+  
+  org.apache.mahout.jet.random.Uniform gen = new org.apache.mahout.jet.random.Uniform(new org.apache.mahout.jet.random.engine.DRand(new java.util.Date()));
+  Object tmpElement;
+  Object[] theElements = elements;
+  int random;
+  for (int i = from; i < to; i++) {
+    random = gen.nextIntFromTo(i, to);
+
+    //swap(i, random)
+    tmpElement = theElements[random];
+    theElements[random] = theElements[i];
+    theElements[i] = tmpElement;
+  }
 }
 /**
  * Returns the number of elements contained in the receiver.
@@ -916,18 +916,18 @@
  * @returns  the number of elements contained in the receiver.
  */
 public int size() {
-	return size;
+  return size;
 }
 /**
  * Returns a list which is a concatenation of <code>times</code> times the receiver.
  * @param times the number of times the receiver shall be copied.
  */
 public ObjectArrayList times(int times) {
-	ObjectArrayList newList = new ObjectArrayList(times*size);
-	for (int i=times; --i >= 0; ) {
-		newList.addAllOfFromTo(this,0,size()-1);
-	}
-	return newList;
+  ObjectArrayList newList = new ObjectArrayList(times*size);
+  for (int i=times; --i >= 0; ) {
+    newList.addAllOfFromTo(this,0,size()-1);
+  }
+  return newList;
 }
 /**
  * Returns an array containing all of the elements in the receiver in the
@@ -944,39 +944,39 @@
  * does not contain any null elements.
  *
  * @param array the array into which the elements of the receiver are to
- *		be stored, if it is big enough; otherwise, a new array of the
- * 		same runtime type is allocated for this purpose.
+ *    be stored, if it is big enough; otherwise, a new array of the
+ *     same runtime type is allocated for this purpose.
  * @return an array containing the elements of the receiver.
  * @exception ArrayStoreException the runtime type of <tt>array</tt> is not a supertype
  * of the runtime type of every element in the receiver.
  */
 public Object[] toArray(Object array[]) {
-	if (array.length < size)
-		array = (Object[])java.lang.reflect.Array.newInstance(array.getClass().getComponentType(), size);
+  if (array.length < size)
+    array = (Object[])java.lang.reflect.Array.newInstance(array.getClass().getComponentType(), size);
 
-	Object[] theElements = elements;
-	for (int i=size; --i >=0; ) array[i]=theElements[i];
+  Object[] theElements = elements;
+  for (int i=size; --i >=0; ) array[i]=theElements[i];
 
-	if (array.length > size) array[size] = null;
+  if (array.length > size) array[size] = null;
 
-	return array;
+  return array;
 }
 /**
  * Returns a <code>java.util.ArrayList</code> containing all the elements in the receiver.
  */
 public java.util.ArrayList toList() {
-	int mySize = size();
-	Object[] theElements = elements;
-	java.util.ArrayList list = new java.util.ArrayList(mySize);
-	for (int i=0; i < mySize; i++) list.add(theElements[i]);
-	return list;
+  int mySize = size();
+  Object[] theElements = elements;
+  java.util.ArrayList list = new java.util.ArrayList(mySize);
+  for (int i=0; i < mySize; i++) list.add(theElements[i]);
+  return list;
 }
 /**
 * Returns a string representation of the receiver, containing
 * the String representation of each element.
 */
 public String toString() {
-	return org.apache.mahout.matrix.Arrays.toString(partFromTo(0, size()-1).elements());
+  return org.apache.mahout.matrix.Arrays.toString(partFromTo(0, size()-1).elements());
 }
 /**
  * Trims the capacity of the receiver to be the receiver's current 
@@ -984,6 +984,6 @@
  * storage of the receiver.
  */
 public void trimToSize() {
-	elements = org.apache.mahout.matrix.Arrays.trimToCapacity(elements,size());
+  elements = org.apache.mahout.matrix.Arrays.trimToCapacity(elements,size());
 }
 }

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/ShortArrayList.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/ShortArrayList.java?rev=883973&r1=883972&r2=883973&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/ShortArrayList.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/ShortArrayList.java Wed Nov 25 03:35:59 2009
@@ -18,17 +18,17 @@
  */
 @Deprecated
 public class ShortArrayList extends AbstractShortList {
-	/**
-	 * The array buffer into which the elements of the list are stored.
-	 * The capacity of the list is the length of this array buffer.
-	 * @serial
-	 */
-	protected short[] elements;
+  /**
+   * The array buffer into which the elements of the list are stored.
+   * The capacity of the list is the length of this array buffer.
+   * @serial
+   */
+  protected short[] elements;
 /**
  * Constructs an empty list.
  */
 public ShortArrayList() {
-	this(10);
+  this(10);
 }
 /**
  * Constructs a list containing the specified elements. 
@@ -40,7 +40,7 @@
  * @param elements the array to be backed by the the constructed list
  */
 public ShortArrayList(short[] elements) {
-	elements(elements);
+  elements(elements);
 }
 /**
  * Constructs an empty list with the specified initial capacity.
@@ -48,8 +48,8 @@
  * @param   initialCapacity   the number of elements the receiver can hold without auto-expanding itself by allocating new internal memory.
  */
 public ShortArrayList(int initialCapacity) {
-	this(new short[initialCapacity]);
-	setSizeRaw(0);
+  this(new short[initialCapacity]);
+  setSizeRaw(0);
 }
 /**
  * Appends the specified element to the end of this list.
@@ -57,11 +57,11 @@
  * @param element element to be appended to this list.
  */
 public void add(short element) {
-	// overridden for performance only.
-	if (size == elements.length) {
-		ensureCapacity(size + 1); 
-	}
-	elements[size++] = element;
+  // overridden for performance only.
+  if (size == elements.length) {
+    ensureCapacity(size + 1); 
+  }
+  elements[size++] = element;
 }
 /**
  * Inserts the specified element before the specified position into the receiver. 
@@ -73,13 +73,13 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>index &lt; 0 || index &gt; size()</tt>).
  */
 public void beforeInsert(int index, short element) {
-	// overridden for performance only.
-	if (index > size || index < 0) 
-		throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
-	ensureCapacity(size + 1);
-	System.arraycopy(elements, index, elements, index+1, size-index);
-	elements[index] = element;
-	size++;
+  // overridden for performance only.
+  if (index > size || index < 0) 
+    throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
+  ensureCapacity(size + 1);
+  System.arraycopy(elements, index, elements, index+1, size-index);
+  elements[index] = element;
+  size++;
 }
 /**
  * Searches the receiver for the specified value using
@@ -94,18 +94,18 @@
  * @param from the leftmost search position, inclusive.
  * @param to the rightmost search position, inclusive.
  * @return index of the search key, if it is contained in the receiver;
- *	       otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>.  The <i>insertion
- *	       point</i> is defined as the the point at which the value would
- * 	       be inserted into the receiver: the index of the first
- *	       element greater than the key, or <tt>receiver.size()</tt>, if all
- *	       elements in the receiver are less than the specified key.  Note
- *	       that this guarantees that the return value will be &gt;= 0 if
- *	       and only if the key is found.
+ *         otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>.  The <i>insertion
+ *         point</i> is defined as the the point at which the value would
+ *          be inserted into the receiver: the index of the first
+ *         element greater than the key, or <tt>receiver.size()</tt>, if all
+ *         elements in the receiver are less than the specified key.  Note
+ *         that this guarantees that the return value will be &gt;= 0 if
+ *         and only if the key is found.
  * @see org.apache.mahout.matrix.Sorting
  * @see java.util.Arrays
  */
 public int binarySearchFromTo(short key, int from, int to) {
-	return org.apache.mahout.matrix.Sorting.binarySearchFromTo(this.elements,key,from,to);
+  return org.apache.mahout.matrix.Sorting.binarySearchFromTo(this.elements,key,from,to);
 }
 /**
  * Returns a deep copy of the receiver. 
@@ -113,10 +113,10 @@
  * @return  a deep copy of the receiver.
  */
 public Object clone() {
-	// overridden for performance only.
-	ShortArrayList clone = new ShortArrayList((short[]) elements.clone());
-	clone.setSizeRaw(size);
-	return clone;
+  // overridden for performance only.
+  ShortArrayList clone = new ShortArrayList((short[]) elements.clone());
+  clone.setSizeRaw(size);
+  return clone;
 }
 /**
  * Returns a deep copy of the receiver; uses <code>clone()</code> and casts the result.
@@ -124,7 +124,7 @@
  * @return  a deep copy of the receiver.
  */
 public ShortArrayList copy() {
-	return (ShortArrayList) clone();
+  return (ShortArrayList) clone();
 }
  /**
  * Sorts the specified range of the receiver into ascending numerical order. 
@@ -141,28 +141,28 @@
  * @param max the largest element contained in the range.
  */
 protected void countSortFromTo(int from, int to, short min, short max) {
-	if (size==0) return;
-	checkRangeFromTo(from, to, size);
+  if (size==0) return;
+  checkRangeFromTo(from, to, size);
 
-	final int width = (int) (max-min+1);
-	
-	int[] counts = new int[width];
-	short[] theElements = elements;	
-	for (int i=from; i<=to; ) counts[(int)(theElements[i++]-min)]++;
-
-	int fromIndex = from;
-	short val = min;
-	for (int i=0; i<width; i++, val++) {
-		int c = counts[i];
-		if (c>0) {
-			if (c==1) theElements[fromIndex++]=val;
-			else {
-				int toIndex = fromIndex + c - 1;
-				fillFromToWith(fromIndex,toIndex,val);
-				fromIndex = toIndex + 1;
-			}
-		}
-	}
+  final int width = (int) (max-min+1);
+  
+  int[] counts = new int[width];
+  short[] theElements = elements;  
+  for (int i=from; i<=to; ) counts[(int)(theElements[i++]-min)]++;
+
+  int fromIndex = from;
+  short val = min;
+  for (int i=0; i<width; i++, val++) {
+    int c = counts[i];
+    if (c>0) {
+      if (c==1) theElements[fromIndex++]=val;
+      else {
+        int toIndex = fromIndex + c - 1;
+        fillFromToWith(fromIndex,toIndex,val);
+        fromIndex = toIndex + 1;
+      }
+    }
+  }
 }
 /**
  * Returns the elements currently stored, including invalid elements between size and capacity, if any.
@@ -173,7 +173,7 @@
  * @return the elements currently stored.
  */
 public short[] elements() {
-	return elements;
+  return elements;
 }
 /**
  * Sets the receiver's elements to be the specified array (not a copy of it).
@@ -186,9 +186,9 @@
  * @return the receiver itself.
  */
 public AbstractShortList elements(short[] elements) {
-	this.elements=elements;
-	this.size=elements.length;
-	return this;
+  this.elements=elements;
+  this.size=elements.length;
+  return this;
 }
 /**
  * Ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory.
@@ -197,7 +197,7 @@
  * @param   minCapacity   the desired minimum capacity.
  */
 public void ensureCapacity(int minCapacity) {
-	elements = org.apache.mahout.matrix.Arrays.ensureCapacity(elements,minCapacity);
+  elements = org.apache.mahout.matrix.Arrays.ensureCapacity(elements,minCapacity);
 }
 /**
  * Compares the specified Object with the receiver.  
@@ -210,19 +210,19 @@
  * @return true if the specified Object is equal to the receiver.
  */
 public boolean equals(Object otherObj) { //delta
-	// overridden for performance only.
-	if (! (otherObj instanceof ShortArrayList)) return super.equals(otherObj);
-	if (this==otherObj) return true;
-	if (otherObj==null) return false;
-	ShortArrayList other = (ShortArrayList) otherObj;
-	if (size()!=other.size()) return false;
-
-	short[] theElements = elements();
-	short[] otherElements = other.elements();
-	for (int i=size(); --i >= 0; ) {
-	    if (theElements[i] != otherElements[i]) return false;
-	}
-	return true;
+  // overridden for performance only.
+  if (! (otherObj instanceof ShortArrayList)) return super.equals(otherObj);
+  if (this==otherObj) return true;
+  if (otherObj==null) return false;
+  ShortArrayList other = (ShortArrayList) otherObj;
+  if (size()!=other.size()) return false;
+
+  short[] theElements = elements();
+  short[] otherElements = other.elements();
+  for (int i=size(); --i >= 0; ) {
+      if (theElements[i] != otherElements[i]) return false;
+  }
+  return true;
 }
 /**
  * Applies a procedure to each element of the receiver, if any.
@@ -231,25 +231,25 @@
  * @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise. 
  */
 public boolean forEach(ShortProcedure procedure) {
-	// overridden for performance only.
-	short[] theElements = elements;
-	int theSize = size;
-	
-	for (int i=0; i<theSize;) if (! procedure.apply(theElements[i++])) return false;
-	return true;
+  // overridden for performance only.
+  short[] theElements = elements;
+  int theSize = size;
+  
+  for (int i=0; i<theSize;) if (! procedure.apply(theElements[i++])) return false;
+  return true;
 }
 /**
  * Returns the element at the specified position in the receiver.
  *
  * @param index index of element to return.
  * @exception IndexOutOfBoundsException index is out of range (index
- * 		  &lt; 0 || index &gt;= size()).
+ *       &lt; 0 || index &gt;= size()).
  */
 public short get(int index) {
-	// overridden for performance only.
-	if (index >= size || index < 0)
-		throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
-	return elements[index];
+  // overridden for performance only.
+  if (index >= size || index < 0)
+    throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
+  return elements[index];
 }
 /**
  * Returns the element at the specified position in the receiver; <b>WARNING:</b> Does not check preconditions. 
@@ -260,7 +260,7 @@
  * @param index index of element to return.
  */
 public short getQuick(int index) {
-	return elements[index];
+  return elements[index];
 }
 /**
  * Returns the index of the first occurrence of the specified
@@ -275,15 +275,15 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public int indexOfFromTo(short element, int from, int to) {
-	// overridden for performance only.
-	if (size==0) return -1;
-	checkRangeFromTo(from, to, size);
-
-	short[] theElements = elements;
-	for (int i = from ; i <= to; i++) {
-	    if (element==theElements[i]) {return i;} //found
-	}
-	return -1; //not found
+  // overridden for performance only.
+  if (size==0) return -1;
+  checkRangeFromTo(from, to, size);
+
+  short[] theElements = elements;
+  for (int i = from ; i <= to; i++) {
+      if (element==theElements[i]) {return i;} //found
+  }
+  return -1; //not found
 }
 /**
  * Returns the index of the last occurrence of the specified
@@ -298,15 +298,15 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public int lastIndexOfFromTo(short element, int from, int to) {
-	// overridden for performance only.
-	if (size==0) return -1;
-	checkRangeFromTo(from, to, size);
-
-	short[] theElements = elements;
-	for (int i = to ; i >= from; i--) {
-	    if (element==theElements[i]) {return i;} //found
-	}
-	return -1; //not found
+  // overridden for performance only.
+  if (size==0) return -1;
+  checkRangeFromTo(from, to, size);
+
+  short[] theElements = elements;
+  for (int i = to ; i >= from; i--) {
+      if (element==theElements[i]) {return i;} //found
+  }
+  return -1; //not found
 }
 /**
  * Returns a new list of the part of the receiver between <code>from</code>, inclusive, and <code>to</code>, inclusive.
@@ -316,13 +316,13 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public AbstractShortList partFromTo(int from, int to) {
-	if (size==0) return new ShortArrayList(0);
+  if (size==0) return new ShortArrayList(0);
 
-	checkRangeFromTo(from, to, size);
+  checkRangeFromTo(from, to, size);
 
-	short[] part = new short[to-from+1];
-	System.arraycopy(elements, from, part, 0, to-from+1);
-	return new ShortArrayList(part);
+  short[] part = new short[to-from+1];
+  System.arraycopy(elements, from, part, 0, to-from+1);
+  return new ShortArrayList(part);
 }
 /**
 * Removes from the receiver all elements that are contained in the specified list.
@@ -332,46 +332,46 @@
 * @return <code>true</code> if the receiver changed as a result of the call.
 */
 public boolean removeAll(AbstractShortList other) {
-	// overridden for performance only.
-	if (! (other instanceof ShortArrayList))	return super.removeAll(other);
-	
-	/* There are two possibilities to do the thing
-	   a) use other.indexOf(...)
-	   b) sort other, then use other.binarySearch(...)
-	   
-	   Let's try to figure out which one is faster. Let M=size, N=other.size, then
-	   a) takes O(M*N) steps
-	   b) takes O(N*logN + M*logN) steps (sorting is O(N*logN) and binarySearch is O(logN))
+  // overridden for performance only.
+  if (! (other instanceof ShortArrayList))  return super.removeAll(other);
+  
+  /* There are two possibilities to do the thing
+     a) use other.indexOf(...)
+     b) sort other, then use other.binarySearch(...)
+     
+     Let's try to figure out which one is faster. Let M=size, N=other.size, then
+     a) takes O(M*N) steps
+     b) takes O(N*logN + M*logN) steps (sorting is O(N*logN) and binarySearch is O(logN))
  
-	   Hence, if N*logN + M*logN < M*N, we use b) otherwise we use a).
-	*/
-	if (other.size()==0) {return false;} //nothing to do
-	int limit = other.size()-1;
-	int j=0;
-	short[] theElements = elements;
-	int mySize = size();
-
-	double N=(double) other.size();
-	double M=(double) mySize;
-	if ( (N+M)* org.apache.mahout.jet.math.Arithmetic.log2(N) < M*N ) {
-		// it is faster to sort other before searching in it
-		ShortArrayList sortedList = (ShortArrayList) other.clone();
-		sortedList.quickSort();
-
-		for (int i=0; i<mySize ; i++) {
-			if (sortedList.binarySearchFromTo(theElements[i], 0, limit) < 0) theElements[j++]=theElements[i];
-		}
-	}
-	else {
-		// it is faster to search in other without sorting
-		for (int i=0; i<mySize ; i++) {
-			if (other.indexOfFromTo(theElements[i], 0, limit) < 0) theElements[j++]=theElements[i];
-		}
-	}
-
-	boolean modified = (j!=mySize);
-	setSize(j);
-	return modified;
+     Hence, if N*logN + M*logN < M*N, we use b) otherwise we use a).
+  */
+  if (other.size()==0) {return false;} //nothing to do
+  int limit = other.size()-1;
+  int j=0;
+  short[] theElements = elements;
+  int mySize = size();
+
+  double N=(double) other.size();
+  double M=(double) mySize;
+  if ( (N+M)* org.apache.mahout.jet.math.Arithmetic.log2(N) < M*N ) {
+    // it is faster to sort other before searching in it
+    ShortArrayList sortedList = (ShortArrayList) other.clone();
+    sortedList.quickSort();
+
+    for (int i=0; i<mySize ; i++) {
+      if (sortedList.binarySearchFromTo(theElements[i], 0, limit) < 0) theElements[j++]=theElements[i];
+    }
+  }
+  else {
+    // it is faster to search in other without sorting
+    for (int i=0; i<mySize ; i++) {
+      if (other.indexOfFromTo(theElements[i], 0, limit) < 0) theElements[j++]=theElements[i];
+    }
+  }
+
+  boolean modified = (j!=mySize);
+  setSize(j);
+  return modified;
 }
 /**
  * Replaces a number of elements in the receiver with the same number of elements of another list.
@@ -384,18 +384,18 @@
  * @param otherFrom position of first element within other list to be copied.
  */
 public void replaceFromToWithFrom(int from, int to, AbstractShortList other, int otherFrom) {
-	// overridden for performance only.
-	if (! (other instanceof ShortArrayList)) {
-		// slower
-		super.replaceFromToWithFrom(from,to,other,otherFrom);
-		return;
-	}
-	int length=to-from+1;
-	if (length>0) {
-		checkRangeFromTo(from, to, size());
-		checkRangeFromTo(otherFrom,otherFrom+length-1,other.size());
-		System.arraycopy(((ShortArrayList) other).elements, otherFrom, elements, from, length);
-	}
+  // overridden for performance only.
+  if (! (other instanceof ShortArrayList)) {
+    // slower
+    super.replaceFromToWithFrom(from,to,other,otherFrom);
+    return;
+  }
+  int length=to-from+1;
+  if (length>0) {
+    checkRangeFromTo(from, to, size());
+    checkRangeFromTo(otherFrom,otherFrom+length-1,other.size());
+    System.arraycopy(((ShortArrayList) other).elements, otherFrom, elements, from, length);
+  }
 }
 /**
 * Retains (keeps) only the elements in the receiver that are contained in the specified other list.
@@ -405,62 +405,62 @@
 * @return <code>true</code> if the receiver changed as a result of the call.
 */
 public boolean retainAll(AbstractShortList other) {
-	// overridden for performance only.
-	if (! (other instanceof ShortArrayList))	return super.retainAll(other);
-	
-	/* There are two possibilities to do the thing
-	   a) use other.indexOf(...)
-	   b) sort other, then use other.binarySearch(...)
-	   
-	   Let's try to figure out which one is faster. Let M=size, N=other.size, then
-	   a) takes O(M*N) steps
-	   b) takes O(N*logN + M*logN) steps (sorting is O(N*logN) and binarySearch is O(logN))
-
-	   Hence, if N*logN + M*logN < M*N, we use b) otherwise we use a).
-	*/
-	int limit = other.size()-1;
-	int j=0;
-	short[] theElements = elements;
-	int mySize = size();
-
-	double N=(double) other.size();
-	double M=(double) mySize;
-	if ( (N+M)* org.apache.mahout.jet.math.Arithmetic.log2(N) < M*N ) {
-		// it is faster to sort other before searching in it
-		ShortArrayList sortedList = (ShortArrayList) other.clone();
-		sortedList.quickSort();
-
-		for (int i=0; i<mySize ; i++) {
-			if (sortedList.binarySearchFromTo(theElements[i], 0, limit) >= 0) theElements[j++]=theElements[i];
-		}
-	}
-	else {
-		// it is faster to search in other without sorting
-		for (int i=0; i<mySize ; i++) {
-			if (other.indexOfFromTo(theElements[i], 0, limit) >= 0) theElements[j++]=theElements[i];
-		}
-	}
-
-	boolean modified = (j!=mySize);
-	setSize(j);
-	return modified;
+  // overridden for performance only.
+  if (! (other instanceof ShortArrayList))  return super.retainAll(other);
+  
+  /* There are two possibilities to do the thing
+     a) use other.indexOf(...)
+     b) sort other, then use other.binarySearch(...)
+     
+     Let's try to figure out which one is faster. Let M=size, N=other.size, then
+     a) takes O(M*N) steps
+     b) takes O(N*logN + M*logN) steps (sorting is O(N*logN) and binarySearch is O(logN))
+
+     Hence, if N*logN + M*logN < M*N, we use b) otherwise we use a).
+  */
+  int limit = other.size()-1;
+  int j=0;
+  short[] theElements = elements;
+  int mySize = size();
+
+  double N=(double) other.size();
+  double M=(double) mySize;
+  if ( (N+M)* org.apache.mahout.jet.math.Arithmetic.log2(N) < M*N ) {
+    // it is faster to sort other before searching in it
+    ShortArrayList sortedList = (ShortArrayList) other.clone();
+    sortedList.quickSort();
+
+    for (int i=0; i<mySize ; i++) {
+      if (sortedList.binarySearchFromTo(theElements[i], 0, limit) >= 0) theElements[j++]=theElements[i];
+    }
+  }
+  else {
+    // it is faster to search in other without sorting
+    for (int i=0; i<mySize ; i++) {
+      if (other.indexOfFromTo(theElements[i], 0, limit) >= 0) theElements[j++]=theElements[i];
+    }
+  }
+
+  boolean modified = (j!=mySize);
+  setSize(j);
+  return modified;
 }
 /**
  * Reverses the elements of the receiver.
  * Last becomes first, second last becomes second first, and so on.
  */
 public void reverse() {
-	// overridden for performance only.
-	short tmp;
-	int limit=size/2;
-	int j=size-1;
-
-	short[] theElements = elements;
-	for (int i=0; i<limit;) { //swap
-		tmp=theElements[i];
-		theElements[i++]=theElements[j];
-		theElements[j--]=tmp;
-	}
+  // overridden for performance only.
+  short tmp;
+  int limit=size/2;
+  int j=size-1;
+
+  short[] theElements = elements;
+  for (int i=0; i<limit;) { //swap
+    tmp=theElements[i];
+    theElements[i++]=theElements[j];
+    theElements[j--]=tmp;
+  }
 }
 /**
  * Replaces the element at the specified position in the receiver with the specified element.
@@ -468,13 +468,13 @@
  * @param index index of element to replace.
  * @param element element to be stored at the specified position.
  * @exception IndexOutOfBoundsException index is out of range (index
- * 		  &lt; 0 || index &gt;= size()).
+ *       &lt; 0 || index &gt;= size()).
  */
 public void set(int index, short element) {
-	// overridden for performance only.
-	if (index >= size || index < 0)
-		throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
-	elements[index] = element;
+  // overridden for performance only.
+  if (index >= size || index < 0)
+    throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
+  elements[index] = element;
 }
 /**
  * Replaces the element at the specified position in the receiver with the specified element; <b>WARNING:</b> Does not check preconditions.
@@ -486,7 +486,7 @@
  * @param element element to be stored at the specified position.
  */
 public void setQuick(int index, short element) {
-	elements[index] = element;
+  elements[index] = element;
 }
 /**
  * Randomly permutes the part of the receiver between <code>from</code> (inclusive) and <code>to</code> (inclusive). 
@@ -495,22 +495,22 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public void shuffleFromTo(int from, int to) {
-	// overridden for performance only.
-	if (size==0) {return;}
-	checkRangeFromTo(from, to, size);
-	
-	org.apache.mahout.jet.random.Uniform gen = new org.apache.mahout.jet.random.Uniform(new org.apache.mahout.jet.random.engine.DRand(new java.util.Date()));
-	short tmpElement;
-	short[] theElements = elements;
-	int random;
-	for (int i=from; i<to; i++) { 
-		random = gen.nextIntFromTo(i, to);
-
-		//swap(i, random)
-		tmpElement = theElements[random];
-		theElements[random]=theElements[i]; 
-		theElements[i]=tmpElement; 
-	}  
+  // overridden for performance only.
+  if (size==0) {return;}
+  checkRangeFromTo(from, to, size);
+  
+  org.apache.mahout.jet.random.Uniform gen = new org.apache.mahout.jet.random.Uniform(new org.apache.mahout.jet.random.engine.DRand(new java.util.Date()));
+  short tmpElement;
+  short[] theElements = elements;
+  int random;
+  for (int i=from; i<to; i++) { 
+    random = gen.nextIntFromTo(i, to);
+
+    //swap(i, random)
+    tmpElement = theElements[random];
+    theElements[random]=theElements[i]; 
+    theElements[i]=tmpElement; 
+  }  
 }
 /**
  * Sorts the specified range of the receiver into ascending order. 
@@ -529,39 +529,39 @@
  * @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
  */
 public void sortFromTo(int from, int to) {
-	/* 
-	 * Computes min and max and decides on this basis.
-	 * In practice the additional overhead is very small compared to the potential gains.
-	 */
-	final int widthThreshold = 10000; // never consider options resulting in outrageous memory allocations.
-	
-	if (size==0) return;
-	checkRangeFromTo(from, to, size);
-
-	// determine minimum and maximum.
-	short min=elements[from];
-	short max=elements[from];
-
-	short[] theElements = elements;
-	for (int i=from+1; i<=to; ) {
-		short elem = theElements[i++];
-		if (elem>max) max=elem;
-		else if (elem<min) min=elem;
-	}
-
-	// try to figure out which option is fastest.
-	double N = (double)to - (double)from + 1.0;
-	double quickSortEstimate = 	N * Math.log(N)/0.6931471805599453; // O(N*log(N,base=2)) ; ln(2)=0.6931471805599453
-
-	double width = (double)max - (double)min + 1.0;
-	double countSortEstimate = 	Math.max(width,N); // O(Max(width,N))
-	
-	if (width < widthThreshold && countSortEstimate < quickSortEstimate) {
-		countSortFromTo(from, to, min, max);
-	}
-	else {
-		quickSortFromTo(from, to);
-	}
+  /* 
+   * Computes min and max and decides on this basis.
+   * In practice the additional overhead is very small compared to the potential gains.
+   */
+  final int widthThreshold = 10000; // never consider options resulting in outrageous memory allocations.
+  
+  if (size==0) return;
+  checkRangeFromTo(from, to, size);
+
+  // determine minimum and maximum.
+  short min=elements[from];
+  short max=elements[from];
+
+  short[] theElements = elements;
+  for (int i=from+1; i<=to; ) {
+    short elem = theElements[i++];
+    if (elem>max) max=elem;
+    else if (elem<min) min=elem;
+  }
+
+  // try to figure out which option is fastest.
+  double N = (double)to - (double)from + 1.0;
+  double quickSortEstimate =   N * Math.log(N)/0.6931471805599453; // O(N*log(N,base=2)) ; ln(2)=0.6931471805599453
+
+  double width = (double)max - (double)min + 1.0;
+  double countSortEstimate =   Math.max(width,N); // O(Max(width,N))
+  
+  if (width < widthThreshold && countSortEstimate < quickSortEstimate) {
+    countSortFromTo(from, to, min, max);
+  }
+  else {
+    quickSortFromTo(from, to);
+  }
 }
 /**
  * Trims the capacity of the receiver to be the receiver's current 
@@ -569,6 +569,6 @@
  * storage of the receiver.
  */
 public void trimToSize() {
-	elements = org.apache.mahout.matrix.Arrays.trimToCapacity(elements,size());
+  elements = org.apache.mahout.matrix.Arrays.trimToCapacity(elements,size());
 }
 }

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/SimpleLongArrayList.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/SimpleLongArrayList.java?rev=883973&r1=883972&r2=883973&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/SimpleLongArrayList.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/SimpleLongArrayList.java Wed Nov 25 03:35:59 2009
@@ -17,23 +17,23 @@
  */
 @Deprecated
 public class SimpleLongArrayList extends AbstractLongList {
-	/**
-	 * The array buffer into which the elements of the list are stored.
-	 * The capacity of the list is the length of this array buffer.
-	 * @serial
-	 */
-	protected long[] elements;
-	
-	/**
-	 * The size of the list.
-	 * @serial
-	 */
-	protected int size;
+  /**
+   * The array buffer into which the elements of the list are stored.
+   * The capacity of the list is the length of this array buffer.
+   * @serial
+   */
+  protected long[] elements;
+  
+  /**
+   * The size of the list.
+   * @serial
+   */
+  protected int size;
 /**
  * Constructs an empty list.
  */
 public SimpleLongArrayList() {
-	this(10);
+  this(10);
 }
 /**
  * Constructs a list containing the specified elements. 
@@ -45,7 +45,7 @@
  * @param elements the array to be backed by the the constructed list
  */
 public SimpleLongArrayList(long[] elements) {
-	elements(elements);
+  elements(elements);
 }
 /**
  * Constructs an empty list with the specified initial capacity.
@@ -53,12 +53,12 @@
  * @param   initialCapacity   the number of elements the receiver can hold without auto-expanding itself by allocating new internal memory.
  */
 public SimpleLongArrayList(int initialCapacity) {
-	super();
-	if (initialCapacity < 0)
-	   throw new IllegalArgumentException("Illegal Capacity: "+ initialCapacity);
+  super();
+  if (initialCapacity < 0)
+     throw new IllegalArgumentException("Illegal Capacity: "+ initialCapacity);
 
-	this.elements(new long[initialCapacity]);
-	size=0;
+  this.elements(new long[initialCapacity]);
+  size=0;
 }
 /**
  * Ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory.
@@ -67,7 +67,7 @@
  * @param   minCapacity   the desired minimum capacity.
  */
 public void ensureCapacity(int minCapacity) {
-	elements = org.apache.mahout.matrix.Arrays.ensureCapacity(elements,minCapacity);
+  elements = org.apache.mahout.matrix.Arrays.ensureCapacity(elements,minCapacity);
 }
 /**
  * Returns the element at the specified position in the receiver; <b>WARNING:</b> Does not check preconditions. 
@@ -78,7 +78,7 @@
  * @param index index of element to return.
  */
 protected long getQuick(int index) {
-	return elements[index];
+  return elements[index];
 }
 /**
  * Replaces the element at the specified position in the receiver with the specified element; <b>WARNING:</b> Does not check preconditions. 
@@ -90,7 +90,7 @@
  * @param element element to be stored at the specified position.
  */
 protected void setQuick(int index, long element) {
-	elements[index] = element;
+  elements[index] = element;
 }
 /**
 * Trims the capacity of the receiver to be the receiver's current 
@@ -98,6 +98,6 @@
 * storage of the receiver. 
 */
 public void trimToSize() {
-	elements = org.apache.mahout.matrix.Arrays.trimToCapacity(elements,size());
+  elements = org.apache.mahout.matrix.Arrays.trimToCapacity(elements,size());
 }
 }

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/DoubleListAdapter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/DoubleListAdapter.java?rev=883973&r1=883972&r2=883973&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/DoubleListAdapter.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/DoubleListAdapter.java Wed Nov 25 03:35:59 2009
@@ -22,12 +22,12 @@
  */
 @Deprecated
 public class DoubleListAdapter extends java.util.AbstractList implements java.util.List {
-	protected AbstractDoubleList content;
+  protected AbstractDoubleList content;
 /**
  * Constructs a list backed by the specified content list.
  */
 public DoubleListAdapter(AbstractDoubleList content) {
-	this.content = content;
+  this.content = content;
 }
 /**
  * Inserts the specified element at the specified position in this list
@@ -39,15 +39,15 @@
  * @param element element to be inserted.
  * 
  * @throws ClassCastException if the class of the specified element
- * 		  prevents it from being added to this list.
+ *       prevents it from being added to this list.
  * @throws IllegalArgumentException if some aspect of the specified
- *		  element prevents it from being added to this list.
+ *      element prevents it from being added to this list.
  * @throws IndexOutOfBoundsException index is out of range (<tt>index &lt;
- *		  0 || index &gt; size()</tt>).
+ *      0 || index &gt; size()</tt>).
  */
 public void add(int index, Object element) {
-	content.beforeInsert(index,value(element));
-	modCount++;
+  content.beforeInsert(index,value(element));
+  modCount++;
 }
 /**
  * Returns the element at the specified position in this list.
@@ -56,16 +56,16 @@
  * 
  * @return the element at the specified position in this list.
  * @throws IndexOutOfBoundsException if the given index is out of range
- * 		  (<tt>index &lt; 0 || index &gt;= size()</tt>).
+ *       (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 public Object get(int index) {
-	return object(content.get(index));
+  return object(content.get(index));
 }
 /**
  * Transforms an element of a primitive data type to an object. 
  */
 protected static Object object(double element) {
-	return new Double(element);
+  return new Double(element);
 }
 /**
  * Removes the element at the specified position in this list (optional
@@ -77,13 +77,13 @@
  * @return the element previously at the specified position.
  * 
  * @throws IndexOutOfBoundsException if the specified index is out of
- * 		  range (<tt>index &lt; 0 || index &gt;= size()</tt>).
+ *       range (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 public Object remove(int index) {
-	Object old = get(index);
-	content.remove(index);
-	modCount++;
-	return old;
+  Object old = get(index);
+  content.remove(index);
+  modCount++;
+  return old;
 }
 /**
  * Replaces the element at the specified position in this list with the
@@ -94,18 +94,18 @@
  * @return the element previously at the specified position.
  * 
  * @throws ClassCastException if the class of the specified element
- * 		  prevents it from being added to this list.
+ *       prevents it from being added to this list.
  * @throws IllegalArgumentException if some aspect of the specified
- *		  element prevents it from being added to this list.
+ *      element prevents it from being added to this list.
  * 
  * @throws IndexOutOfBoundsException if the specified index is out of
  *            range (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 
 public Object set(int index, Object element) {
-	Object old = get(index);
-	content.set(index,value(element));
-	return old;
+  Object old = get(index);
+  content.set(index,value(element));
+  return old;
 }
 /**
  * Returns the number of elements in this list.
@@ -113,12 +113,12 @@
  * @return  the number of elements in this list.
  */
 public int size() {
-	return content.size();
+  return content.size();
 }
 /**
  * Transforms an object element to a primitive data type. 
  */
 protected static double value(Object element) {
-	return ((Number)element).doubleValue();
+  return ((Number)element).doubleValue();
 }
 }

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/FloatListAdapter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/FloatListAdapter.java?rev=883973&r1=883972&r2=883973&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/FloatListAdapter.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/FloatListAdapter.java Wed Nov 25 03:35:59 2009
@@ -22,12 +22,12 @@
  */
 @Deprecated
 public class FloatListAdapter extends java.util.AbstractList implements java.util.List {
-	protected AbstractFloatList content;
+  protected AbstractFloatList content;
 /**
  * Constructs a list backed by the specified content list.
  */
 public FloatListAdapter(AbstractFloatList content) {
-	this.content = content;
+  this.content = content;
 }
 /**
  * Inserts the specified element at the specified position in this list
@@ -39,15 +39,15 @@
  * @param element element to be inserted.
  * 
  * @throws ClassCastException if the class of the specified element
- * 		  prevents it from being added to this list.
+ *       prevents it from being added to this list.
  * @throws IllegalArgumentException if some aspect of the specified
- *		  element prevents it from being added to this list.
+ *      element prevents it from being added to this list.
  * @throws IndexOutOfBoundsException index is out of range (<tt>index &lt;
- *		  0 || index &gt; size()</tt>).
+ *      0 || index &gt; size()</tt>).
  */
 public void add(int index, Object element) {
-	content.beforeInsert(index,value(element));
-	modCount++;
+  content.beforeInsert(index,value(element));
+  modCount++;
 }
 /**
  * Returns the element at the specified position in this list.
@@ -56,16 +56,16 @@
  * 
  * @return the element at the specified position in this list.
  * @throws IndexOutOfBoundsException if the given index is out of range
- * 		  (<tt>index &lt; 0 || index &gt;= size()</tt>).
+ *       (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 public Object get(int index) {
-	return object(content.get(index));
+  return object(content.get(index));
 }
 /**
  * Transforms an element of a primitive data type to an object. 
  */
 protected static Object object(float element) {
-	return new Float(element);
+  return new Float(element);
 }
 /**
  * Removes the element at the specified position in this list (optional
@@ -77,13 +77,13 @@
  * @return the element previously at the specified position.
  * 
  * @throws IndexOutOfBoundsException if the specified index is out of
- * 		  range (<tt>index &lt; 0 || index &gt;= size()</tt>).
+ *       range (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 public Object remove(int index) {
-	Object old = get(index);
-	content.remove(index);
-	modCount++;
-	return old;
+  Object old = get(index);
+  content.remove(index);
+  modCount++;
+  return old;
 }
 /**
  * Replaces the element at the specified position in this list with the
@@ -94,18 +94,18 @@
  * @return the element previously at the specified position.
  * 
  * @throws ClassCastException if the class of the specified element
- * 		  prevents it from being added to this list.
+ *       prevents it from being added to this list.
  * @throws IllegalArgumentException if some aspect of the specified
- *		  element prevents it from being added to this list.
+ *      element prevents it from being added to this list.
  * 
  * @throws IndexOutOfBoundsException if the specified index is out of
  *            range (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 
 public Object set(int index, Object element) {
-	Object old = get(index);
-	content.set(index,value(element));
-	return old;
+  Object old = get(index);
+  content.set(index,value(element));
+  return old;
 }
 /**
  * Returns the number of elements in this list.
@@ -113,12 +113,12 @@
  * @return  the number of elements in this list.
  */
 public int size() {
-	return content.size();
+  return content.size();
 }
 /**
  * Transforms an object element to a primitive data type. 
  */
 protected static float value(Object element) {
-	return ((Number)element).floatValue();
+  return ((Number)element).floatValue();
 }
 }

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/IntListAdapter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/IntListAdapter.java?rev=883973&r1=883972&r2=883973&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/IntListAdapter.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/IntListAdapter.java Wed Nov 25 03:35:59 2009
@@ -22,12 +22,12 @@
  */
 @Deprecated
 public class IntListAdapter extends java.util.AbstractList implements java.util.List {
-	protected AbstractIntList content;
+  protected AbstractIntList content;
 /**
  * Constructs a list backed by the specified content list.
  */
 public IntListAdapter(AbstractIntList content) {
-	this.content = content;
+  this.content = content;
 }
 /**
  * Inserts the specified element at the specified position in this list
@@ -39,15 +39,15 @@
  * @param element element to be inserted.
  * 
  * @throws ClassCastException if the class of the specified element
- * 		  prevents it from being added to this list.
+ *       prevents it from being added to this list.
  * @throws IllegalArgumentException if some aspect of the specified
- *		  element prevents it from being added to this list.
+ *      element prevents it from being added to this list.
  * @throws IndexOutOfBoundsException index is out of range (<tt>index &lt;
- *		  0 || index &gt; size()</tt>).
+ *      0 || index &gt; size()</tt>).
  */
 public void add(int index, Object element) {
-	content.beforeInsert(index,value(element));
-	modCount++;
+  content.beforeInsert(index,value(element));
+  modCount++;
 }
 /**
  * Returns the element at the specified position in this list.
@@ -56,16 +56,16 @@
  * 
  * @return the element at the specified position in this list.
  * @throws IndexOutOfBoundsException if the given index is out of range
- * 		  (<tt>index &lt; 0 || index &gt;= size()</tt>).
+ *       (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 public Object get(int index) {
-	return object(content.get(index));
+  return object(content.get(index));
 }
 /**
  * Transforms an element of a primitive data type to an object. 
  */
 protected static Object object(int element) {
-	return new Integer(element);
+  return new Integer(element);
 }
 /**
  * Removes the element at the specified position in this list (optional
@@ -77,13 +77,13 @@
  * @return the element previously at the specified position.
  * 
  * @throws IndexOutOfBoundsException if the specified index is out of
- * 		  range (<tt>index &lt; 0 || index &gt;= size()</tt>).
+ *       range (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 public Object remove(int index) {
-	Object old = get(index);
-	content.remove(index);
-	modCount++;
-	return old;
+  Object old = get(index);
+  content.remove(index);
+  modCount++;
+  return old;
 }
 /**
  * Replaces the element at the specified position in this list with the
@@ -94,18 +94,18 @@
  * @return the element previously at the specified position.
  * 
  * @throws ClassCastException if the class of the specified element
- * 		  prevents it from being added to this list.
+ *       prevents it from being added to this list.
  * @throws IllegalArgumentException if some aspect of the specified
- *		  element prevents it from being added to this list.
+ *      element prevents it from being added to this list.
  * 
  * @throws IndexOutOfBoundsException if the specified index is out of
  *            range (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 
 public Object set(int index, Object element) {
-	Object old = get(index);
-	content.set(index,value(element));
-	return old;
+  Object old = get(index);
+  content.set(index,value(element));
+  return old;
 }
 /**
  * Returns the number of elements in this list.
@@ -113,12 +113,12 @@
  * @return  the number of elements in this list.
  */
 public int size() {
-	return content.size();
+  return content.size();
 }
 /**
  * Transforms an object element to a primitive data type. 
  */
 protected static int value(Object element) {
-	return ((Number)element).intValue();
+  return ((Number)element).intValue();
 }
 }

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/LongListAdapter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/LongListAdapter.java?rev=883973&r1=883972&r2=883973&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/LongListAdapter.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/LongListAdapter.java Wed Nov 25 03:35:59 2009
@@ -22,12 +22,12 @@
  */
 @Deprecated
 public class LongListAdapter extends java.util.AbstractList implements java.util.List {
-	protected AbstractLongList content;
+  protected AbstractLongList content;
 /**
  * Constructs a list backed by the specified content list.
  */
 public LongListAdapter(AbstractLongList content) {
-	this.content = content;
+  this.content = content;
 }
 /**
  * Inserts the specified element at the specified position in this list
@@ -39,15 +39,15 @@
  * @param element element to be inserted.
  * 
  * @throws ClassCastException if the class of the specified element
- * 		  prevents it from being added to this list.
+ *       prevents it from being added to this list.
  * @throws IllegalArgumentException if some aspect of the specified
- *		  element prevents it from being added to this list.
+ *      element prevents it from being added to this list.
  * @throws IndexOutOfBoundsException index is out of range (<tt>index &lt;
- *		  0 || index &gt; size()</tt>).
+ *      0 || index &gt; size()</tt>).
  */
 public void add(int index, Object element) {
-	content.beforeInsert(index,value(element));
-	modCount++;
+  content.beforeInsert(index,value(element));
+  modCount++;
 }
 /**
  * Returns the element at the specified position in this list.
@@ -56,16 +56,16 @@
  * 
  * @return the element at the specified position in this list.
  * @throws IndexOutOfBoundsException if the given index is out of range
- * 		  (<tt>index &lt; 0 || index &gt;= size()</tt>).
+ *       (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 public Object get(int index) {
-	return object(content.get(index));
+  return object(content.get(index));
 }
 /**
  * Transforms an element of a primitive data type to an object. 
  */
 protected static Object object(long element) {
-	return new Long(element);
+  return new Long(element);
 }
 /**
  * Removes the element at the specified position in this list (optional
@@ -77,13 +77,13 @@
  * @return the element previously at the specified position.
  * 
  * @throws IndexOutOfBoundsException if the specified index is out of
- * 		  range (<tt>index &lt; 0 || index &gt;= size()</tt>).
+ *       range (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 public Object remove(int index) {
-	Object old = get(index);
-	content.remove(index);
-	modCount++;
-	return old;
+  Object old = get(index);
+  content.remove(index);
+  modCount++;
+  return old;
 }
 /**
  * Replaces the element at the specified position in this list with the
@@ -94,18 +94,18 @@
  * @return the element previously at the specified position.
  * 
  * @throws ClassCastException if the class of the specified element
- * 		  prevents it from being added to this list.
+ *       prevents it from being added to this list.
  * @throws IllegalArgumentException if some aspect of the specified
- *		  element prevents it from being added to this list.
+ *      element prevents it from being added to this list.
  * 
  * @throws IndexOutOfBoundsException if the specified index is out of
  *            range (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 
 public Object set(int index, Object element) {
-	Object old = get(index);
-	content.set(index,value(element));
-	return old;
+  Object old = get(index);
+  content.set(index,value(element));
+  return old;
 }
 /**
  * Returns the number of elements in this list.
@@ -113,12 +113,12 @@
  * @return  the number of elements in this list.
  */
 public int size() {
-	return content.size();
+  return content.size();
 }
 /**
  * Transforms an object element to a primitive data type. 
  */
 protected static long value(Object element) {
-	return ((Number)element).longValue();
+  return ((Number)element).longValue();
 }
 }

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/ObjectListAdapter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/ObjectListAdapter.java?rev=883973&r1=883972&r2=883973&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/ObjectListAdapter.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/list/adapter/ObjectListAdapter.java Wed Nov 25 03:35:59 2009
@@ -18,12 +18,12 @@
  */
 @Deprecated
 public class ObjectListAdapter extends java.util.AbstractList implements java.util.List {
-	protected ObjectArrayList content;
+  protected ObjectArrayList content;
 /**
  * Constructs a list backed by the specified content list.
  */
 public ObjectListAdapter(ObjectArrayList content) {
-	this.content = content;
+  this.content = content;
 }
 /**
  * Inserts the specified element at the specified position in this list
@@ -35,15 +35,15 @@
  * @param element element to be inserted.
  * 
  * @throws ClassCastException if the class of the specified element
- * 		  prevents it from being added to this list.
+ *       prevents it from being added to this list.
  * @throws IllegalArgumentException if some aspect of the specified
- *		  element prevents it from being added to this list.
+ *      element prevents it from being added to this list.
  * @throws IndexOutOfBoundsException index is out of range (<tt>index &lt;
- *		  0 || index &gt; size()</tt>).
+ *      0 || index &gt; size()</tt>).
  */
 public void add(int index, Object element) {
-	content.beforeInsert(index,element);
-	modCount++;
+  content.beforeInsert(index,element);
+  modCount++;
 }
 /**
  * Returns the element at the specified position in this list.
@@ -52,10 +52,10 @@
  * 
  * @return the element at the specified position in this list.
  * @throws IndexOutOfBoundsException if the given index is out of range
- * 		  (<tt>index &lt; 0 || index &gt;= size()</tt>).
+ *       (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 public Object get(int index) {
-	return content.get(index);
+  return content.get(index);
 }
 /**
  * Removes the element at the specified position in this list (optional
@@ -67,13 +67,13 @@
  * @return the element previously at the specified position.
  * 
  * @throws IndexOutOfBoundsException if the specified index is out of
- * 		  range (<tt>index &lt; 0 || index &gt;= size()</tt>).
+ *       range (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 public Object remove(int index) {
-	Object old = get(index);
-	content.remove(index);
-	modCount++;
-	return old;
+  Object old = get(index);
+  content.remove(index);
+  modCount++;
+  return old;
 }
 /**
  * Replaces the element at the specified position in this list with the
@@ -84,18 +84,18 @@
  * @return the element previously at the specified position.
  * 
  * @throws ClassCastException if the class of the specified element
- * 		  prevents it from being added to this list.
+ *       prevents it from being added to this list.
  * @throws IllegalArgumentException if some aspect of the specified
- *		  element prevents it from being added to this list.
+ *      element prevents it from being added to this list.
  * 
  * @throws IndexOutOfBoundsException if the specified index is out of
  *            range (<tt>index &lt; 0 || index &gt;= size()</tt>).
  */
 
 public Object set(int index, Object element) {
-	Object old = get(index);
-	content.set(index,element);
-	return old;
+  Object old = get(index);
+  content.set(index,element);
+  return old;
 }
 /**
  * Returns the number of elements in this list.
@@ -103,6 +103,6 @@
  * @return  the number of elements in this list.
  */
 public int size() {
-	return content.size();
+  return content.size();
 }
 }