Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mpollmeier committed Feb 5, 2024
1 parent fc8d88d commit 30e3eea
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
12 changes: 7 additions & 5 deletions core/src/main/scala/flatgraph/DiffGraphApplier.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ private[flatgraph] class DiffGraphApplier(graph: Graph, diff: DiffGraphBuilder)
already
case None =>
val nodeKind = detached.nodeKind
assert (nodeKind < graph.schema.getNumberOfNodeKinds,
s"given nodeKind=$nodeKind does not fit into the graph schema, which only supports node kinds [0..${graph.schema.getNumberOfNodeKinds - 1}] (inclusive range)")
assert(
nodeKind < graph.schema.getNumberOfNodeKinds,
s"given nodeKind=$nodeKind does not fit into the graph schema, which only supports node kinds [0..${graph.schema.getNumberOfNodeKinds - 1}] (inclusive range)"
)

val seqId = graph.nodeCountByKind(nodeKind) + Option(newNodes(nodeKind)).map { _.size }.getOrElse(0)
val res = graph.schema.makeNode(graph, nodeKind, seqId)
val seqId = graph.nodeCountByKind(nodeKind) + Option(newNodes(nodeKind)).map { _.size }.getOrElse(0)
val res = graph.schema.makeNode(graph, nodeKind, seqId)
detached.storedRef = Some(res)
insert(newNodes, detached, nodeKind)
deferred.append(detached)
Expand Down Expand Up @@ -179,7 +181,7 @@ private[flatgraph] class DiffGraphApplier(graph: Graph, diff: DiffGraphBuilder)

private def applyUpdate(): Unit = {
splitUpdate()

// set edge properties
for {
nodeKind <- Range(0, graph.schema.getNumberOfNodeKinds)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/flatgraph/Graph.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Graph(val schema: Schema, val storagePathMaybe: Option[Path] = None) exten
private[flatgraph] val livingNodeCountByKind: Array[Int] = new Array[Int](nodeKindCount)

/** Note: this included `deleted` nodes! You might want to use `livingNodeCountByKind` instead. */
private[flatgraph] def nodeCountByKind(kind: Int): Int = nodesArray(kind).length
private[flatgraph] def nodeCountByKind(kind: Int): Int = nodesArray(kind).length

private[flatgraph] val properties = new Array[AnyRef](nodeKindCount * propertiesCount * PropertySlotSize)
private[flatgraph] val inverseIndices = new AtomicReferenceArray[Object](nodeKindCount * propertiesCount * PropertySlotSize)
Expand Down
1 change: 0 additions & 1 deletion core/src/test/scala/flatgraph/GraphTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -831,4 +831,3 @@ class GraphTests extends AnyWordSpec with Matchers {
g.nodesWithProperty("undefined", "foo").l shouldBe Nil
}
}

12 changes: 6 additions & 6 deletions core/src/test/scala/flatgraph/TestHelpers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ object TestHelpers {

object TestSchema {
def make(
nodeKinds: Int,
edgeKinds: Int,
properties: Int = 0,
edgePropertyPrototypes: Array[AnyRef] = null,
nodePropertyPrototypes: Array[AnyRef] = null
): Schema = {
nodeKinds: Int,
edgeKinds: Int,
properties: Int = 0,
edgePropertyPrototypes: Array[AnyRef] = null,
nodePropertyPrototypes: Array[AnyRef] = null
): Schema = {
new FreeSchema(
nodeLabels = Range(0, nodeKinds).map { id => s"V${id}" }.toArray,
edgeLabels = Range(0, edgeKinds).map { id => s"${id}" }.toArray,
Expand Down

0 comments on commit 30e3eea

Please sign in to comment.