hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1647082 - in /hama/trunk: CHANGES.txt commons/src/main/java/org/apache/hama/commons/io/FloatArrayWritable.java commons/src/main/java/org/apache/hama/commons/io/TextArrayWritable.java
Date Sun, 21 Dec 2014 04:00:50 GMT
Author: edwardyoon
Date: Sun Dec 21 04:00:49 2014
New Revision: 1647082

URL: http://svn.apache.org/r1647082
Log:
HAMA-923: add a toString() method for FloatArrayWritable and TextArrayWritable classes (edwardyoon)

Modified:
    hama/trunk/CHANGES.txt
    hama/trunk/commons/src/main/java/org/apache/hama/commons/io/FloatArrayWritable.java
    hama/trunk/commons/src/main/java/org/apache/hama/commons/io/TextArrayWritable.java

Modified: hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hama/trunk/CHANGES.txt?rev=1647082&r1=1647081&r2=1647082&view=diff
==============================================================================
--- hama/trunk/CHANGES.txt (original)
+++ hama/trunk/CHANGES.txt Sun Dec 21 04:00:49 2014
@@ -18,6 +18,8 @@ Release 0.7.0 (unreleased changes)
    HAMA-885: Semi-Clustering is not producing expected output (Renil J via edwardyoon)
 
   IMPROVEMENTS
+
+   HAMA-923: add a toString() method for FloatArrayWritable and TextArrayWritable classes
(edwardyoon)
    HAMA-921: Polish doSuperstep() function and VertexMessageIterable class (Anastasis Andronidis)
    HAMA-913: Add RPC implementation using netty(bsmin)  
    HAMA-914: Boolean flag (isCompressed) is required only when runtime compression is enabled
(edwardyoon)

Modified: hama/trunk/commons/src/main/java/org/apache/hama/commons/io/FloatArrayWritable.java
URL: http://svn.apache.org/viewvc/hama/trunk/commons/src/main/java/org/apache/hama/commons/io/FloatArrayWritable.java?rev=1647082&r1=1647081&r2=1647082&view=diff
==============================================================================
--- hama/trunk/commons/src/main/java/org/apache/hama/commons/io/FloatArrayWritable.java (original)
+++ hama/trunk/commons/src/main/java/org/apache/hama/commons/io/FloatArrayWritable.java Sun
Dec 21 04:00:49 2014
@@ -17,21 +17,22 @@
  */
 package org.apache.hama.commons.io;
 
-import java.io.DataOutput;
-import java.io.IOException;
-
 import org.apache.hadoop.io.ArrayWritable;
 import org.apache.hadoop.io.FloatWritable;
+import org.apache.hadoop.io.Writable;
 
 public class FloatArrayWritable extends ArrayWritable {
   public FloatArrayWritable() {
     super(FloatWritable.class);
   }
 
-  public void write(DataOutput out) throws IOException {
-    out.writeInt(this.get().length); // write values
-    for (int i = 0; i < this.get().length; i++) {
-      this.get()[i].write(out);
+  public String toString() {
+    Writable[] array = this.get();
+    StringBuilder s = new StringBuilder();
+    for (int i = 0; i < array.length; i++) {
+      s.append(array[i] + " ");
     }
+    
+    return s.toString();
   }
 }

Modified: hama/trunk/commons/src/main/java/org/apache/hama/commons/io/TextArrayWritable.java
URL: http://svn.apache.org/viewvc/hama/trunk/commons/src/main/java/org/apache/hama/commons/io/TextArrayWritable.java?rev=1647082&r1=1647081&r2=1647082&view=diff
==============================================================================
--- hama/trunk/commons/src/main/java/org/apache/hama/commons/io/TextArrayWritable.java (original)
+++ hama/trunk/commons/src/main/java/org/apache/hama/commons/io/TextArrayWritable.java Sun
Dec 21 04:00:49 2014
@@ -19,6 +19,7 @@ package org.apache.hama.commons.io;
 
 import org.apache.hadoop.io.ArrayWritable;
 import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
 
 public class TextArrayWritable extends ArrayWritable {
 
@@ -26,4 +27,13 @@ public class TextArrayWritable extends A
     super(Text.class);
   }
 
+  public String toString() {
+    Writable[] array = this.get();
+    StringBuilder s = new StringBuilder();
+    for (int i = 0; i < array.length; i++) {
+      s.append(array[i] + " ");
+    }
+    
+    return s.toString();
+  }
 }



Mime
View raw message