From c422f5223e06ade04c244a5262b923f91572055c Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 24 Jun 2025 16:23:06 +0000 Subject: [PATCH 1/3] Update scalafmt-core to 3.9.7 --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 8511b0ae..fee0de70 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version=3.8.6 +version=3.9.7 runner.dialect = scala213 align.preset = more From 73c61688a9cc71602d449b7408922144bae7679f Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 24 Jun 2025 16:23:35 +0000 Subject: [PATCH 2/3] Reformat with scalafmt 3.9.7 Executed command: scalafmt --non-interactive --- .../collection/constrained/Constraint.scala | 2 +- .../collection/constrained/ConstraintOp.scala | 2 +- .../constrained/constraints/Acyclic.scala | 2 +- .../mutable/AdjacencyListGraph.scala | 8 ++++---- .../constrained/mutable/GraphLike.scala | 6 +++--- .../main/scala/scala/collection/Facades.scala | 2 +- .../scala/scalax/collection/AnyGraph.scala | 6 +++--- .../scala/scalax/collection/GraphBase.scala | 4 ++-- .../scalax/collection/GraphTraversal.scala | 4 ++-- .../scalax/collection/GraphTraversalImpl.scala | 4 ++-- .../main/scala/scalax/collection/State.scala | 10 +++++----- .../scala/scalax/collection/ToString.scala | 2 +- .../scalax/collection/TraverserImpl.scala | 18 +++++++++--------- .../collection/generator/RandomGraph.scala | 14 +++++++------- .../generator/parameters/Parameters.scala | 4 ++-- .../scalax/collection/generic/edgeBase.scala | 4 ++-- .../collection/generic/edgeEquality.scala | 2 +- .../collection/generic/edgeMappers.scala | 2 +- .../immutable/AdjacencyListBase.scala | 12 ++++++------ .../immutable/AdjacencyListGraph.scala | 2 +- .../mutable/AdjacencyListGraph.scala | 2 +- .../scalax/collection/mutable/EqHashMap.scala | 2 +- .../scalax/collection/mutable/EqHashSet.scala | 2 +- .../collection/mutable/SimpleArraySet.scala | 2 +- .../scalax/collection/EditingTypedSpec.scala | 2 +- .../scalax/collection/EditingTypedSpec.scala | 2 +- core/src/test/scala/demo/GraphTestDemo.scala | 4 ++-- .../test/scala/demo/TraversingDemoSpec.scala | 6 +++--- .../collection/mutable/ExtHashSetSpec.scala | 2 +- .../scalax/collection/ConnectivitySpec.scala | 6 +++--- .../test/scala/scalax/collection/Data.scala | 2 +- .../scalax/collection/EditingHyperSpec.scala | 2 +- .../scala/scalax/collection/MappingSpec.scala | 2 +- .../scalax/collection/SerializableSpec.scala | 8 ++++---- .../scala/scalax/collection/SetOpsSpec.scala | 2 +- .../scala/scalax/collection/StateSpec.scala | 4 ++-- .../scalax/collection/TraversalSpec.scala | 2 +- .../collection/generator/GraphGenSpec.scala | 4 ++-- .../collection/mutable/ArraySetSpec.scala | 8 ++++---- .../scala/scalax/time/MicroBenchmarkTest.scala | 4 ++-- .../scalax/collection/io/dot/AstTypes.scala | 10 +++++----- .../scalax/collection/io/dot/Export.scala | 2 +- .../scalax/collection/io/dot/ExportSpec.scala | 12 ++++++------ .../io/json/descriptor/NodeDescriptor.scala | 4 ++-- .../scalax/collection/io/json/exp/Export.scala | 2 +- .../scalax/collection/io/json/imp/Stream.scala | 2 +- .../scalax/collection/io/json/JsonSpec.scala | 2 +- .../collection/io/json/TypedEdgeSpec.scala | 6 +++--- .../json/serializer/GraphSerializerSpec.scala | 2 +- .../collection/rdf/TTripleDiEdgeTest.scala | 2 +- .../rdf/TTripleDiHyperEdgeTest.scala | 2 +- 51 files changed, 112 insertions(+), 112 deletions(-) diff --git a/constrained/src/main/scala/scalax/collection/constrained/Constraint.scala b/constrained/src/main/scala/scalax/collection/constrained/Constraint.scala index 23241dd0..e72eff8f 100644 --- a/constrained/src/main/scala/scalax/collection/constrained/Constraint.scala +++ b/constrained/src/main/scala/scalax/collection/constrained/Constraint.scala @@ -94,7 +94,7 @@ trait PreCheckResultCompanion { } object PreCheckResult extends PreCheckResultCompanion { - def apply(followUp: PreCheckFollowUp) = new PreCheckResult(followUp) + def apply(followUp: PreCheckFollowUp) = new PreCheckResult(followUp) def unapply(preCheck: PreCheckResult): Option[(PreCheckResult, PreCheckFollowUp)] = if (preCheck eq null) None else Some(preCheck, preCheck.followUp) } diff --git a/constrained/src/main/scala/scalax/collection/constrained/ConstraintOp.scala b/constrained/src/main/scala/scalax/collection/constrained/ConstraintOp.scala index 5f1efed3..97312730 100644 --- a/constrained/src/main/scala/scalax/collection/constrained/ConstraintOp.scala +++ b/constrained/src/main/scala/scalax/collection/constrained/ConstraintOp.scala @@ -52,7 +52,7 @@ class ConstraintBinaryOp[N, E <: Edge[N], G <: Graph[N, E]]( var rightDone = false val leftFollowUp = leftResult.followUp lazy val rightFollowUp = { rightDone = true; rightResult.followUp } - val followUp = + val followUp = operator match { case And if leftFollowUp != Abort => min(leftFollowUp, rightFollowUp) case And => Abort diff --git a/constrained/src/main/scala/scalax/collection/constrained/constraints/Acyclic.scala b/constrained/src/main/scala/scalax/collection/constrained/constraints/Acyclic.scala index 56ac4ce5..0b8159e2 100644 --- a/constrained/src/main/scala/scalax/collection/constrained/constraints/Acyclic.scala +++ b/constrained/src/main/scala/scalax/collection/constrained/constraints/Acyclic.scala @@ -67,7 +67,7 @@ class Acyclic[N, E <: EdgeLikeIn[N], G <: Graph[N, E]](override val self: G) ext */ override def preAdd(elems: InParam[N, E]*): PreCheckResult = if (elems.size * 10 < self.elementCount) { - val p = Param.Partitions(elems) + val p = Param.Partitions(elems) val graphAdd = SimpleGraph.from(p.toOuterNodes, p.toOuterEdges)( self.CoreConfig(self.config.orderHint, self.config.adjacencyListHints) diff --git a/constrained/src/main/scala/scalax/collection/constrained/mutable/AdjacencyListGraph.scala b/constrained/src/main/scala/scalax/collection/constrained/mutable/AdjacencyListGraph.scala index 180cf03e..17180da2 100644 --- a/constrained/src/main/scala/scalax/collection/constrained/mutable/AdjacencyListGraph.scala +++ b/constrained/src/main/scala/scalax/collection/constrained/mutable/AdjacencyListGraph.scala @@ -43,7 +43,7 @@ trait AdjacencyListGraph[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: AdjacencyListG else { val preCheckResult = preAdd(node) preCheckResult.followUp match { - case Complete => Right(doAdd) + case Complete => Right(doAdd) case PostCheck => doAdd postAdd(AdjacencyListGraph.this, Set(node.value), Set.empty, preCheckResult).fold( @@ -71,7 +71,7 @@ trait AdjacencyListGraph[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: AdjacencyListG else { val preCheckResult = preAdd(edge.outer) preCheckResult.followUp match { - case Complete => Right(added) + case Complete => Right(added) case PostCheck => if (added) postAdd(selfGraph, Set.empty[N], Set(edge.outer), preCheckResult).fold( @@ -97,7 +97,7 @@ trait AdjacencyListGraph[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: AdjacencyListG else { val preCheckResult = preSubtract(edge.asInstanceOf[self.EdgeT], !forced) preCheckResult.followUp match { - case Complete => Right(remove(edge)) + case Complete => Right(remove(edge)) case PostCheck => if (remove(edge)) postSubtract(selfGraph, Set.empty[N], Set(edge.outer), preCheckResult).fold( @@ -112,7 +112,7 @@ trait AdjacencyListGraph[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: AdjacencyListG override def remove(edge: EdgeT): Boolean = remove_?(edge) getOrElse false def remove_?(edge: EdgeT): Either[ConstraintViolation, Boolean] = checkedRemove(edge, forced = false, super.remove) - override def removeWithNodes(edge: EdgeT): Boolean = removeWithNodes_?(edge) getOrElse false + override def removeWithNodes(edge: EdgeT): Boolean = removeWithNodes_?(edge) getOrElse false def removeWithNodes_?(edge: EdgeT): Either[ConstraintViolation, Boolean] = checkedRemove(edge, forced = true, (e: EdgeT) => withoutChecks(super.removeWithNodes(e))) } diff --git a/constrained/src/main/scala/scalax/collection/constrained/mutable/GraphLike.scala b/constrained/src/main/scala/scalax/collection/constrained/mutable/GraphLike.scala index a04df7af..4a4bd189 100644 --- a/constrained/src/main/scala/scalax/collection/constrained/mutable/GraphLike.scala +++ b/constrained/src/main/scala/scalax/collection/constrained/mutable/GraphLike.scala @@ -29,7 +29,7 @@ trait GraphLike[N, E <: Edge[N], +CC[X, Y[+X] <: EdgeLikeIn[X]] <: GraphLike[X, else { val preCheckResult = preSubtract(node.asInstanceOf[self.NodeT], ripple) preCheckResult.followUp match { - case Complete => Right(remove) + case Complete => Right(remove) case PostCheck => val incidentEdges = node.edges.toIterable if (remove) @@ -133,10 +133,10 @@ trait GraphLike[N, E <: Edge[N], +CC[X, Y[+X] <: EdgeLikeIn[X]] <: GraphLike[X, (p.toOuterNodes.toSet, p.toOuterEdges.toSet) } val (innerNodes, innerEdges) = (outerNodes map find flatten, outerEdges map find flatten) - val preCheckResult = + val preCheckResult = preSubtract(innerNodes.asInstanceOf[Set[self.NodeT]], innerEdges.asInstanceOf[Set[self.EdgeT]], true) preCheckResult.followUp match { - case Complete => Right(withoutChecks(super.--=(elems))) + case Complete => Right(withoutChecks(super.--=(elems))) case PostCheck => val subtractables = (elems filter this.contains).toArray ++ innerNodes.flatMap(_.edges).toIterable withoutChecks(super.--=(subtractables)) diff --git a/core/src/main/scala/scala/collection/Facades.scala b/core/src/main/scala/scala/collection/Facades.scala index e1e4f4e9..da18160f 100644 --- a/core/src/main/scala/scala/collection/Facades.scala +++ b/core/src/main/scala/scala/collection/Facades.scala @@ -10,7 +10,7 @@ package scala.collection */ final class SeqFacade[+A](i: Iterable[A]) extends immutable.Seq[A] { def iterator: Iterator[A] = i.iterator - def apply(idx: Int): A = { + def apply(idx: Int): A = { val it = iterator var i = 0 while (i < idx) { it.next(); i += 1 } diff --git a/core/src/main/scala/scalax/collection/AnyGraph.scala b/core/src/main/scala/scalax/collection/AnyGraph.scala index aaa78684..58281044 100644 --- a/core/src/main/scala/scalax/collection/AnyGraph.scala +++ b/core/src/main/scala/scalax/collection/AnyGraph.scala @@ -276,7 +276,7 @@ trait GraphLike[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphLike[X, Y, CC] wit (nMap get n1, nMap get n2) match { case (Some(nn1), Some(nn2)) => outer match { - case gM: GenericEdgeMapper[EC @unchecked] => builder += gM.map(nn1, nn2) + case gM: GenericEdgeMapper[EC @unchecked] => builder += gM.map(nn1, nn2) case pM: PartialEdgeMapper[EC[NN] @unchecked] => pM.map[NN].lift(nn1, nn2).fold(validate(fallback(nn1, nn2)))(Some(_)).map(builder += _) } @@ -294,7 +294,7 @@ trait GraphLike[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphLike[X, Y, CC] wit (sources.flatMapEither(nMap.get), targets.flatMapEither(nMap.get)) match { case (Right(newSources), Right(newTargets)) => outer match { - case gM: GenericDiHyperEdgeMapper[EC @unchecked] => builder += gM.map(newSources, newTargets) + case gM: GenericDiHyperEdgeMapper[EC @unchecked] => builder += gM.map(newSources, newTargets) case pM: PartialDiHyperEdgeMapper[EC[NN] @unchecked] => pM.map[NN] .lift(newSources, newTargets) @@ -312,7 +312,7 @@ trait GraphLike[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphLike[X, Y, CC] wit ends.flatMapEither(nMap.get) match { case Right(newEnds) => outer match { - case gM: GenericHyperEdgeMapper[EC @unchecked] => builder += gM.map(newEnds) + case gM: GenericHyperEdgeMapper[EC @unchecked] => builder += gM.map(newEnds) case pM: PartialHyperEdgeMapper[EC[NN] @unchecked] => pM.map[NN].lift(newEnds).fold(validate(fallback(newEnds)))(Some(_)).map(builder += _) } diff --git a/core/src/main/scala/scalax/collection/GraphBase.scala b/core/src/main/scala/scalax/collection/GraphBase.scala index 51f18a30..f56c5528 100644 --- a/core/src/main/scala/scalax/collection/GraphBase.scala +++ b/core/src/main/scala/scalax/collection/GraphBase.scala @@ -70,7 +70,7 @@ trait GraphBase[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphBase[X, Y, CC]] @inline final def isCustomEdgeFilter(f: EdgePredicate) = f ne anyEdge type NodeT <: BaseInnerNode with Serializable - trait Node extends Serializable + trait Node extends Serializable trait BaseInnerNode extends Node with InnerNode { /** All edges at this node - commonly denoted as E(v). @@ -423,7 +423,7 @@ trait GraphBase[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphBase[X, Y, CC]] outer match { case edge: AnyEdge[N] => - val AnyEdge(n_1, n_2) = edge + val AnyEdge(n_1, n_2) = edge @inline def inner(n: N): NodeT = { val found = lookup(n) if (null eq found) newNode(n) else found diff --git a/core/src/main/scala/scalax/collection/GraphTraversal.scala b/core/src/main/scala/scalax/collection/GraphTraversal.scala index c69e967e..70bfe04c 100644 --- a/core/src/main/scala/scalax/collection/GraphTraversal.scala +++ b/core/src/main/scala/scalax/collection/GraphTraversal.scala @@ -216,7 +216,7 @@ trait GraphTraversal[N, E <: Edge[N]] extends GraphBase[N, E, GraphTraversal] { def cycle: Option[Cycle] = if (candidateCycleNodes.isEmpty) findCycle else { - val it = candidateCycleNodes.iterator + val it = candidateCycleNodes.iterator @tailrec def loop: Option[Cycle] = if (it.hasNext) it.next().findCycle match { @@ -292,7 +292,7 @@ trait GraphTraversal[N, E <: Edge[N]] extends GraphBase[N, E, GraphTraversal] { private[this] val firstNode = nodeIt.next() private[this] val edgeIt = edges.iterator - def hasNext: Boolean = start || !edgeToFollow || edgeIt.hasNext + def hasNext: Boolean = start || !edgeToFollow || edgeIt.hasNext def next(): InnerElem = if (start) { start = false diff --git a/core/src/main/scala/scalax/collection/GraphTraversalImpl.scala b/core/src/main/scala/scalax/collection/GraphTraversalImpl.scala index 2c316a62..6df56aab 100644 --- a/core/src/main/scala/scalax/collection/GraphTraversalImpl.scala +++ b/core/src/main/scala/scalax/collection/GraphTraversalImpl.scala @@ -688,7 +688,7 @@ trait GraphTraversalImpl[N, E <: Edge[N]] extends GraphTraversal[N, E] with Trav final override protected def className = "Nodes" private lazy val s: Seq[T] = { - val stack: Stack[T] = Stack.empty[T] + val stack: Stack[T] = Stack.empty[T] @tailrec def loop(k: T): Unit = { val opt = map.get(k) if (opt.isDefined) { @@ -784,7 +784,7 @@ trait GraphTraversalImpl[N, E <: Edge[N]] extends GraphTraversal[N, E] with Trav } val isDiGraph = thisGraph.isDirected nodes.source.tail.foldLeft(nodes.head) { (prev: NodeT, elem: CycleStackElem) => - val CycleStackElem(n, conn) = elem + val CycleStackElem(n, conn) = elem def get(edges: Iterable[EdgeT], pred: EdgePredicate): EdgeT = { def ok(e: EdgeT): Boolean = !multi.contains(e) && edgeFilter(e) && pred(e) if (isDiGraph) diff --git a/core/src/main/scala/scalax/collection/State.scala b/core/src/main/scala/scalax/collection/State.scala index 8d13453f..4cf4f834 100644 --- a/core/src/main/scala/scalax/collection/State.scala +++ b/core/src/main/scala/scalax/collection/State.scala @@ -47,8 +47,8 @@ protected trait State[N, E <: Edge[N]] { dirty.flags = 0L if (hasDirtyExt) dirty.flagsExt.clear() } - val free = ~(inUse.flags | dirty.flags) - val nrDirtyFlags = java.lang.Long.bitCount(dirty.flags) + val free = ~(inUse.flags | dirty.flags) + val nrDirtyFlags = java.lang.Long.bitCount(dirty.flags) val newHandle: Handle = if (free != 0) { val nextFree = java.lang.Long.lowestOneBit(free) @@ -95,7 +95,7 @@ protected trait State[N, E <: Edge[N]] { * @return The result of the code block executed. */ protected def withHandles[T](nr: Int, reuse: Array[Handle] = Array.empty[Handle])(block: Array[Handle] => T): T = { - val newHandlers = reuse isEmpty + val newHandlers = reuse isEmpty val theseHandles = if (newHandlers) Array.fill(nr)(nextHandle) else reuse @@ -105,8 +105,8 @@ protected trait State[N, E <: Edge[N]] { } trait InnerNodeState { - protected[State] var flags: FlagWord = 0L - protected[State] var flagsExt: FlagWords = null + protected[State] var flags: FlagWord = 0L + protected[State] var flagsExt: FlagWords = null @inline final protected def withFlagsExt[T](block: (ExtBitSet) => T): T = block { if (flagsExt eq null) flagsExt = initFlagSet diff --git a/core/src/main/scala/scalax/collection/ToString.scala b/core/src/main/scala/scalax/collection/ToString.scala index 807f38f6..f169d7ef 100644 --- a/core/src/main/scala/scalax/collection/ToString.scala +++ b/core/src/main/scala/scalax/collection/ToString.scala @@ -85,7 +85,7 @@ object ToString { } sealed trait SetStyle extends Style - object SingleLine extends SetStyle + object SingleLine extends SetStyle final case class SetsOnSeparateLines(indent: Int = 0) extends StyleWithIndent[SetsOnSeparateLines] { def incremented: SetsOnSeparateLines = copy(indent + 2) } diff --git a/core/src/main/scala/scalax/collection/TraverserImpl.scala b/core/src/main/scala/scalax/collection/TraverserImpl.scala index 114c1ffe..ac2df7d6 100644 --- a/core/src/main/scala/scalax/collection/TraverserImpl.scala +++ b/core/src/main/scala/scalax/collection/TraverserImpl.scala @@ -59,7 +59,7 @@ trait TraverserImpl[N, E <: Edge[N]] { innerNodeTraverser(root, Parameters.Dfs(Predecessors)).to(MSet) -= root else MSet.empty def ignore(n: NodeT): Boolean = if (ignorePredecessors) predecessors contains n else false - val inDegrees = + val inDegrees = forInDegrees( innerNodeTraverser(root, Parameters.Dfs(AnyConnected), n => subgraphNodes(n), subgraphEdges), includeInDegree = if (ignorePredecessors) !ignore(_) else anyNode, @@ -120,7 +120,7 @@ trait TraverserImpl[N, E <: Edge[N]] { */ private[this] val (doNodeVisitor, nodeVisitor, extNodeVisitor, edgeVisitor) : (Boolean, NodeT => U, ExtendedNodeVisitor[U], EdgeT => U) = { - val nodeVisitor = thisImpl.nodeVisitor(visitor) + val nodeVisitor = thisImpl.nodeVisitor(visitor) val extNodeVisitor = visitor match { case ext: ExtendedNodeVisitor[U @unchecked] => ext case _ => null @@ -165,10 +165,10 @@ trait TraverserImpl[N, E <: Edge[N]] { ): AnySet[A] = set match { case a: ArraySet[A] => a.sorted(ordering) - case t => + case t => @inline def newArray(len: Int): Array[A] = new Array[B](len).asInstanceOf[Array[A]] var cnt = 0 - val arr = + val arr = if (maxOrEst >= 0) { val arr = newArray(maxOrEst) t foreach { a => @@ -348,7 +348,7 @@ trait TraverserImpl[N, E <: Edge[N]] { } } - var nodeCnt = 0 + var nodeCnt = 0 @tailrec def rec(pq: PriorityQueue[PrioQueueElem]): Unit = if (pq.nonEmpty && (pq.head.node ne potentialSuccessor)) { val PrioQueueElem(node, cumWeight, depth) = pq.dequeue() @@ -464,7 +464,7 @@ trait TraverserImpl[N, E <: Edge[N]] { val path: Stack[Element] = Stack() var res: Option[NodeT] = None var nodeCnt = 0 - @tailrec def loop: Unit = + @tailrec def loop: Unit = if (stack.nonEmpty) { val popped @ Element(current, depth, cumWeight) = stack.pop() if (depth > 0) @@ -600,7 +600,7 @@ trait TraverserImpl[N, E <: Edge[N]] { } case (Loop, _) => if (elem.lowLink == index) { - val componentNodes = Set.newBuilder[NodeT] + val componentNodes = Set.newBuilder[NodeT] @tailrec def pop(continue: Boolean): Unit = if (continue) { val n = stack.pop().node onStack.remove(n) @@ -708,7 +708,7 @@ trait TraverserImpl[N, E <: Edge[N]] { .withSubgraph(n => subgraphNodes(n) && !isWhite(n) && (n ne current), subgraphEdges) .pathUntil_(isGray, maybeHandle = visitedBlackHandle) .foreach { missingPath => - val start = missingPath.endNode + val start = missingPath.endNode val shortenedPath = { var found = false path takeWhile { case CycleStackElem(n, _) => @@ -771,7 +771,7 @@ trait TraverserImpl[N, E <: Edge[N]] { cycle(successorsByColor(gray)) match { case result @ Some(_) => result - case None => + case None => successorsByColor(white) match { case whiteSuccessors if whiteSuccessors.nonEmpty => for (n <- whiteSuccessors) { diff --git a/core/src/main/scala/scalax/collection/generator/RandomGraph.scala b/core/src/main/scala/scalax/collection/generator/RandomGraph.scala index e36ccfb8..c4e5717e 100644 --- a/core/src/main/scala/scalax/collection/generator/RandomGraph.scala +++ b/core/src/main/scala/scalax/collection/generator/RandomGraph.scala @@ -52,7 +52,7 @@ class RandomGraph[N, E <: Edge[N], G[X, Y <: Edge[X]] <: AnyGraph[X, Y] with Gra final protected[RandomGraph] class DefaultWeightFactory { private[this] var weightCount = 0L - def apply: () => Long = { () => + def apply: () => Long = { () => weightCount += 1 weightCount } @@ -68,7 +68,7 @@ class RandomGraph[N, E <: Edge[N], G[X, Y <: Edge[X]] <: AnyGraph[X, Y] with Gra * `A, B, ..., AA, AB, ..., BA, BB, ...`. */ def apply: () => Any = { () => - val len = labelBuffer.length + val len = labelBuffer.length def loop(i: Int): Array[Char] = { val c = labelBuffer(i) if (c == endChar) @@ -139,7 +139,7 @@ class RandomGraph[N, E <: Edge[N], G[X, Y <: Edge[X]] <: AnyGraph[X, Y] with Gra def mayFinish: Boolean = active.toFloat / order < 0.5 - private[this] var idx = 0 + private[this] var idx = 0 def add(node: N, degree: Int): Unit = { nodes(idx) = node degrees(idx) = degree @@ -159,7 +159,7 @@ class RandomGraph[N, E <: Edge[N], G[X, Y <: Edge[X]] <: AnyGraph[X, Y] with Gra def setUsed: Unit = { val drawnCompact = compactIndex >= 0 - val degreeIdx = + val degreeIdx = if (drawnCompact) compacts(compactIndex)(index) - 1 else index if (degreeIdx >= 0) { @@ -197,7 +197,7 @@ class RandomGraph[N, E <: Edge[N], G[X, Y <: Edge[X]] <: AnyGraph[X, Y] with Gra val empty = new Drawn(0.asInstanceOf[N], emptyIdx, -1) } - private val r = new Random + private val r = new Random def draw: Drawn = if (active <= 0) Drawn.empty else { @@ -251,7 +251,7 @@ class RandomGraph[N, E <: Edge[N], G[X, Y <: Edge[X]] <: AnyGraph[X, Y] with Gra protected[RandomGraph] class RandomEdge(weightFactory: () => Long, labelFactory: () => Any)(implicit val d: Degrees) { private[this] val c = RandomEdge.drawCompanion - val degrees = d.draw( + val degrees = d.draw( c match { case _: EdgeCompanion[_] => 2 case _ => 2 + RandomEdge.r.nextInt(5) // TODO use EdgeArityRange instead @@ -419,7 +419,7 @@ object RandomGraph { case _ => false } lazy val expectedTotalDegree: Int = (order * nodeDegrees.mean).toInt - lazy val divisor: Int = { + lazy val divisor: Int = { val d = if (isDense) 8 else 22 if (order > 50) d else d / 6 } diff --git a/core/src/main/scala/scalax/collection/generator/parameters/Parameters.scala b/core/src/main/scala/scalax/collection/generator/parameters/Parameters.scala index 527a37ef..a0eee6ca 100644 --- a/core/src/main/scala/scalax/collection/generator/parameters/Parameters.scala +++ b/core/src/main/scala/scalax/collection/generator/parameters/Parameters.scala @@ -8,10 +8,10 @@ abstract class RandomRange(min: Int, max: Int, uniform: Boolean) { val halfSpan = span.toFloat / 2 def mean = min + (span - 1).toFloat / 2 private val r, sign = new Random - def draw = if (uniform) r.nextInt(span) + min + def draw = if (uniform) r.nextInt(span) + min else ((r.nextGaussian() + 1 + min) * halfSpan).toInt def drawHalf = { - val d = draw + val d = draw val even = if (d % 2 == 0) d else d + (if (sign.nextInt(2) == 1) 1 else -1) diff --git a/core/src/main/scala/scalax/collection/generic/edgeBase.scala b/core/src/main/scala/scalax/collection/generic/edgeBase.scala index 6c97b2fa..7dfcfb95 100644 --- a/core/src/main/scala/scalax/collection/generic/edgeBase.scala +++ b/core/src/main/scala/scalax/collection/generic/edgeBase.scala @@ -169,7 +169,7 @@ trait AnyHyperEdge[+N] extends Edge[N] with EqHyper { def withTargets[U](f: N => U): Unit = targets.iterator foreach f final protected def matches(fList: List[N => Boolean]): Boolean = { - val it = ends.iterator + val it = ends.iterator @tailrec def loop(checks: List[N => Boolean]): Boolean = if (checks.isEmpty) true else if (!it.hasNext) false @@ -345,7 +345,7 @@ trait AnyUnDiEdge[+N] extends AnyHyperEdge[N] with AnyEdge[N] with EqUnDi[N] { override def isDirected = false - override def matches[M >: N](n1: M, n2: M): Boolean = unDiBaseEquals(n1, n2) + override def matches[M >: N](n1: M, n2: M): Boolean = unDiBaseEquals(n1, n2) override def matches(p1: N => Boolean, p2: N => Boolean): Boolean = p1(this.node1) && p2(this.node2) || p1(this.node2) && p2(this.node1) diff --git a/core/src/main/scala/scalax/collection/generic/edgeEquality.scala b/core/src/main/scala/scalax/collection/generic/edgeEquality.scala index 45da3e50..3978132a 100644 --- a/core/src/main/scala/scalax/collection/generic/edgeEquality.scala +++ b/core/src/main/scala/scalax/collection/generic/edgeEquality.scala @@ -117,7 +117,7 @@ protected[collection] trait EqUnDi[+N] extends Eq { this.node1 == n2 && this.node2 == n1 override protected def baseEquals(other: Edge[_]): Boolean = other match { - case edge: AnyEdge[_] => unDiBaseEquals(edge.node1, edge.node2) + case edge: AnyEdge[_] => unDiBaseEquals(edge.node1, edge.node2) case hyper: AnyHyperEdge[_] if hyper.isUndirected && hyper.arity == 2 => unDiBaseEquals(hyper.node(0), hyper.node(1)) case _ => false diff --git a/core/src/main/scala/scalax/collection/generic/edgeMappers.scala b/core/src/main/scala/scalax/collection/generic/edgeMappers.scala index ae3a0d0e..942e5769 100644 --- a/core/src/main/scala/scalax/collection/generic/edgeMappers.scala +++ b/core/src/main/scala/scalax/collection/generic/edgeMappers.scala @@ -3,7 +3,7 @@ package generic sealed protected[collection] trait Mapper sealed protected[collection] trait GenericMapper extends Mapper -trait PartialMapper extends Mapper { +trait PartialMapper extends Mapper { def map[N]: PartialFunction[_, _] } diff --git a/core/src/main/scala/scalax/collection/immutable/AdjacencyListBase.scala b/core/src/main/scala/scalax/collection/immutable/AdjacencyListBase.scala index 79b090c9..2faf48ec 100644 --- a/core/src/main/scala/scalax/collection/immutable/AdjacencyListBase.scala +++ b/core/src/main/scala/scalax/collection/immutable/AdjacencyListBase.scala @@ -167,7 +167,7 @@ trait AdjacencyListBase[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphLike[X, Y, includeHooks: Boolean = false, ignoreMultiEdges: Boolean = true ): Int = { - val doEdgeFilter = isCustomEdgeFilter(edgeFilter) + val doEdgeFilter = isCustomEdgeFilter(edgeFilter) def edgePred(e: EdgeT): Boolean = (if (doEdgeFilter) edgeFilter(e) else true) && e.hasSource((n: NodeT) => n eq this) && @@ -187,7 +187,7 @@ trait AdjacencyListBase[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphLike[X, Y, includeHooks: Boolean = false, ignoreMultiEdges: Boolean = true ): Int = { - val doEdgeFilter = isCustomEdgeFilter(edgeFilter) + val doEdgeFilter = isCustomEdgeFilter(edgeFilter) def edgePred(e: EdgeT): Boolean = (if (doEdgeFilter) edgeFilter(e) else true) && e.hasTarget((n: NodeT) => n eq this) && @@ -232,10 +232,10 @@ trait AdjacencyListBase[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: GraphLike[X, Y, def eq(inner: NodeT, outer: N) = inner.outer == outer collection.findElem[N](elem, eq) } - @inline final def contains(node: NodeT): Boolean = collection contains node - @inline final def iterator: Iterator[NodeT] = collection.iterator - @inline final override def size: Int = collection.size - @inline final def draw(random: Random): NodeT = collection draw random + @inline final def contains(node: NodeT): Boolean = collection contains node + @inline final def iterator: Iterator[NodeT] = collection.iterator + @inline final override def size: Int = collection.size + @inline final def draw(random: Random): NodeT = collection draw random @inline final def findElem[B](toMatch: B, correspond: (NodeT, B) => Boolean): NodeT = collection findElem (toMatch, correspond) protected[collection] def +=(edge: EdgeT): this.type diff --git a/core/src/main/scala/scalax/collection/immutable/AdjacencyListGraph.scala b/core/src/main/scala/scalax/collection/immutable/AdjacencyListGraph.scala index 5b695aad..6937f32b 100644 --- a/core/src/main/scala/scalax/collection/immutable/AdjacencyListGraph.scala +++ b/core/src/main/scala/scalax/collection/immutable/AdjacencyListGraph.scala @@ -25,7 +25,7 @@ trait AdjacencyListGraph[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: AdjacencyListG type NodeSetT = AdjacencyListNodeSet class AdjacencyListNodeSet extends AdjacencyListBaseNodeSet { @inline final override protected def minus(node: NodeT): Unit = collection -= node - override def +(node: NodeT): NodeSetT = + override def +(node: NodeT): NodeSetT = if (collection contains node) this else { val c = this.copy; c.collection += node; c } diff --git a/core/src/main/scala/scalax/collection/mutable/AdjacencyListGraph.scala b/core/src/main/scala/scalax/collection/mutable/AdjacencyListGraph.scala index 5d9b70d3..fe7038c2 100644 --- a/core/src/main/scala/scalax/collection/mutable/AdjacencyListGraph.scala +++ b/core/src/main/scala/scalax/collection/mutable/AdjacencyListGraph.scala @@ -88,7 +88,7 @@ trait AdjacencyListGraph[N, E <: Edge[N], +CC[X, Y <: Edge[X]] <: AdjacencyListG @inline final def addOne(node: NodeT): this.type = { add(node); this } @inline final def subtractOne(node: NodeT): this.type = { remove(node); this } - final protected def minus(node: NodeT): Unit = collection -= node + final protected def minus(node: NodeT): Unit = collection -= node final protected def minusEdges(node: NodeT): Unit = edges --= node.edges.toList // toList is necessary to avoid failure of -=(node) like in TEdit.test_MinusEq_2 } diff --git a/core/src/main/scala/scalax/collection/mutable/EqHashMap.scala b/core/src/main/scala/scalax/collection/mutable/EqHashMap.scala index 432f4dfe..078a2fbd 100644 --- a/core/src/main/scala/scalax/collection/mutable/EqHashMap.scala +++ b/core/src/main/scala/scalax/collection/mutable/EqHashMap.scala @@ -40,7 +40,7 @@ class EqHashMap[K <: AnyRef, V](_sizeHint: Int = EqHash.defCapacity) override def remove(key: K): Option[V] = (index(key): @switch) match { case i if i < 0 => None - case i => + case i => _size -= 1 val oldValue = table(i + 1) table(i + 1) = null diff --git a/core/src/main/scala/scalax/collection/mutable/EqHashSet.scala b/core/src/main/scala/scalax/collection/mutable/EqHashSet.scala index 115c096b..264d3c9a 100644 --- a/core/src/main/scala/scalax/collection/mutable/EqHashSet.scala +++ b/core/src/main/scala/scalax/collection/mutable/EqHashSet.scala @@ -55,7 +55,7 @@ class EqHashSet[A <: AnyRef](_sizeHint: Int = EqHash.defCapacity) extends Set[A] override def remove(elem: A): Boolean = (index(elem): @switch) match { case i if i < 0 => false - case i => + case i => _size -= 1 table(i) = null closeDeletion(i) diff --git a/core/src/main/scala/scalax/collection/mutable/SimpleArraySet.scala b/core/src/main/scala/scalax/collection/mutable/SimpleArraySet.scala index 3f9f3e58..b55b5a24 100644 --- a/core/src/main/scala/scalax/collection/mutable/SimpleArraySet.scala +++ b/core/src/main/scala/scalax/collection/mutable/SimpleArraySet.scala @@ -78,7 +78,7 @@ final class SimpleArraySet[A](override val hints: ArraySet.Hints) new scala.collection.AbstractIterator[A] { private[this] var i = 0 private[this] var prevElm: A = _ - def hasNext = + def hasNext = i < nextFree def next() = { if (i >= nextFree) diff --git a/core/src/test/scala-2/scalax/collection/EditingTypedSpec.scala b/core/src/test/scala-2/scalax/collection/EditingTypedSpec.scala index c0603d14..07f05125 100644 --- a/core/src/test/scala-2/scalax/collection/EditingTypedSpec.scala +++ b/core/src/test/scala-2/scalax/collection/EditingTypedSpec.scala @@ -22,7 +22,7 @@ class EditingTypedSpec private object Samples { val (madrid, rio) = (Airport("MAD"), Airport("GIG")) val flightNo = "IB 8711" - val outer = Flight( + val outer = Flight( madrid, rio, flightNo, diff --git a/core/src/test/scala-3/scalax/collection/EditingTypedSpec.scala b/core/src/test/scala-3/scalax/collection/EditingTypedSpec.scala index e080d440..7f59df61 100644 --- a/core/src/test/scala-3/scalax/collection/EditingTypedSpec.scala +++ b/core/src/test/scala-3/scalax/collection/EditingTypedSpec.scala @@ -22,7 +22,7 @@ class EditingTypedSpec private object Samples { val (madrid, rio) = (Airport("MAD"), Airport("GIG")) val flightNo = "IB 8711" - val outer = Flight( + val outer = Flight( madrid, rio, flightNo, diff --git a/core/src/test/scala/demo/GraphTestDemo.scala b/core/src/test/scala/demo/GraphTestDemo.scala index 641e671e..f643ef03 100644 --- a/core/src/test/scala/demo/GraphTestDemo.scala +++ b/core/src/test/scala/demo/GraphTestDemo.scala @@ -134,8 +134,8 @@ object GraphTestDemo extends App { } object MixedMetrics extends GraphGen.Metrics[Person] { - val order = PersonData.order - val nodeDegrees = PersonData.degrees + val order = PersonData.order + val nodeDegrees = PersonData.degrees def nodeGen: Gen[Person] = Gen.resultOf((name: String, year: Int) => Person(name, year))( Arbitrary(Person.nameGen), Arbitrary(Person.yearOfBirthGen) diff --git a/core/src/test/scala/demo/TraversingDemoSpec.scala b/core/src/test/scala/demo/TraversingDemoSpec.scala index 7e575e57..1ea675f7 100644 --- a/core/src/test/scala/demo/TraversingDemoSpec.scala +++ b/core/src/test/scala/demo/TraversingDemoSpec.scala @@ -119,7 +119,7 @@ final class TraversingDemoSpec extends RefSpec with Matchers { val root = "A" val g = Graph(root ~> "B1", root ~> "B2") val innerRoot = g get root - val result = innerRoot.innerNodeDownUpTraverser.foldLeft(ArrayBuffer.empty[String]) { (buf, param) => + val result = innerRoot.innerNodeDownUpTraverser.foldLeft(ArrayBuffer.empty[String]) { (buf, param) => param match { case (down, node) => if (down) buf += (if (node eq innerRoot) "(" else "[") += node.toString @@ -150,7 +150,7 @@ final class TraversingDemoSpec extends RefSpec with Matchers { val g = Graph(1 ~> 2, 1 ~> 3, 2 ~> 3, 3 ~> 4, 4 ~> 2) var center: Option[g.NodeT] = None - val maybeCycle = (g get 4).findCycle(n => + val maybeCycle = (g get 4).findCycle(n => center = center match { case s @ Some(c) => if (n.degree > c.degree) Some(n) else s case None => Some(n) @@ -166,7 +166,7 @@ final class TraversingDemoSpec extends RefSpec with Matchers { (edges(1), edges(5)) } val disconnected = Graph.from(edges = componentEdges._1 ++ componentEdges._2) - val sums = + val sums = for (component <- disconnected.componentTraverser()) yield component.nodes.foldLeft(0)((cum, n) => cum + n.outer) sums should be(List(6, 18)) diff --git a/core/src/test/scala/scala/collection/mutable/ExtHashSetSpec.scala b/core/src/test/scala/scala/collection/mutable/ExtHashSetSpec.scala index fd792bb8..85a1bda9 100644 --- a/core/src/test/scala/scala/collection/mutable/ExtHashSetSpec.scala +++ b/core/src/test/scala/scala/collection/mutable/ExtHashSetSpec.scala @@ -64,7 +64,7 @@ class ExtHashSetSpec extends RefSpec with Matchers { def `is able to upsert elements`: Unit = { class MutableElem(val a: Int, var b: Int) { - override def hashCode(): Int = a.## + override def hashCode(): Int = a.## override def equals(other: Any): Boolean = other match { case that: MutableElem => a == that.a case _ => false diff --git a/core/src/test/scala/scalax/collection/ConnectivitySpec.scala b/core/src/test/scala/scalax/collection/ConnectivitySpec.scala index 8e5e7134..b81de77c 100644 --- a/core/src/test/scala/scalax/collection/ConnectivitySpec.scala +++ b/core/src/test/scala/scalax/collection/ConnectivitySpec.scala @@ -77,7 +77,7 @@ final class Connectivity[G[N, E <: Edge[N]] <: AnyGraph[N, E] with GraphLike[N, } def `connected by a diEdge yields a graph with the very same two strong components`: Unit = { - val r = new Random + val r = new Random val union = sscExpectedAny.foldLeft(factory.empty[Char, DiEdge[Char]].asAnyGraph)((r, g) => g union r) val connectors = { @@ -85,7 +85,7 @@ final class Connectivity[G[N, E <: Edge[N]] <: AnyGraph[N, E] with GraphLike[N, for (i <- 1 to 10) yield pickNode(0) ~> pickNode(1) } connectors foreach { connector => - val connected = union concat List(connector) + val connected = union concat List(connector) def check(scc: Iterable[connected.Component], expectedSize: Int): Unit = { scc should have size expectedSize scc foreach { sc => @@ -139,7 +139,7 @@ final class Connectivity[G[N, E <: Edge[N]] <: AnyGraph[N, E] with GraphLike[N, def `strong components are proper`: Unit = withGraph(g) { _ => - val maxProbes = 10 + val maxProbes = 10 val arbitraryNodes: Vector[Set[g.NodeT]] = strongComponents map { sc => val nodes = sc.nodes if (nodes.size <= maxProbes) nodes diff --git a/core/src/test/scala/scalax/collection/Data.scala b/core/src/test/scala/scalax/collection/Data.scala index e95b9c34..e8a27272 100644 --- a/core/src/test/scala/scalax/collection/Data.scala +++ b/core/src/test/scala/scalax/collection/Data.scala @@ -95,7 +95,7 @@ object Data { loop() case it: Iterator[A] => - val source = it.toBuffer + val source = it.toBuffer @tailrec def loop(): C = { val shuffled = shuffle(source) if (shuffled == source) loop() diff --git a/core/src/test/scala/scalax/collection/EditingHyperSpec.scala b/core/src/test/scala/scalax/collection/EditingHyperSpec.scala index 13347851..8929b988 100644 --- a/core/src/test/scala/scalax/collection/EditingHyperSpec.scala +++ b/core/src/test/scala/scalax/collection/EditingHyperSpec.scala @@ -87,7 +87,7 @@ private class EditingHyper[CC[N, E <: Edge[N]] <: AnyGraph[N, E] with GraphLike[ } val single = one(1) - val hDi = factory( + val hDi = factory( single ~~> more(1, 5), single ~~> more(2, 5), single ~~> more(3, 5), diff --git a/core/src/test/scala/scalax/collection/MappingSpec.scala b/core/src/test/scala/scalax/collection/MappingSpec.scala index d399ea3d..133d82bd 100644 --- a/core/src/test/scala/scalax/collection/MappingSpec.scala +++ b/core/src/test/scala/scalax/collection/MappingSpec.scala @@ -101,7 +101,7 @@ class MappingSpec extends RefSpec with Matchers { } def `change edge ends and structure`: Unit = { - val source = Graph(1 ~ 2, 3 ~ 3) + val source = Graph(1 ~ 2, 3 ~ 3) val g: Graph[Int, DiEdge[Int]] = source.flatMap( fNode = increment, diff --git a/core/src/test/scala/scalax/collection/SerializableSpec.scala b/core/src/test/scala/scalax/collection/SerializableSpec.scala index 151f8640..8cd908e0 100644 --- a/core/src/test/scala/scalax/collection/SerializableSpec.scala +++ b/core/src/test/scala/scalax/collection/SerializableSpec.scala @@ -60,8 +60,8 @@ final private class TSerializable[CC[N, E <: Edge[N]] <: AnyGraph[N, E] with Gra fail(s"Couldn't read graph: $e") }.get } - private val tmpDir = System.getProperty("java.io.tmpdir") - private var cnt = 0 + private val tmpDir = System.getProperty("java.io.tmpdir") + private var cnt = 0 protected def newTest: Exec = { cnt += 1 new Exec( // include the name of the test method @@ -293,7 +293,7 @@ object ByteArraySerialization { object FileSerialization { def write(obj: AnyRef, filename: String): Try[File] = write(obj, new File(filename)) - def write(obj: AnyRef, file: File): Try[File] = { + def write(obj: AnyRef, file: File): Try[File] = { var out: ObjectOutputStream = null Try { out = new ObjectOutputStream(new FileOutputStream(file)) @@ -306,7 +306,7 @@ object FileSerialization { } } def read[A](filename: String): Try[A] = read(new File(filename)) - def read[A](file: File): Try[A] = { + def read[A](file: File): Try[A] = { var in: ObjectInputStream = null Try { in = new ObjectInputStream(new FileInputStream(file)) diff --git a/core/src/test/scala/scalax/collection/SetOpsSpec.scala b/core/src/test/scala/scalax/collection/SetOpsSpec.scala index 313297ab..fc535316 100644 --- a/core/src/test/scala/scalax/collection/SetOpsSpec.scala +++ b/core/src/test/scala/scalax/collection/SetOpsSpec.scala @@ -31,7 +31,7 @@ protected trait SetOpExamples[CC[N, E <: Edge[N]] <: AnyGraph[N, E] with GraphLi protected object Expected { val g_union_h = factory.from(gEdges ++ hEdges) - val g_diff_h = + val g_diff_h = g.nodes.toOuter -- h.nodes.toOuter pipe { nDiff => factory.from(nDiff, gEdges ++ hEdges filter { case n1 ~ n2 => nDiff(n1) && nDiff(n2) }) } diff --git a/core/src/test/scala/scalax/collection/StateSpec.scala b/core/src/test/scala/scalax/collection/StateSpec.scala index 6c6675c2..e0b96c17 100644 --- a/core/src/test/scala/scalax/collection/StateSpec.scala +++ b/core/src/test/scala/scalax/collection/StateSpec.scala @@ -52,7 +52,7 @@ class StateSpec extends RefSpec with Matchers { } def `when called deep-recursively`: Unit = { - val recurseAt = g.nodes.head + val recurseAt = g.nodes.head def countNodesDeep(recursion: Int): Int = { assert(recursion >= 0) var nrNodes = 0 @@ -74,7 +74,7 @@ class StateSpec extends RefSpec with Matchers { val r = new Random(10 * order) def intNodeFactory = r.nextInt() - val g = + val g = new RandomGraph[Int, DiEdge[Int], Graph]( Graph, order, diff --git a/core/src/test/scala/scalax/collection/TraversalSpec.scala b/core/src/test/scala/scalax/collection/TraversalSpec.scala index 528cc0ba..a8c43b5b 100644 --- a/core/src/test/scala/scalax/collection/TraversalSpec.scala +++ b/core/src/test/scala/scalax/collection/TraversalSpec.scala @@ -224,7 +224,7 @@ final private class Traversal[G[N, E <: Edge[N]] <: AnyGraph[N, E] with GraphLik val root = "A" withGraph(factory(root ~> "B1", root ~> "B2")) { g => val innerRoot = g get root - val result = innerRoot.innerNodeDownUpTraverser.foldLeft(ListBuffer.empty[String]) { (buf, param) => + val result = innerRoot.innerNodeDownUpTraverser.foldLeft(ListBuffer.empty[String]) { (buf, param) => param match { case (down, node) => if (down) buf += (if (node eq innerRoot) "(" else "[") += node.toString diff --git a/core/src/test/scala/scalax/collection/generator/GraphGenSpec.scala b/core/src/test/scala/scalax/collection/generator/GraphGenSpec.scala index 852d38ae..64d4dd5b 100644 --- a/core/src/test/scala/scalax/collection/generator/GraphGenSpec.scala +++ b/core/src/test/scala/scalax/collection/generator/GraphGenSpec.scala @@ -11,7 +11,7 @@ import scalax.collection.immutable.Graph class GraphGenSpec extends RefSpec with Matchers with ScalaCheckPropertyChecks { - final val minSuccessful = 5 + final val minSuccessful = 5 implicit val config: PropertyCheckConfiguration = PropertyCheckConfiguration(minSuccessful = minSuccessful, maxDiscardedFactor = 1.0) @@ -26,7 +26,7 @@ class GraphGenSpec extends RefSpec with Matchers with ScalaCheckPropertyChecks { } object `outer node set` { - val order = 5 + val order = 5 implicit val arbitraryOuterNodes: Arbitrary[Set[Int]] = new GraphGen[Int, DiEdge[Int], Graph]( Graph, diff --git a/core/src/test/scala/scalax/collection/mutable/ArraySetSpec.scala b/core/src/test/scala/scalax/collection/mutable/ArraySetSpec.scala index 7d501581..34cebf12 100644 --- a/core/src/test/scala/scalax/collection/mutable/ArraySetSpec.scala +++ b/core/src/test/scala/scalax/collection/mutable/ArraySetSpec.scala @@ -27,7 +27,7 @@ class ArraySetSpec extends RefSpec with Matchers { val arr = ArraySet.emptyWithHints[Int] arr.capacity shouldBe hints.initialCapacity - val integers = new IntSequence + val integers = new IntSequence def add(numberOfAdditions: Int, expectedCapacity: Int): Unit = for (i <- 0 until numberOfAdditions) { arr += integers.draw() @@ -47,15 +47,15 @@ class ArraySetSpec extends RefSpec with Matchers { def `may be compacted`: Unit = { val integers = new IntSequence val toAdd = hints.initialCapacity + 1 - val arr = ArraySet.emptyWithHints[Int] ++= + val arr = ArraySet.emptyWithHints[Int] ++= (for (i <- 1 to toAdd) yield integers.draw()) arr.compact() arr.capacity shouldBe toAdd } def `may be configured to be represented solely by a HashSet`: Unit = { - val edges = new IntSequence - val arr = ArraySet.emptyWithHints[Int](ArraySet.Hints.HashOnly) + val edges = new IntSequence + val arr = ArraySet.emptyWithHints[Int](ArraySet.Hints.HashOnly) def check(): Unit = { arr.isArray shouldBe false arr.capacity shouldBe 0 diff --git a/core/src/test/scala/scalax/time/MicroBenchmarkTest.scala b/core/src/test/scala/scalax/time/MicroBenchmarkTest.scala index 9dc41ab2..42ac77c1 100644 --- a/core/src/test/scala/scalax/time/MicroBenchmarkTest.scala +++ b/core/src/test/scala/scalax/time/MicroBenchmarkTest.scala @@ -15,7 +15,7 @@ class MicroBenchmarkTest extends RefSpec with Matchers { object `relativeTimes() reflects` { def `relative execution times`: Unit = { - val r = 1 to 20 + val r = 1 to 20 val relTimes = relativeTimes(warmUp = 2)( r.toList.sorted, r.toList.sorted.toArray.toList.sorted, @@ -30,7 +30,7 @@ class MicroBenchmarkTest extends RefSpec with Matchers { class FloatTolerance(maxDeviation: Float) extends Equality[Float] { private def eq(a: Float, b: Float): Boolean = if (a > b) a < b * maxDeviation else a > b / maxDeviation - def areEqual(a: Float, b: Any) = b match { + def areEqual(a: Float, b: Any) = b match { case f: Float => eq(a, f) case i: Int => eq(a, i.toFloat) } diff --git a/dot/src/main/scala/scalax/collection/io/dot/AstTypes.scala b/dot/src/main/scala/scalax/collection/io/dot/AstTypes.scala index ce051614..8d8b5206 100644 --- a/dot/src/main/scala/scalax/collection/io/dot/AstTypes.scala +++ b/dot/src/main/scala/scalax/collection/io/dot/AstTypes.scala @@ -9,8 +9,8 @@ sealed trait DotId /** Verified DOT ID. */ class Id private[dot] (val id: String, val numeric: Boolean) extends DotId { - def apply(): String = id - override def hashCode: Int = id.hashCode + def apply(): String = id + override def hashCode: Int = id.hashCode override def equals(other: Any): Boolean = other match { case that: Id => that.id == this.id case _ => false @@ -38,7 +38,7 @@ object Id { else new Id(s""""$id"""", false) } } - private val quotes = List(('"', '"'), ('<', '>')) + private val quotes = List(('"', '"'), ('<', '>')) private val rNonWhitespaceString: Regex = { val firstChar = "a-zA-Z\u0080-\u00ff_" s"[$firstChar][${firstChar}0-9]*".r @@ -91,7 +91,7 @@ sealed trait DotGraph { def id: Option[Id] def attrStmts: Seq[DotAttrStmt] def attrList: Seq[DotAttr] - override def hashCode: Int = id.## + override def hashCode: Int = id.## override def equals(that: Any): Boolean = that match { case that: DotRootGraph => this.id == that.id case _ => false @@ -146,7 +146,7 @@ case class DotNodeStmt(nodeId: NodeId, attrList: Seq[DotAttr] = Seq()) extends D case class DotEdgeStmt(node_1Id: NodeId, node_2Id: NodeId, attrList: Seq[DotAttr] = Seq()) extends DotStmt protected[dot] case class DotCluster(dotGraph: DotGraph, dotStmts: MutableSet[DotStmt] = MutableSet()) { - override def hashCode: Int = dotGraph.id.## + override def hashCode: Int = dotGraph.id.## override def equals(that: Any): Boolean = that match { case that: DotCluster => this.dotGraph.id == that.dotGraph.id case _ => false diff --git a/dot/src/main/scala/scalax/collection/io/dot/Export.scala b/dot/src/main/scala/scalax/collection/io/dot/Export.scala index fee99c2d..6f4b636c 100644 --- a/dot/src/main/scala/scalax/collection/io/dot/Export.scala +++ b/dot/src/main/scala/scalax/collection/io/dot/Export.scala @@ -66,7 +66,7 @@ trait Export[N, E <: Edge[N]] extends Any { } node.outer.dotGraph match { case DotSubGraph(ancestor: DotRootGraph, _, _, _) => conn(ancestor) - case DotSubGraph(ancestor: DotSubGraph, _, _, _) => + case DotSubGraph(ancestor: DotSubGraph, _, _, _) => conn(ancestor) connectClusters(dotAST addAndGet DotCluster(ancestor)) case _: DotRootGraph => diff --git a/dot/src/test/scala/scalax/collection/io/dot/ExportSpec.scala b/dot/src/test/scala/scalax/collection/io/dot/ExportSpec.scala index 2602fe30..a6c8ef84 100644 --- a/dot/src/test/scala/scalax/collection/io/dot/ExportSpec.scala +++ b/dot/src/test/scala/scalax/collection/io/dot/ExportSpec.scala @@ -92,7 +92,7 @@ class ExportSpec extends RefSpec with Matchers { ) } val dot_sorted = { - var group = 1 + var group = 1 val groups = { val unsortedMap = dot.linesWithSeparators.toList.groupBy { line => group match { @@ -146,7 +146,7 @@ class ExportSpec extends RefSpec with Matchers { def `Directed hyperedges may be mapped to multiple directed DOT edges`(): Unit = { val hg = Graph.from(OneOrMore(1) ~~> OneOrMore(2, 3) :: Nil) val root = DotRootGraph(directed = true, id = None) - val dot = hg.toDot( + val dot = hg.toDot( dotRoot = root, edgeTransformer = _ => None, hEdgeTransformer = Some { h => @@ -169,8 +169,8 @@ class ExportSpec extends RefSpec with Matchers { import ExportSpec.records._ import ExportSpec.records.RecordGraph.OuterImplicits._ - def struct(i: Int) = s"struct$i" - val (f0, f1, f2, here) = ("f0", "f1", "f2", "here") + def struct(i: Int) = s"struct$i" + val (f0, f1, f2, here) = ("f0", "f1", "f2", "here") val (n1, n2, n3): (Node, Node, Node) = ( Node( struct(1), @@ -231,7 +231,7 @@ class ExportSpec extends RefSpec with Matchers { import scalax.collection.edges.DiEdge import scalax.collection.io.dot.implicits._ - val g = Graph[Int, DiEdge](1) + val g = Graph[Int, DiEdge](1) val root = DotRootGraph( directed = true, id = Some("structs") @@ -240,7 +240,7 @@ class ExportSpec extends RefSpec with Matchers { val cSubGraph = DotSubGraph(branchDOT, "cluster_chained", attrList = List(DotAttr("label", "Chained"))) val iSubGraph = DotSubGraph(branchDOT, "cluster_unchained", attrList = List(DotAttr("label", "UnChained"))) val iNode = "inode" - val dot = g.toDot( + val dot = g.toDot( dotRoot = root, edgeTransformer = _ => Some((root, DotEdgeStmt("hi", "guys"))), cNodeTransformer = Some(_ => Some((cSubGraph, DotNodeStmt("cnode")))), diff --git a/json/src/main/scala/scalax/collection/io/json/descriptor/NodeDescriptor.scala b/json/src/main/scala/scalax/collection/io/json/descriptor/NodeDescriptor.scala index 42445689..74de706e 100644 --- a/json/src/main/scala/scalax/collection/io/json/descriptor/NodeDescriptor.scala +++ b/json/src/main/scala/scalax/collection/io/json/descriptor/NodeDescriptor.scala @@ -26,7 +26,7 @@ abstract class NodeDescriptor[+N]( extends TypeId(typeId) { val manifests: Seq[Manifest[_]] = nodeManifest :: furtherManifests - implicit val formats: Formats = Serialization.formats( + implicit val formats: Formats = Serialization.formats( if (extraClasses.isEmpty) NoTypeHints else new ShortTypeHints(extraClasses) ) ++ customSerializers @@ -57,7 +57,7 @@ object StringNodeDescriptor extends NodeDescriptor[String] { case JInt(_) | JDouble(_) => fld.extract[String] case JBool(b) => b.toString case JArray(_) => "(" + mkString(fld.children) + ")" - case JObject(obj) => + case JObject(obj) => val buf = new StringBuilder("(") obj.foldLeft(buf)((buf, o) => buf.append(o.name + "," + mkString(List(o.value)))) buf.append(")").toString diff --git a/json/src/main/scala/scalax/collection/io/json/exp/Export.scala b/json/src/main/scala/scalax/collection/io/json/exp/Export.scala index f75420c7..440f1308 100644 --- a/json/src/main/scala/scalax/collection/io/json/exp/Export.scala +++ b/json/src/main/scala/scalax/collection/io/json/exp/Export.scala @@ -25,7 +25,7 @@ class Export[N, E <: Edge[N]]( } case class NodeValues(classNodes: (String, Set[N])) { - val descr = descriptor.nodeDescriptor(classNodes._2.head) + val descr = descriptor.nodeDescriptor(classNodes._2.head) val jNodes: List[JValue] = (for (node <- classNodes._2) yield descr.decompose(node)).toList diff --git a/json/src/main/scala/scalax/collection/io/json/imp/Stream.scala b/json/src/main/scala/scalax/collection/io/json/imp/Stream.scala index a45b6310..a32252f6 100644 --- a/json/src/main/scala/scalax/collection/io/json/imp/Stream.scala +++ b/json/src/main/scala/scalax/collection/io/json/imp/Stream.scala @@ -20,7 +20,7 @@ object Stream { * referenced by edges; all created nodes are stored in a map prior to passing * them to the Graph in order not to loose their id's. */ - val idMap = collection.mutable.Map.empty[String, N] + val idMap = collection.mutable.Map.empty[String, N] val nodes: Iterable[N] = { val buf = new ArrayBuffer[N](512) for { diff --git a/json/src/test/scala/scalax/collection/io/json/JsonSpec.scala b/json/src/test/scala/scalax/collection/io/json/JsonSpec.scala index 70f11b56..f152936c 100644 --- a/json/src/test/scala/scalax/collection/io/json/JsonSpec.scala +++ b/json/src/test/scala/scalax/collection/io/json/JsonSpec.scala @@ -183,7 +183,7 @@ class Json[CC[N, E <: Edge[N]] <: AnyGraph[N, E] with GraphLike[N, E, CC]]( object `using default edge descriptors` { def `on exporting`(): Unit = { - val g = factory(OneOrMore("B") ~~> OneOrMore("A", "C")) + val g = factory(OneOrMore("B") ~~> OneOrMore("A", "C")) val descriptor = Descriptor.simple[String](StringNodeDescriptor, DiHyper.descriptor[String]()) diff --git a/json/src/test/scala/scalax/collection/io/json/TypedEdgeSpec.scala b/json/src/test/scala/scalax/collection/io/json/TypedEdgeSpec.scala index 9d92b5b1..8123bdec 100644 --- a/json/src/test/scala/scalax/collection/io/json/TypedEdgeSpec.scala +++ b/json/src/test/scala/scalax/collection/io/json/TypedEdgeSpec.scala @@ -72,7 +72,7 @@ private class CustomEdge[CC[N, E <: Edge[N]] <: AnyGraph[N, E] with GraphLike[N, ) } - def `on import`(): Unit = factory.fromJson[String, Transition](jsonText, descriptor) shouldBe graph + def `on import`(): Unit = factory.fromJson[String, Transition](jsonText, descriptor) shouldBe graph def `on reimport`(): Unit = factory.fromJson[String, Transition](graph.toJson(descriptor), descriptor) shouldBe graph } @@ -113,7 +113,7 @@ private class CustomEdge[CC[N, E <: Edge[N]] <: AnyGraph[N, E] with GraphLike[N, } ) - def `on import`(): Unit = factory.fromJson[String, WLHyperEdge](jsonText, descriptor) shouldBe graph + def `on import`(): Unit = factory.fromJson[String, WLHyperEdge](jsonText, descriptor) shouldBe graph def `on reimport`(): Unit = factory.fromJson[String, WLHyperEdge](graph.toJson(descriptor), descriptor) shouldBe graph } @@ -154,7 +154,7 @@ private class CustomEdge[CC[N, E <: Edge[N]] <: AnyGraph[N, E] with GraphLike[N, } ) - def `on import`(): Unit = factory.fromJson[String, WLDiHyperEdge](jsonText, descriptor) shouldBe graph + def `on import`(): Unit = factory.fromJson[String, WLDiHyperEdge](jsonText, descriptor) shouldBe graph def `on reimport`(): Unit = factory.fromJson[String, WLDiHyperEdge](graph.toJson(descriptor), descriptor) shouldBe graph } diff --git a/json/src/test/scala/scalax/collection/io/json/serializer/GraphSerializerSpec.scala b/json/src/test/scala/scalax/collection/io/json/serializer/GraphSerializerSpec.scala index 9971585c..fd2aa2de 100644 --- a/json/src/test/scala/scalax/collection/io/json/serializer/GraphSerializerSpec.scala +++ b/json/src/test/scala/scalax/collection/io/json/serializer/GraphSerializerSpec.scala @@ -42,7 +42,7 @@ private class Serialize[CC[N, E <: Edge[N]] <: AnyGraph[N, E] with GraphLike[N, import ContainedGraphFixture._ private object ContainerFixture { - val container = Container(0, graph) + val container = Container(0, graph) val containerJsonText = """{ "i" : 0, "g" : %s}""" filterNot (_.isWhitespace) format graphJsonText } diff --git a/misc/src/test/scala/scalax/collection/rdf/TTripleDiEdgeTest.scala b/misc/src/test/scala/scalax/collection/rdf/TTripleDiEdgeTest.scala index 7cddd65b..948ee9dc 100644 --- a/misc/src/test/scala/scalax/collection/rdf/TTripleDiEdgeTest.scala +++ b/misc/src/test/scala/scalax/collection/rdf/TTripleDiEdgeTest.scala @@ -12,7 +12,7 @@ class TTripleDiEdgeTest extends RefSpec with Matchers { val (subj_1, subj_2) = (IRI("s-1"), IRI("s-2")) val pred = IRI("p-1") val (obj_1, obj_2) = (Label("l-1"), BlankNode(1)) - val initialTriples = List[Triple[RdfNode]]( + val initialTriples = List[Triple[RdfNode]]( Triple(subj_1, pred, obj_1), Triple(subj_2, pred, obj_2) ) diff --git a/misc/src/test/scala/scalax/collection/rdf/TTripleDiHyperEdgeTest.scala b/misc/src/test/scala/scalax/collection/rdf/TTripleDiHyperEdgeTest.scala index 845c4b7f..26d11733 100644 --- a/misc/src/test/scala/scalax/collection/rdf/TTripleDiHyperEdgeTest.scala +++ b/misc/src/test/scala/scalax/collection/rdf/TTripleDiHyperEdgeTest.scala @@ -12,7 +12,7 @@ class TTripleDiHyperEdgeTest extends RefSpec with Matchers { val (subj_1, subj_2) = (IRI("s-1"), IRI("s-2")) val pred = IRI("p-1") val (obj_1, obj_2) = (Label("l-1"), BlankNode(1)) - val initialTriples = List[Triple[RdfNode]]( + val initialTriples = List[Triple[RdfNode]]( Triple(subj_1, pred, obj_1), Triple(subj_2, pred, obj_2) ) From ef79462d834f34d21cbfa255ef46f299b876d276 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 24 Jun 2025 16:23:35 +0000 Subject: [PATCH 3/3] Add 'Reformat with scalafmt 3.9.7' to .git-blame-ignore-revs --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index a6d22c7f..bc1a2ad1 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -9,3 +9,6 @@ c8ea894cd1f40ce3cc10f61a05be3b4c9ff11516 # Scala Steward: Reformat with scalafmt 3.8.6 832cfd7b56fad7cdf1d4976c19ee1a527487f842 + +# Scala Steward: Reformat with scalafmt 3.9.7 +73c61688a9cc71602d449b7408922144bae7679f