bug fix on S2Vertex.vertices.

Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/38682a81
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/38682a81
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/38682a81

Branch: refs/heads/master
Commit: 38682a8123d18b2259c0280f694b82e9ac0af9bc
Parents: e77862b
Author: DO YUNG YOON <[email protected]>
Authored: Fri May 5 12:20:32 2017 +0900
Committer: DO YUNG YOON <[email protected]>
Committed: Fri May 5 12:20:32 2017 +0900

----------------------------------------------------------------------
 .../scala/org/apache/s2graph/core/S2Graph.scala | 14 ++++++-------
 .../org/apache/s2graph/core/S2Vertex.scala      | 21 ++++++++++++++------
 2 files changed, 21 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/38682a81/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala 
b/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
index 95186e8..fc67be5 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
@@ -616,9 +616,9 @@ object S2Graph {
 //  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.ConstantTest$Traversals",
 method = "*", reason = "no"),
 //  passed: all
 
-  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest$Traversals", 
method = "g_V_both_both_count", reason = "somehow count becomes double. fix 
this.  "),
-  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest$Traversals", 
method = "g_V_repeatXoutX_timesX3X_count", reason = "count differ very little. 
fix this."),
-  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest$Traversals", 
method = "g_V_repeatXoutX_timesX8X_count", reason = "count differ very litter. 
fix this."),
+//  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest$Traversals", 
method = "g_V_both_both_count", reason = "somehow count becomes double. fix 
this.  "),
+//  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest$Traversals", 
method = "g_V_repeatXoutX_timesX3X_count", reason = "count differ very little. 
fix this."),
+//  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest$Traversals", 
method = "g_V_repeatXoutX_timesX8X_count", reason = "count differ very litter. 
fix this."),
 //  passed: all, failed: g_V_both_both_count, g_V_repeatXoutX_timesX3X_count, 
g_V_repeatXoutX_timesX8X_count
 
 //  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapTest$Traversals",
 method = "*", reason = "no"),
@@ -683,11 +683,9 @@ object S2Graph {
 //  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.SelectTest$Traversals",
 method = "*", reason = "no"),
 //  passed: all
 
-  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest$Traversals",
 method = "g_VX4X_bothE_otherV", reason = "fix this."),
-  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest$Traversals",
 method = "g_V_out_outE_inV_inE_inV_both_name", reason = "fix this."),
-  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest$Traversals",
 method = "g_VX4X_both", reason = "fix this."),
-//  failed: g_VX4X_bothE_otherV, g_VX1_2_3_4X_name, 
g_V_out_outE_inV_inE_inV_both_name, g_VX4X_bothEXcreatedX, g_VX4X_both
-
+//  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest$Traversals",
 method = "*", reason = "no"),
+//  passed: all
+  
 //  new Graph.OptOut(test = 
"org.apache.tinkerpop.gremlin.process.traversal.step.map.UnfoldTest$Traversals",
 method = "*", reason = "no"),
 //  passed: all
 

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/38682a81/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala 
b/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
index bb60522..269cf84 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
@@ -125,13 +125,22 @@ case class S2Vertex(graph: S2Graph,
     val arr = new util.ArrayList[Vertex]()
     edges(direction, edgeLabels: _*).forEachRemaining(new Consumer[Edge] {
       override def accept(edge: Edge): Unit = {
-        direction match {
-          case Direction.OUT => arr.add(edge.inVertex())
-          case Direction.IN => arr.add(edge.outVertex())
-          case _ =>
-            arr.add(edge.inVertex())
-            arr.add(edge.outVertex())
+        val s2Edge = edge.asInstanceOf[S2Edge]
+
+        s2Edge.direction match {
+          case "out" => arr.add(edge.inVertex())
+          case "in" => arr.add(edge.outVertex())
+          case _ => throw new IllegalStateException("only out/in direction can 
be found in S2Edge")
         }
+//        direction match {
+//          case Direction.OUT => arr.add(edge.inVertex())
+//          case Direction.IN => arr.add(edge.outVertex())
+//          case _ =>
+//            val inV = edge.inVertex()
+//            val outV = edge.outVertex()
+//            if (id != inV.id()) arr.add(inV)
+//            if (id != outV.id()) arr.add(outV)
+//        }
       }
     })
     arr.iterator()

Reply via email to