Skip to content

Commit

Permalink
Merge 1d4bf3d into b2bcf8a
Browse files Browse the repository at this point in the history
  • Loading branch information
i10416 authored Mar 4, 2023
2 parents b2bcf8a + 1d4bf3d commit b4f663c
Show file tree
Hide file tree
Showing 99 changed files with 15,020 additions and 116 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ sonatype.sbt
BUILD
target/
lib_managed/
project/metals.sbt
project/boot/
project/build/target/
project/plugins/target/
Expand Down
5 changes: 4 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
version=3.6.0
runner.dialect = scala212
fileOverride {
"glob:**/scala-2.13*/**" {
"glob:**/scala-3/**" {
runner.dialect = scala3
}
"glob:**/scala-2*/**" {
runner.dialect = scala213
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object Aggregator extends java.io.Serializable {
* This is a trivial aggregator that always returns a single value
*/
def const[T](t: T): MonoidAggregator[Any, Unit, T] =
prepareMonoid { _: Any => () }.andThenPresent(_ => t)
prepareMonoid((_: Any) => ()).andThenPresent(_ => t)

/**
* Using Aggregator.prepare,present you can add to this aggregator
Expand Down Expand Up @@ -172,7 +172,7 @@ object Aggregator extends java.io.Serializable {
* How many items satisfy a predicate
*/
def count[T](pred: T => Boolean): MonoidAggregator[T, Long, Long] =
prepareMonoid { t: T => if (pred(t)) 1L else 0L }
prepareMonoid((t: T) => if (pred(t)) 1L else 0L)

/**
* Do any items satisfy some predicate
Expand Down Expand Up @@ -310,7 +310,7 @@ object Aggregator extends java.io.Serializable {
* Put everything in a Set. Note, this could fill the memory if the Set is very large.
*/
def toSet[T]: MonoidAggregator[T, Set[T], Set[T]] =
prepareMonoid { t: T => Set(t) }
prepareMonoid((t: T) => Set(t))

/**
* This builds an in-memory Set, and then finally gets the size of that set. This may not be scalable if the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ class CMSSummation[K](params: CMSParams[K]) {
val rit = matrix.iterator
while (rit.hasNext) {
var col = 0
val cit = rit.next.iterator
val cit = rit.next().iterator
while (cit.hasNext) {
cells(offset + col) += cit.next
cells(offset + col) += cit.next()
col += 1
}
offset += width
Expand All @@ -206,7 +206,7 @@ class CMSSummation[K](params: CMSParams[K]) {
b += cells(offset + col)
col += 1
}
b.result
b.result()
}

val b = Vector.newBuilder[Vector[Long]]
Expand All @@ -215,7 +215,7 @@ class CMSSummation[K](params: CMSParams[K]) {
b += vectorize(row)
row += 1
}
CMSInstance(CMSInstance.CountsTable(b.result), totalCount, params)
CMSInstance(CMSInstance.CountsTable(b.result()), totalCount, params)
}
}

Expand Down Expand Up @@ -724,7 +724,7 @@ case class CMSInstance[K](
val it = countsTable.counts.iterator
var i = 0
while (it.hasNext) {
val row = it.next
val row = it.next()
val count = row(hs(i)(item))
if (count < freq) freq = count
i += 1
Expand Down Expand Up @@ -817,13 +817,13 @@ object CMSInstance {
val yss = other.counts.iterator
val rows = Vector.newBuilder[Vector[Long]]
while (xss.hasNext) {
val xs = xss.next.iterator
val ys = yss.next.iterator
val xs = xss.next().iterator
val ys = yss.next().iterator
val row = Vector.newBuilder[Long]
while (xs.hasNext) row += (xs.next + ys.next)
rows += row.result
while (xs.hasNext) row += (xs.next() + ys.next())
rows += row.result()
}
CountsTable[K](rows.result)
CountsTable[K](rows.result())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ final class DecayingCMS[K](
val hashFns: Array[K => Int] = {
val rng = new Random(seed)
def genPos(): Int =
rng.nextInt match {
rng.nextInt() match {
case 0 => genPos()
case n => n & 0x7fffffff
}
Expand Down Expand Up @@ -323,10 +323,10 @@ final class DecayingCMS[K](
var i = 0
while (i < cells.length) {
val it = cells(i).iterator
var localMax = it.next // we know it doesn't start empty
var localMax = it.next() // we know it doesn't start empty
if (localMax < minMinimum) minMinimum = localMax
while (it.hasNext) {
val n = it.next
val n = it.next()
if (n > localMax) localMax = n
else if (n < minMinimum) minMinimum = n
}
Expand Down Expand Up @@ -362,7 +362,7 @@ final class DecayingCMS[K](
val it0 = this.cells(i).iterator
val it1 = that.cells(i).iterator
while (it0.hasNext) {
val x = it0.next * it1.next
val x = it0.next() * it1.next()
if (x != 0.0) sum += x
}
if (sum < res) res = sum
Expand Down Expand Up @@ -426,7 +426,7 @@ final class DecayingCMS[K](
val x = this
val y = other
val timeInHL = Math.max(x.timeInHL, y.timeInHL)
val cms = new CMS(allocCells, 0.0, timeInHL)
val cms = new CMS(allocCells(), 0.0, timeInHL)

val xscale = x.getScale(timeInHL)
val yscale = y.getScale(timeInHL)
Expand All @@ -445,7 +445,7 @@ final class DecayingCMS[K](
bldr += prod(left(j), xscale) + prod(right(j), yscale)
j += 1
}
cms.cells(i) = bldr.result
cms.cells(i) = bldr.result()
i += 1
}
cms
Expand Down Expand Up @@ -505,7 +505,7 @@ final class DecayingCMS[K](
if (expL == 0.0) {
new CMS(monoid.zero.cells, 0.0, ts)
} else {
val cms = new CMS(allocCells, 0.0, ts)
val cms = new CMS(allocCells(), 0.0, ts)
var i = 0
while (i < depth) {
val ci = cells(i)
Expand Down Expand Up @@ -547,7 +547,7 @@ final class DecayingCMS[K](
bldr += scratch(j)
j += 1
}
cells(i) = bldr.result
cells(i) = bldr.result()
i += 1
}
cells
Expand Down Expand Up @@ -606,7 +606,7 @@ final class DecayingCMS[K](
val arr = new Array[CMS](ChunkSize)
while (it.hasNext) {
while (it.hasNext && i < ChunkSize) {
arr(i) = it.next
arr(i) = it.next()
i += 1
}
if (i > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ sealed trait Fold[-I, +O] extends Serializable {
val self = this
new Fold[I, P] {
type X = self.X
override def build: FoldState[X, I, P] =
self.build.map(f)
override def build(): FoldState[X, I, P] =
self.build().map(f)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ object MapAlgebra {
} else oldVOpt.get
bldr += v
}
mutable.iterator.map { case (k, bldr) => (k, bldr.result) }.toMap
mutable.iterator.map { case (k, bldr) => (k, bldr.result()) }.toMap
}

// Consider this as edges from k -> v, produce a Map[K,Set[V]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ sealed abstract class Scan[-I, +O] extends Serializable {
def scanIterator(iter: Iterator[I]): Iterator[O] = new AbstractIterator[O] {
override def hasNext: Boolean = iter.hasNext
var state: State = initialState
override def next: O = {
override def next(): O = {
val thisState = state
val thisA = iter.next
val thisA = iter.next()
val (thisC, nextState) = presentAndNextState(thisA, thisState)
state = nextState
thisC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ object SpaceSaver {
buff.putLong(b)
buffer ++= buff.array()
}
buffer.result.toArray
buffer.result().toArray
}

// Make sure to be reversible so fromBytes(toBytes(x)) == x
Expand Down
Loading

0 comments on commit b4f663c

Please sign in to comment.