Author: edwardyoon
Date: Mon Aug 11 05:36:01 2008
New Revision: 684737
URL: http://svn.apache.org/viewvc?rev=684737&view=rev
Log:
Add comments of AbstractBase.
Modified:
incubator/hama/trunk/src/java/org/apache/hama/AbstractBase.java
incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
incubator/hama/trunk/src/java/org/apache/hama/mapred/MatrixInputFormatBase.java
Modified: incubator/hama/trunk/src/java/org/apache/hama/AbstractBase.java
URL:
http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/AbstractBase.java?rev=684737&r1=684736&r2=684737&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/AbstractBase.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/AbstractBase.java Mon Aug 11
05:36:01 2008
@@ -2,32 +2,70 @@
import org.apache.hadoop.hbase.util.Bytes;
+/**
+ * Provides a number format conversion
+ */
public abstract class AbstractBase {
- public int bytesToInt(byte[] b) {
- return Integer.parseInt(Bytes.toString(b));
+ /**
+ * Bytes to integer conversion
+ *
+ * @param b
+ * @return the converted value
+ */
+ public int bytesToInt(byte[] bytes) {
+ return Integer.parseInt(Bytes.toString(bytes));
}
-
- public byte[] intToBytes(int d) {
- return Bytes.toBytes(String.valueOf(d));
+
+ /**
+ * Integer to bytes conversion
+ *
+ * @param integer
+ * @return the converted value
+ */
+ public byte[] intToBytes(int integer) {
+ return Bytes.toBytes(String.valueOf(integer));
}
-
- public double bytesToDouble(byte[] b) {
- return Double.parseDouble(Bytes.toString(b));
+
+ /**
+ * Bytes to double conversion
+ *
+ * @param bytes
+ * @return the converted value
+ */
+ public double bytesToDouble(byte[] bytes) {
+ return Double.parseDouble(Bytes.toString(bytes));
}
- public byte[] doubleToBytes(Double d) {
- return Bytes.toBytes(d.toString());
+ /**
+ * Double to bytes conversion
+ *
+ * @param doubleValue
+ * @return the converted value
+ */
+ public byte[] doubleToBytes(Double doubleValue) {
+ return Bytes.toBytes(doubleValue.toString());
}
- public int getColumnIndex(byte[] b) {
- String cKey = new String(b);
+ /**
+ * Gets the column index
+ *
+ * @param bytes
+ * @return the converted value
+ */
+ public int getColumnIndex(byte[] bytes) {
+ String cKey = new String(bytes);
return Integer.parseInt(cKey
.substring(cKey.indexOf(":") + 1, cKey.length()));
}
-
+
+ /**
+ * Gets the column index
+ *
+ * @param b
+ * @return the converted value
+ */
public byte[] getColumnIndex(int b) {
return Bytes.toBytes(Constants.COLUMN + String.valueOf(b));
}
-
}
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=684737&r1=684736&r2=684737&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java Mon Aug
11 05:36:01 2008
@@ -69,7 +69,7 @@
*/
protected void create() {
try {
- tableDesc.addFamily(new
HColumnDescriptor(Constants.METADATA.toString()));
+ tableDesc.addFamily(new HColumnDescriptor(Constants.METADATA));
LOG.info("Initializing the matrix storage.");
admin.createTable(tableDesc);
} catch (IOException e) {
Modified:
incubator/hama/trunk/src/java/org/apache/hama/mapred/MatrixInputFormatBase.java
URL:
http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/mapred/MatrixInputFormatBase.java?rev=684737&r1=684736&r2=684737&view=diff
==============================================================================
---
incubator/hama/trunk/src/java/org/apache/hama/mapred/MatrixInputFormatBase.java
(original)
+++
incubator/hama/trunk/src/java/org/apache/hama/mapred/MatrixInputFormatBase.java
Mon Aug 11 05:36:01 2008
@@ -22,10 +22,11 @@
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.RecordReader;
import org.apache.hadoop.mapred.Reporter;
+import org.apache.hama.AbstractBase;
import org.apache.hama.Vector;
import org.apache.hama.io.VectorWritable;
-public abstract class MatrixInputFormatBase
+public abstract class MatrixInputFormatBase extends AbstractBase
implements InputFormat<ImmutableBytesWritable, Vector> {
private final Log LOG = LogFactory.getLog(MatrixInputFormatBase.class);
private byte [][] inputColumns;