hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r751997 - /incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java
Date Tue, 10 Mar 2009 06:33:21 GMT
Author: edwardyoon
Date: Tue Mar 10 06:33:20 2009
New Revision: 751997

URL: http://svn.apache.org/viewvc?rev=751997&view=rev
Log:
Add comment for vector.size().

Modified:
    incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.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=751997&r1=751996&r2=751997&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java Tue Mar 10 06:33:20
2009
@@ -30,7 +30,7 @@
  */
 public abstract class AbstractVector {
   protected MapWritable entries;
-  
+
   /**
    * Returns an Iterator.
    * 
@@ -39,20 +39,21 @@
   public Iterator<Writable> iterator() {
     return this.entries.values().iterator();
   }
-  
+
   /**
-   * Returns a size of vector
+   * Returns a size of vector. If vector is sparse, returns the number of only
+   * non-zero elements.
    * 
    * @return a size of vector
    */
   public int size() {
     int x = 0;
-    if(this.entries != null && this.entries.containsKey(new Text("row"))) 
+    if (this.entries != null && this.entries.containsKey(new Text("row")))
       x = 1;
-    
+
     return (this.entries != null) ? this.entries.size() - x : 0;
   }
-  
+
   /**
    * Returns the {@link org.apache.hadoop.io.MapWritable}
    * 
@@ -61,7 +62,7 @@
   public MapWritable getEntries() {
     return this.entries;
   }
-  
+
   /**
    * Clears the entries.
    */



Mime
View raw message