Return-Path: Delivered-To: apmail-incubator-hama-commits-archive@locus.apache.org Received: (qmail 77749 invoked from network); 13 Nov 2008 06:32:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Nov 2008 06:32:30 -0000 Received: (qmail 37855 invoked by uid 500); 13 Nov 2008 06:32:38 -0000 Delivered-To: apmail-incubator-hama-commits-archive@incubator.apache.org Received: (qmail 37842 invoked by uid 500); 13 Nov 2008 06:32:38 -0000 Mailing-List: contact hama-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hama-dev@ Delivered-To: mailing list hama-commits@incubator.apache.org Received: (qmail 37831 invoked by uid 99); 13 Nov 2008 06:32:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Nov 2008 22:32:37 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Nov 2008 06:31:15 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EA2DD23888F1; Wed, 12 Nov 2008 22:31:28 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r713656 - in /incubator/hama/trunk/src: java/org/apache/hama/ java/org/apache/hama/io/ java/org/apache/hama/util/ test/org/apache/hama/ Date: Thu, 13 Nov 2008 06:31:28 -0000 To: hama-commits@incubator.apache.org From: edwardyoon@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081113063128.EA2DD23888F1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: edwardyoon Date: Wed Nov 12 22:31:27 2008 New Revision: 713656 URL: http://svn.apache.org/viewvc?rev=713656&view=rev Log: (empty) Added: incubator/hama/trunk/src/java/org/apache/hama/io/BlockEntry.java incubator/hama/trunk/src/java/org/apache/hama/io/DoubleEntry.java Removed: incubator/hama/trunk/src/java/org/apache/hama/io/VectorEntry.java Modified: incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java incubator/hama/trunk/src/java/org/apache/hama/DenseVector.java incubator/hama/trunk/src/java/org/apache/hama/Vector.java incubator/hama/trunk/src/java/org/apache/hama/io/VectorMapWritable.java incubator/hama/trunk/src/java/org/apache/hama/io/VectorUpdate.java incubator/hama/trunk/src/java/org/apache/hama/io/VectorWritable.java incubator/hama/trunk/src/java/org/apache/hama/util/Numeric.java incubator/hama/trunk/src/test/org/apache/hama/TestDenseMatrix.java incubator/hama/trunk/src/test/org/apache/hama/TestDenseVector.java Modified: incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java?rev=713656&r1=713655&r2=713656&view=diff ============================================================================== --- incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java (original) +++ incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java Wed Nov 12 22:31:27 2008 @@ -21,11 +21,11 @@ import java.util.Iterator; -import org.apache.hama.io.VectorEntry; +import org.apache.hama.io.DoubleEntry; import org.apache.hama.io.VectorMapWritable; public abstract class AbstractVector { - public VectorMapWritable entries; + public VectorMapWritable entries; public double get(int index) throws NullPointerException { return this.entries.get(index).getValue(); @@ -34,10 +34,10 @@ public void set(int index, double value) { // If entries are null, create new object if(this.entries == null) { - this.entries = new VectorMapWritable(); + this.entries = new VectorMapWritable(); } - this.entries.put(index, new VectorEntry(value)); + this.entries.put(index, new DoubleEntry(value)); } public void add(int index, double value) { @@ -49,7 +49,7 @@ * * @return iterator */ - public Iterator iterator() { + public Iterator iterator() { return this.entries.values().iterator(); } @@ -62,7 +62,7 @@ return (this.entries != null) ? this.entries.size() : 0; } - public VectorMapWritable getEntries() { + public VectorMapWritable getEntries() { return this.entries; } } Modified: incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java?rev=713656&r1=713655&r2=713656&view=diff ============================================================================== --- incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java (original) +++ incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java Wed Nov 12 22:31:27 2008 @@ -34,7 +34,7 @@ import org.apache.hama.algebra.RowCyclicAdditionReduce; import org.apache.hama.algebra.SIMDMultiplyMap; import org.apache.hama.algebra.SIMDMultiplyReduce; -import org.apache.hama.io.VectorEntry; +import org.apache.hama.io.DoubleEntry; import org.apache.hama.io.VectorMapWritable; import org.apache.hama.io.VectorUpdate; import org.apache.hama.io.VectorWritable; @@ -276,11 +276,11 @@ byte[][] c = { columnKey }; Scanner scan = table.getScanner(c, HConstants.EMPTY_START_ROW); - VectorMapWritable trunk = new VectorMapWritable(); + VectorMapWritable trunk = new VectorMapWritable(); for (RowResult row : scan) { trunk.put(Numeric.bytesToInt(row.getRow()), - new VectorEntry(row.get(columnKey))); + new DoubleEntry(row.get(columnKey))); } return new DenseVector(trunk); Modified: incubator/hama/trunk/src/java/org/apache/hama/DenseVector.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/DenseVector.java?rev=713656&r1=713655&r2=713656&view=diff ============================================================================== --- incubator/hama/trunk/src/java/org/apache/hama/DenseVector.java (original) +++ incubator/hama/trunk/src/java/org/apache/hama/DenseVector.java Wed Nov 12 22:31:27 2008 @@ -25,7 +25,7 @@ import org.apache.hadoop.hbase.io.Cell; import org.apache.hadoop.hbase.io.RowResult; -import org.apache.hama.io.VectorEntry; +import org.apache.hama.io.DoubleEntry; import org.apache.hama.io.VectorMapWritable; import org.apache.hama.util.Numeric; import org.apache.log4j.Logger; @@ -34,18 +34,18 @@ static final Logger LOG = Logger.getLogger(DenseVector.class); public DenseVector() { - this(new VectorMapWritable()); + this(new VectorMapWritable()); } - public DenseVector(VectorMapWritable m) { + public DenseVector(VectorMapWritable m) { this.entries = m; } public DenseVector(RowResult row) { - this.entries = new VectorMapWritable(); + this.entries = new VectorMapWritable(); for (Map.Entry f : row.entrySet()) { this.entries.put(Numeric.getColumnIndex(f.getKey()), - new VectorEntry(f.getValue())); + new DoubleEntry(f.getValue())); } } @@ -69,7 +69,7 @@ for (int i = 0; i < this.size(); i++) { double value = (this.get(i) + v2.get(i)); - this.entries.put(i, new VectorEntry(value)); + this.entries.put(i, new DoubleEntry(value)); } return this; @@ -87,8 +87,8 @@ } public Vector scale(double alpha) { - for(Map.Entry e : this.entries.entrySet()) { - this.entries.put(e.getKey(), new VectorEntry(e.getValue().getValue() * alpha)); + for(Map.Entry e : this.entries.entrySet()) { + this.entries.put(e.getKey(), new DoubleEntry(e.getValue().getValue() * alpha)); } return this; } Modified: incubator/hama/trunk/src/java/org/apache/hama/Vector.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/Vector.java?rev=713656&r1=713655&r2=713656&view=diff ============================================================================== --- incubator/hama/trunk/src/java/org/apache/hama/Vector.java (original) +++ incubator/hama/trunk/src/java/org/apache/hama/Vector.java Wed Nov 12 22:31:27 2008 @@ -21,7 +21,7 @@ import java.util.Iterator; -import org.apache.hama.io.VectorEntry; +import org.apache.hama.io.DoubleEntry; /** * Basic vector interface. @@ -143,5 +143,5 @@ * * @return iterator */ - public Iterator iterator(); + public Iterator iterator(); } Added: incubator/hama/trunk/src/java/org/apache/hama/io/BlockEntry.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/io/BlockEntry.java?rev=713656&view=auto ============================================================================== --- incubator/hama/trunk/src/java/org/apache/hama/io/BlockEntry.java (added) +++ incubator/hama/trunk/src/java/org/apache/hama/io/BlockEntry.java Wed Nov 12 22:31:27 2008 @@ -0,0 +1,129 @@ +package org.apache.hama.io; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Iterator; + +import org.apache.hadoop.hbase.io.Cell; +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.hadoop.io.Writable; +import org.apache.hama.SubMatrix; +import org.apache.hama.util.Numeric; +import org.apache.log4j.Logger; + +public class BlockEntry implements Writable, Iterable { + static final Logger LOG = Logger.getLogger(BlockEntry.class); + protected byte[][] values; + + // We don't need this. + @Deprecated + protected long[] timestamps; + + /** For Writable compatibility */ + public BlockEntry() { + values = null; + timestamps = null; + } + + public BlockEntry(Cell c) { + this.values = new byte[1][]; + this.values[0] = c.getValue(); + this.timestamps = new long[1]; + this.timestamps[0] = c.getTimestamp(); + } + + public BlockEntry(SubMatrix value) throws IOException { + this.values = new byte[1][]; + this.values[0] = Numeric.subMatrixToBytes(value); + this.timestamps = new long[1]; + this.timestamps[0] = System.currentTimeMillis(); + } + + /** + * @return the current VectorEntry's value + * @throws IOException + * @throws ClassNotFoundException + */ + public SubMatrix getValue() throws IOException, ClassNotFoundException { + return Numeric.bytesToSubMatrix(this.values[0]); + } + + /** @return the current VectorEntry's timestamp */ + public long getTimestamp() { + return timestamps[0]; + } + + /** + * Create a new VectorEntry with a given value and timestamp. Used by HStore. + * + * @param value + * @param timestamp + */ + public BlockEntry(byte[] value, long timestamp) { + this.values = new byte[1][]; + this.values[0] = value; + this.timestamps = new long[1]; + this.timestamps[0] = timestamp; + } + + // + // Writable + // + + /** {@inheritDoc} */ + public void readFields(final DataInput in) throws IOException { + int nvalues = in.readInt(); + this.timestamps = new long[nvalues]; + this.values = new byte[nvalues][]; + for (int i = 0; i < nvalues; i++) { + this.timestamps[i] = in.readLong(); + } + for (int i = 0; i < nvalues; i++) { + this.values[i] = Bytes.readByteArray(in); + } + } + + /** {@inheritDoc} */ + public void write(final DataOutput out) throws IOException { + out.writeInt(this.values.length); + for (int i = 0; i < this.timestamps.length; i++) { + out.writeLong(this.timestamps[i]); + } + for (int i = 0; i < this.values.length; i++) { + Bytes.writeByteArray(out, this.values[i]); + } + } + + // + // Iterable + // + + /** {@inheritDoc} */ + public Iterator iterator() { + return new BlockEntryIterator(); + } + + private class BlockEntryIterator implements Iterator { + private int currentValue = -1; + + BlockEntryIterator() { + } + + /** {@inheritDoc} */ + public boolean hasNext() { + return currentValue < values.length; + } + + /** {@inheritDoc} */ + public BlockEntry next() { + currentValue += 1; + return new BlockEntry(values[currentValue], timestamps[currentValue]); + } + + /** {@inheritDoc} */ + public void remove() throws UnsupportedOperationException { + throw new UnsupportedOperationException("remove is not supported"); + } + } +} Added: incubator/hama/trunk/src/java/org/apache/hama/io/DoubleEntry.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/io/DoubleEntry.java?rev=713656&view=auto ============================================================================== --- incubator/hama/trunk/src/java/org/apache/hama/io/DoubleEntry.java (added) +++ incubator/hama/trunk/src/java/org/apache/hama/io/DoubleEntry.java Wed Nov 12 22:31:27 2008 @@ -0,0 +1,143 @@ +/** + * Copyright 2007 The Apache Software Foundation + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hama.io; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Iterator; + +import org.apache.hadoop.hbase.io.Cell; +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.hadoop.io.Writable; +import org.apache.hama.util.Numeric; +import org.apache.log4j.Logger; + +public class DoubleEntry implements Writable, Iterable { + static final Logger LOG = Logger.getLogger(DoubleEntry.class); + protected byte[][] values; + + // We don't need this. + @Deprecated + protected long[] timestamps; + + /** For Writable compatibility */ + public DoubleEntry() { + values = null; + timestamps = null; + } + + public DoubleEntry(Cell c) { + this.values = new byte[1][]; + this.values[0] = c.getValue(); + this.timestamps = new long[1]; + this.timestamps[0] = c.getTimestamp(); + } + + public DoubleEntry(double value) { + this.values = new byte[1][]; + this.values[0] = Numeric.doubleToBytes(value); + this.timestamps = new long[1]; + this.timestamps[0] = System.currentTimeMillis(); + } + + /** @return the current VectorEntry's value */ + public double getValue() { + return Numeric.bytesToDouble(this.values[0]); + } + + /** @return the current VectorEntry's timestamp */ + public long getTimestamp() { + return timestamps[0]; + } + + /** + * Create a new VectorEntry with a given value and timestamp. Used by HStore. + * + * @param value + * @param timestamp + */ + public DoubleEntry(byte[] value, long timestamp) { + this.values = new byte[1][]; + this.values[0] = value; + this.timestamps = new long[1]; + this.timestamps[0] = timestamp; + } + + // + // Writable + // + + /** {@inheritDoc} */ + public void readFields(final DataInput in) throws IOException { + int nvalues = in.readInt(); + this.timestamps = new long[nvalues]; + this.values = new byte[nvalues][]; + for (int i = 0; i < nvalues; i++) { + this.timestamps[i] = in.readLong(); + } + for (int i = 0; i < nvalues; i++) { + this.values[i] = Bytes.readByteArray(in); + } + } + + /** {@inheritDoc} */ + public void write(final DataOutput out) throws IOException { + out.writeInt(this.values.length); + for (int i = 0; i < this.timestamps.length; i++) { + out.writeLong(this.timestamps[i]); + } + for (int i = 0; i < this.values.length; i++) { + Bytes.writeByteArray(out, this.values[i]); + } + } + + // + // Iterable + // + + /** {@inheritDoc} */ + public Iterator iterator() { + return new VectorEntryIterator(); + } + + private class VectorEntryIterator implements Iterator { + private int currentValue = -1; + + VectorEntryIterator() { + } + + /** {@inheritDoc} */ + public boolean hasNext() { + return currentValue < values.length; + } + + /** {@inheritDoc} */ + public DoubleEntry next() { + currentValue += 1; + return new DoubleEntry(values[currentValue], timestamps[currentValue]); + } + + /** {@inheritDoc} */ + public void remove() throws UnsupportedOperationException { + throw new UnsupportedOperationException("remove is not supported"); + } + } +} Modified: incubator/hama/trunk/src/java/org/apache/hama/io/VectorMapWritable.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/io/VectorMapWritable.java?rev=713656&r1=713655&r2=713656&view=diff ============================================================================== --- incubator/hama/trunk/src/java/org/apache/hama/io/VectorMapWritable.java (original) +++ incubator/hama/trunk/src/java/org/apache/hama/io/VectorMapWritable.java Wed Nov 12 22:31:27 2008 @@ -53,7 +53,7 @@ addToMap(HStoreKey.class, code++); addToMap(ImmutableBytesWritable.class, code++); addToMap(Text.class, code++); - addToMap(VectorEntry.class, code++); + addToMap(DoubleEntry.class, code++); addToMap(byte[].class, code++); } Modified: incubator/hama/trunk/src/java/org/apache/hama/io/VectorUpdate.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/io/VectorUpdate.java?rev=713656&r1=713655&r2=713656&view=diff ============================================================================== --- incubator/hama/trunk/src/java/org/apache/hama/io/VectorUpdate.java (original) +++ incubator/hama/trunk/src/java/org/apache/hama/io/VectorUpdate.java Wed Nov 12 22:31:27 2008 @@ -71,8 +71,8 @@ } } - public void putAll(Set> entrySet) { - for (Map.Entry e : entrySet) { + public void putAll(Set> entrySet) { + for (Map.Entry e : entrySet) { put(e.getKey(), e.getValue().getValue()); } } Modified: incubator/hama/trunk/src/java/org/apache/hama/io/VectorWritable.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/io/VectorWritable.java?rev=713656&r1=713655&r2=713656&view=diff ============================================================================== --- incubator/hama/trunk/src/java/org/apache/hama/io/VectorWritable.java (original) +++ incubator/hama/trunk/src/java/org/apache/hama/io/VectorWritable.java Wed Nov 12 22:31:27 2008 @@ -35,16 +35,16 @@ import org.apache.hama.Vector; import org.apache.hama.util.Numeric; -public class VectorWritable implements Writable, Map { +public class VectorWritable implements Writable, Map { public Integer row; - public VectorMapWritable entries; + public VectorMapWritable entries; public VectorWritable() { - this(new VectorMapWritable()); + this(new VectorMapWritable()); } - public VectorWritable(VectorMapWritable entries) { + public VectorWritable(VectorMapWritable entries) { this.entries = entries; } @@ -65,15 +65,15 @@ return this.entries.size(); } - public VectorEntry put(Integer key, VectorEntry value) { + public DoubleEntry put(Integer key, DoubleEntry value) { throw new UnsupportedOperationException("VectorWritable is read-only!"); } - public VectorEntry get(Object key) { + public DoubleEntry get(Object key) { return this.entries.get(key); } - public VectorEntry remove(Object key) { + public DoubleEntry remove(Object key) { throw new UnsupportedOperationException("VectorWritable is read-only!"); } @@ -101,14 +101,14 @@ return result; } - public Set> entrySet() { + public Set> entrySet() { return Collections.unmodifiableSet(this.entries.entrySet()); } - public Collection values() { - ArrayList result = new ArrayList(); + public Collection values() { + ArrayList result = new ArrayList(); for (Writable w : entries.values()) { - result.add((VectorEntry) w); + result.add((DoubleEntry) w); } return result; } @@ -127,7 +127,7 @@ throw new UnsupportedOperationException("Not implemented yet"); } - public void putAll(Map m) { + public void putAll(Map m) { throw new UnsupportedOperationException("Not implemented yet"); } @@ -136,17 +136,17 @@ * The inner class for an entry of row. * */ - public static class Entries implements Map.Entry { + public static class Entries implements Map.Entry { private final byte[] column; - private final VectorEntry entry; + private final DoubleEntry entry; - Entries(byte[] column, VectorEntry entry) { + Entries(byte[] column, DoubleEntry entry) { this.column = column; this.entry = entry; } - public VectorEntry setValue(VectorEntry c) { + public DoubleEntry setValue(DoubleEntry c) { throw new UnsupportedOperationException("VectorWritable is read-only!"); } @@ -155,7 +155,7 @@ return key; } - public VectorEntry getValue() { + public DoubleEntry getValue() { return entry; } } Modified: incubator/hama/trunk/src/java/org/apache/hama/util/Numeric.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/util/Numeric.java?rev=713656&r1=713655&r2=713656&view=diff ============================================================================== --- incubator/hama/trunk/src/java/org/apache/hama/util/Numeric.java (original) +++ incubator/hama/trunk/src/java/org/apache/hama/util/Numeric.java Wed Nov 12 22:31:27 2008 @@ -19,10 +19,16 @@ */ package org.apache.hama.util; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.nio.ByteBuffer; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hama.Constants; +import org.apache.hama.SubMatrix; /** * Provides a number format conversion @@ -92,4 +98,25 @@ public static byte[] getColumnIndex(int integer) { return Bytes.toBytes(Constants.COLUMN + String.valueOf(integer)); } + + public static byte[] subMatrixToBytes(Object obj) throws IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(obj); + oos.flush(); + oos.close(); + bos.close(); + byte[] data = bos.toByteArray(); + return data; + } + + public static SubMatrix bytesToSubMatrix(byte[] value) throws IOException, + ClassNotFoundException { + ByteArrayInputStream bos = new ByteArrayInputStream(value); + ObjectInputStream oos = new ObjectInputStream(bos); + Object obj = oos.readObject(); + oos.close(); + bos.close(); + return (SubMatrix) obj; + } } Modified: incubator/hama/trunk/src/test/org/apache/hama/TestDenseMatrix.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/test/org/apache/hama/TestDenseMatrix.java?rev=713656&r1=713655&r2=713656&view=diff ============================================================================== --- incubator/hama/trunk/src/test/org/apache/hama/TestDenseMatrix.java (original) +++ incubator/hama/trunk/src/test/org/apache/hama/TestDenseMatrix.java Wed Nov 12 22:31:27 2008 @@ -28,7 +28,7 @@ import junit.framework.TestSuite; import org.apache.hadoop.hbase.client.HBaseAdmin; -import org.apache.hama.io.VectorEntry; +import org.apache.hama.io.DoubleEntry; import org.apache.log4j.Logger; /** @@ -83,7 +83,7 @@ */ public void testGetColumn() throws IOException { Vector v = m1.getColumn(0); - Iterator it = v.iterator(); + Iterator it = v.iterator(); int x = 0; while (it.hasNext()) { assertEquals(m1.get(x, 0), it.next().getValue()); @@ -169,7 +169,7 @@ } m1.setRow(SIZE + 1, v); - Iterator it = m1.getRow(SIZE + 1).iterator(); + Iterator it = m1.getRow(SIZE + 1).iterator(); // We should remove the timestamp and row attribute from the vector int i = 0; Modified: incubator/hama/trunk/src/test/org/apache/hama/TestDenseVector.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/test/org/apache/hama/TestDenseVector.java?rev=713656&r1=713655&r2=713656&view=diff ============================================================================== --- incubator/hama/trunk/src/test/org/apache/hama/TestDenseVector.java (original) +++ incubator/hama/trunk/src/test/org/apache/hama/TestDenseVector.java Wed Nov 12 22:31:27 2008 @@ -28,7 +28,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.hama.io.VectorEntry; +import org.apache.hama.io.DoubleEntry; public class TestDenseVector extends TestCase { final static Log LOG = LogFactory.getLog(TestDenseVector.class.getName()); @@ -75,7 +75,7 @@ public void testSubVector() { int start = 2; Vector subVector = v1.subVector(start, v1.size() - 1); - Iterator it = subVector.iterator(); + Iterator it = subVector.iterator(); int i = start; while (it.hasNext()) { @@ -124,18 +124,18 @@ public void testAdd() { v1.add(v2); int i = 0; - Iterator it = v1.iterator(); + Iterator it = v1.iterator(); while (it.hasNext()) { - VectorEntry c = it.next(); + DoubleEntry c = it.next(); assertEquals(c.getValue(), values[0][i] + values[1][i]); i++; } v1.add(0.5, v2); int j = 0; - Iterator itt = v1.iterator(); + Iterator itt = v1.iterator(); while (itt.hasNext()) { - VectorEntry c = itt.next(); + DoubleEntry c = itt.next(); assertEquals(c.getValue(), (values[0][j] + values[1][j]) + (0.5 * values[1][j])); j++; }