Skip to content

Commit

Permalink
apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-git committed May 21, 2024
1 parent 647a2a8 commit ebe1c12
Show file tree
Hide file tree
Showing 6 changed files with 526 additions and 740 deletions.
18 changes: 9 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import Dependencies._

name := "resource-pool"

organization := "com.evolution"
organizationName := "Evolution"
organization := "com.evolution"
organizationName := "Evolution"
organizationHomepage := Some(url("https://evolution.com"))
homepage := Some(url("https://github.com/evolution-gaming/resource-pool"))
startYear := Some(2023)
homepage := Some(url("https://github.com/evolution-gaming/resource-pool"))
startYear := Some(2023)

crossScalaVersions := Seq("2.13.14")
scalaVersion := crossScalaVersions.value.head
scalaVersion := crossScalaVersions.value.head
scalacOptions ++= Seq("-release:17", "-Xsource:3", "-deprecation", "-Wunused:imports")

releaseCrossBuild := true
autoAPIMappings := true
versionScheme := Some("early-semver")
publishTo := Some(Resolver.evolutionReleases)
releaseCrossBuild := true
autoAPIMappings := true
versionScheme := Some("early-semver")
publishTo := Some(Resolver.evolutionReleases)
versionPolicyIntention := Compatibility.BinaryCompatible // sbt-version-policy

libraryDependencies += compilerPlugin(`kind-projector` cross CrossVersion.full)
Expand Down
10 changes: 3 additions & 7 deletions src/main/scala/com/evolution/resourcepool/IntHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,25 @@ private[resourcepool] object IntHelper {

implicit class IntOpsIntHelper(val self: Int) extends AnyVal {

def divide(value: Int): List[Int] = {
def divide(value: Int): List[Int] =
if (value <= 0 || self <= 0) {
List.empty
} else if (value >= self) {
List.fill(self)(1)
} else if (value == 1) {
List(self)
} else {
val quotient = (self.toDouble / value)
.round
.toInt
val quotient = (self.toDouble / value).round.toInt

@tailrec
def loop(self: Int, value: Int, result: List[Int]): List[Int] = {
def loop(self: Int, value: Int, result: List[Int]): List[Int] =
if (self > quotient && value > 1) {
loop(self - quotient, value - 1, quotient :: result)
} else {
(self :: result).reverse
}
}

loop(self, value, List.empty)
}
}
}
}
Loading

0 comments on commit ebe1c12

Please sign in to comment.