You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by to...@apache.org on 2013/02/18 12:17:31 UTC

svn commit: r1447200 - in /hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph: GraphJobRunner.java ListVerticesInfo.java OffHeapVerticesInfo.java VerticesInfo.java

Author: tommaso
Date: Mon Feb 18 11:17:30 2013
New Revision: 1447200

URL: http://svn.apache.org/r1447200
Log:
HAMA-732 - abstracted VerticesInfo as an interface

Added:
    hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/VerticesInfo.java   (with props)
Modified:
    hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java
    hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/ListVerticesInfo.java
    hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/OffHeapVerticesInfo.java

Modified: hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java
URL: http://svn.apache.org/viewvc/hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java?rev=1447200&r1=1447199&r2=1447200&view=diff
==============================================================================
--- hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java (original)
+++ hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java Mon Feb 18 11:17:30 2013
@@ -71,7 +71,7 @@ public final class GraphJobRunner<V exte
   private Combiner<M> combiner;
   private Partitioner<V, M> partitioner;
 
-  private OffHeapVerticesInfo<V, E, M> vertices;
+  private VerticesInfo<V, E, M> vertices;
   private boolean updated = true;
   private int globalUpdateCounts = 0;
 

Modified: hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/ListVerticesInfo.java
URL: http://svn.apache.org/viewvc/hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/ListVerticesInfo.java?rev=1447200&r1=1447199&r2=1447200&view=diff
==============================================================================
--- hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/ListVerticesInfo.java (original)
+++ hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/ListVerticesInfo.java Mon Feb 18 11:17:30 2013
@@ -26,14 +26,13 @@ import java.util.List;
 import org.apache.hadoop.io.Writable;
 
 /**
- * VerticesInfo encapsulates the storage of vertices in a BSP Task.
- * 
- * @param <V> Vertex ID object type
- * @param <E> Edge cost object type
- * @param <M> Vertex value object type
+ * {@link List} based {@link VerticesInfo} implementation
+ * @param <V>
+ * @param <E>
+ * @param <M>
  */
-public class ListVerticesInfo<V extends Writable, E extends Writable, M extends Writable>
-    implements Iterable<Vertex<V, E, M>> {
+public class ListVerticesInfo<V extends Writable, E extends Writable,
+        M extends Writable> implements VerticesInfo<V, E, M>{
 
   private final List<Vertex<V, E, M>> vertices = new ArrayList<Vertex<V, E, M>>(100);
 

Modified: hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/OffHeapVerticesInfo.java
URL: http://svn.apache.org/viewvc/hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/OffHeapVerticesInfo.java?rev=1447200&r1=1447199&r2=1447200&view=diff
==============================================================================
--- hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/OffHeapVerticesInfo.java (original)
+++ hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/OffHeapVerticesInfo.java Mon Feb 18 11:17:30 2013
@@ -28,7 +28,7 @@ import org.apache.hadoop.io.Writable;
  * An off heap version of a {@link Vertex} storage.
  */
 public class OffHeapVerticesInfo<V extends Writable, E extends Writable, M extends Writable>
-        implements Iterable<Vertex<V, E, M>> {
+        implements VerticesInfo<V, E, M> {
 
     private final CacheService<V, Vertex<V, E, M>> vertices;
 

Added: hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/VerticesInfo.java
URL: http://svn.apache.org/viewvc/hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/VerticesInfo.java?rev=1447200&view=auto
==============================================================================
--- hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/VerticesInfo.java (added)
+++ hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/VerticesInfo.java Mon Feb 18 11:17:30 2013
@@ -0,0 +1,44 @@
+/**
+ * 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.graph;
+
+import org.apache.hadoop.io.Writable;
+
+/**
+ * VerticesInfo encapsulates the storage of vertices in a BSP Task.
+ *
+ * @param <V> Vertex ID object type
+ * @param <E> Edge cost object type
+ * @param <M> Vertex value object type
+ */
+
+public interface VerticesInfo<V extends Writable, E extends Writable, M extends Writable>
+        extends Iterable<Vertex<V, E, M>> {
+
+    /**
+     * add a vertex to this storage
+     * @param vertex
+     */
+    public void addVertex(Vertex<V, E, M> vertex);
+
+    /**
+     * gives the no. of vertices contained in this storage
+     * @return
+     */
+    public int size();
+}

Propchange: hama/branches/hama-732/graph/src/main/java/org/apache/hama/graph/VerticesInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native