Skip to content

Commit

Permalink
Merge pull request #181 from Philippus/update-stuff
Browse files Browse the repository at this point in the history
Update stuff
  • Loading branch information
Philippus authored Sep 25, 2023
2 parents c6f3767 + e4e7fe2 commit 62771ca
Show file tree
Hide file tree
Showing 8 changed files with 280 additions and 265 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
scala-version: [2.13.12]
scala-version: [2.13.x]
java-version: [8, 11, 17]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: temurin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
Expand Down
10 changes: 9 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
version = 3.7.14

align.preset = none
align.preset = most
literals.double = Upper
literals.float = Upper
maxColumn = 120
newlines.source = keep
rewriteTokens = {
"⇒": "=>"
"→": "->"
"←": "<-"
}
runner.dialect = scala213
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name := "between"
name := "between"
organization := "nl.gn0s1s"
startYear := Some(2018)
homepage := Some(url("https://github.com/philippus/between"))
startYear := Some(2018)
homepage := Some(url("https://github.com/philippus/between"))
licenses += ("MPL-2.0", url("https://www.mozilla.org/MPL/2.0/"))

developers := List(
Expand All @@ -13,13 +13,13 @@ developers := List(
)
)

ThisBuild / versionScheme := Some("semver-spec")
ThisBuild / versionScheme := Some("semver-spec")
ThisBuild / versionPolicyIntention := Compatibility.None

Compile / packageBin / packageOptions += Package.ManifestAttributes("Automatic-Module-Name" -> "nl.gn0s1s.between")

crossScalaVersions := List("2.13.12")
scalaVersion := crossScalaVersions.value.last
scalaVersion := crossScalaVersions.value.last

libraryDependencies ++= Seq(
"org.scalacheck" %% "scalacheck" % "1.17.0" % Test
Expand Down
34 changes: 17 additions & 17 deletions src/main/scala/nl/gn0s1s/between/Interval.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,51 @@ final case class Interval[T] private (`-`: T, `+`: T)(implicit ordering: Orderin
t =>
import ordering.mkOrderingOps

def <(s: Interval[T]): Boolean = t.`+` < s.`-`
def before(s: Interval[T]): Boolean = this < s
def <(s: Interval[T]): Boolean = t.`+` < s.`-`
def before(s: Interval[T]): Boolean = this < s
def precedes(s: Interval[T]): Boolean = this < s

def m(s: Interval[T]): Boolean = t.`+` == s.`-`
def m(s: Interval[T]): Boolean = t.`+` == s.`-`
def meets(s: Interval[T]): Boolean = this m s

def o(s: Interval[T]): Boolean = t.`-` < s.`-` && t.`+` > s.`-` && t.`+` < s.`+`
def o(s: Interval[T]): Boolean = t.`-` < s.`-` && t.`+` > s.`-` && t.`+` < s.`+`
def overlaps(s: Interval[T]): Boolean = this o s

def fi(s: Interval[T]): Boolean = s f this
def fi(s: Interval[T]): Boolean = s f this
def finishedBy(s: Interval[T]): Boolean = s f this
def endedBy(s: Interval[T]): Boolean = s f this
def endedBy(s: Interval[T]): Boolean = s f this

def di(s: Interval[T]): Boolean = s d this
def di(s: Interval[T]): Boolean = s d this
def contains(s: Interval[T]): Boolean = s d this

def s(s: Interval[T]): Boolean = t.`-` == s.`-` && t.`+` < s.`+`
def s(s: Interval[T]): Boolean = t.`-` == s.`-` && t.`+` < s.`+`
def starts(s: Interval[T]): Boolean = this s s

def si(s: Interval[T]): Boolean = s s this
def si(s: Interval[T]): Boolean = s s this
def startedBy(s: Interval[T]): Boolean = s s this

def d(s: Interval[T]): Boolean = t.`-` > s.`-` && t.`+` < s.`+`
def d(s: Interval[T]): Boolean = t.`-` > s.`-` && t.`+` < s.`+`
def during(s: Interval[T]): Boolean = this d s

def f(s: Interval[T]): Boolean = t.`-` > s.`-` && t.`+` == s.`+`
def f(s: Interval[T]): Boolean = t.`-` > s.`-` && t.`+` == s.`+`
def finishes(s: Interval[T]): Boolean = this f s
def ends(s: Interval[T]): Boolean = this f s
def ends(s: Interval[T]): Boolean = this f s

def oi(s: Interval[T]): Boolean = s o this
def oi(s: Interval[T]): Boolean = s o this
def overlappedBy(s: Interval[T]): Boolean = s o this

def mi(s: Interval[T]): Boolean = s m this
def mi(s: Interval[T]): Boolean = s m this
def metBy(s: Interval[T]): Boolean = s m this

def >(s: Interval[T]): Boolean = s < this
def after(s: Interval[T]): Boolean = s < this
def >(s: Interval[T]): Boolean = s < this
def after(s: Interval[T]): Boolean = s < this
def precededBy(s: Interval[T]): Boolean = s < this

def findRelation(s: Interval[T]): Relation = Relation.findRelation[T](this, s)

def abuts(s: Interval[T]): Boolean = (this m s) || (this mi s)

def encloses(s: Interval[T]): Boolean = (this di s) || (this == s) || (this si s) || (this fi s)
def encloses(s: Interval[T]): Boolean = (this di s) || (this == s) || (this si s) || (this fi s)
def enclosedBy(s: Interval[T]): Boolean = (this d s) || (this == s) || (this s s) || (this f s)

def gap(s: Interval[T]): Option[Interval[T]] =
Expand Down
Loading

0 comments on commit 62771ca

Please sign in to comment.