You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by ed...@apache.org on 2008/09/10 11:41:22 UTC
svn commit: r693758 -
/incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
Author: edwardyoon
Date: Wed Sep 10 02:41:21 2008
New Revision: 693758
URL: http://svn.apache.org/viewvc?rev=693758&view=rev
Log:
Remove bytes method.
Modified:
incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
Modified: incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java?rev=693758&r1=693757&r2=693758&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java Wed Sep 10 02:41:21 2008
@@ -28,8 +28,6 @@
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.io.BatchUpdate;
import org.apache.hadoop.hbase.io.Cell;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.io.Text;
import org.apache.hama.util.Numeric;
import org.apache.log4j.Logger;
@@ -80,8 +78,7 @@
/** {@inheritDoc} */
public double get(int i, int j) throws IOException {
double result = -1;
- Cell c = table.get(Bytes.toBytes(String.valueOf(i)), Numeric
- .getColumnIndex(j));
+ Cell c = table.get(Numeric.intToBytes(i), Numeric.getColumnIndex(j));
if (c != null) {
result = Numeric.bytesToDouble(c.getValue());
}
@@ -103,9 +100,8 @@
/** {@inheritDoc} */
public void set(int i, int j, double value) throws IOException {
- BatchUpdate b = new BatchUpdate(new Text(String.valueOf(i)));
- b.put(new Text(Constants.COLUMN + String.valueOf(j)), Numeric
- .doubleToBytes(value));
+ BatchUpdate b = new BatchUpdate(Numeric.intToBytes(i));
+ b.put(Numeric.getColumnIndex(j), Numeric.doubleToBytes(value));
table.commit(b);
}