From 9549e15abf4e4b0589254279eda4cef3c10ee322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Szak=C3=A1llas?= Date: Sat, 10 Jun 2017 19:41:03 +0200 Subject: [PATCH] introduce IngraphElement add IngraphElement superclass for IngraphVertex and IngraphEdge --- .../src/main/scala/ingraph/ire/Indexer.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ingraph-engine/ingraph-engine-ingraph-ire/src/main/scala/ingraph/ire/Indexer.scala b/ingraph-engine/ingraph-engine-ingraph-ire/src/main/scala/ingraph/ire/Indexer.scala index 6196b2016..a33538479 100644 --- a/ingraph-engine/ingraph-engine-ingraph-ire/src/main/scala/ingraph/ire/Indexer.scala +++ b/ingraph-engine/ingraph-engine-ingraph-ire/src/main/scala/ingraph/ire/Indexer.scala @@ -1,17 +1,19 @@ package ingraph.ire import hu.bme.mit.ire.util.BufferMultimap -import org.neo4j.driver.v1.Value import org.neo4j.driver.v1.types.{Node, Relationship} import scala.collection.JavaConversions._ import scala.collection.mutable import scala.util.Random +trait IngraphElement { + def properties: Map[String, AnyRef] +} case class IngraphVertex(id: Long, labels: Set[String], - properties: Map[String, AnyRef] = Map()) { + override val properties: Map[String, AnyRef] = Map()) extends IngraphElement { val edges: mutable.ListMap[String, IngraphEdge] = mutable.ListMap[String, IngraphEdge]() val reverseEdges: mutable.ListMap[String, IngraphEdge] = mutable.ListMap[String, IngraphEdge]() override def toString: String = s"Vertex($id, $properties)" @@ -21,7 +23,7 @@ case class IngraphEdge(id: Long, sourceVertex: IngraphVertex, targetVertex: IngraphVertex, label: String, - properties: Map[String, AnyRef] = Map()) { + override val properties: Map[String, AnyRef] = Map()) extends IngraphElement { override def toString: String = s"Edge(${sourceVertex.id} -[$label]-> ${targetVertex.id}, $properties)" def inverse(): IngraphEdge = IngraphEdge(id, targetVertex, sourceVertex, label, properties) }