-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
166 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
object ScalaVersions { | ||
val v212 = "2.12.13" | ||
val v213 = "2.13.6" | ||
val v3 = "3.0.0" | ||
} |
28 changes: 28 additions & 0 deletions
28
stringdiff/src/main/scala-2.12/app/tulz/diff/compat/IndexedSeqView.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package app.tulz.diff | ||
package compat | ||
|
||
import scala.collection.SeqView | ||
import scala.collection.immutable.Range | ||
|
||
class IndexedSeqView[A]( | ||
private[compat] val underlying: SeqView[A, _] | ||
) { | ||
def apply(index: Int): A = underlying(index) | ||
|
||
def size: Int = underlying.length | ||
|
||
def isEmpty: Boolean = underlying.isEmpty | ||
|
||
def concat(other: IndexedSeqView[A]): IndexedSeqView[A] = | ||
new IndexedSeqView((underlying ++ other.underlying).view) | ||
|
||
def take(n: Int): IndexedSeqView[A] = new IndexedSeqView(underlying.take(n)) | ||
|
||
def slice(from: Int, until: Int): IndexedSeqView[A] = new IndexedSeqView(underlying.slice(from, until)) | ||
|
||
def toIndexedSeq: IndexedSeq[A] = underlying.toIndexedSeq | ||
|
||
def indices: Range = underlying.indices | ||
|
||
def forall(predicate: A => Boolean): Boolean = underlying.forall(predicate) | ||
} |
9 changes: 9 additions & 0 deletions
9
stringdiff/src/main/scala-2.12/app/tulz/diff/compat/IndexedSeqViewOfCharOps.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package app.tulz.diff.compat | ||
|
||
class IndexedSeqViewOfCharOps( | ||
underlying: IndexedSeqView[Char] | ||
) { | ||
|
||
def mkString: String = underlying.underlying.mkString | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
stringdiff/src/main/scala-2.12/app/tulz/diff/compat/IndexedSeqViewOfStringOps.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package app.tulz.diff.compat | ||
|
||
class IndexedSeqViewOfStringOps( | ||
underlying: IndexedSeqView[String] | ||
) { | ||
|
||
def mkString: String = underlying.underlying.mkString | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
stringdiff/src/main/scala-2.12/app/tulz/diff/compat/package.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package app.tulz.diff | ||
|
||
import scala.collection.SeqView | ||
import scala.language.implicitConversions | ||
|
||
package object compat { | ||
|
||
implicit def indexedSeq_ViewToIndexedSeqView[A]( | ||
underlying: SeqView[A, IndexedSeq[A]] | ||
): IndexedSeqView[A] = new IndexedSeqView[A](underlying) | ||
|
||
implicit def string_ViewToIndexedSeqView( | ||
underlying: SeqView[Char, String] | ||
): IndexedSeqView[Char] = new IndexedSeqView[Char](underlying) | ||
|
||
implicit def indexedSeqViewOfCharOps( | ||
underlying: IndexedSeqView[Char] | ||
): IndexedSeqViewOfCharOps = new IndexedSeqViewOfCharOps(underlying) | ||
|
||
implicit def indexedSeqViewOfStringOps( | ||
underlying: IndexedSeqView[String] | ||
): IndexedSeqViewOfStringOps = new IndexedSeqViewOfStringOps(underlying) | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
stringdiff/src/main/scala-2.13/app/tulz/diff/compat/package.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package app.tulz.diff | ||
|
||
package object compat { | ||
|
||
type IndexedSeqView[+A] = scala.collection.IndexedSeqView[A] | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
stringdiff/src/main/scala-3/app/tulz/diff/compat/package.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package app.tulz.diff | ||
|
||
package object compat { | ||
|
||
type IndexedSeqView[+A] = scala.collection.IndexedSeqView[A] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 8 additions & 9 deletions
17
stringdiff/src/main/scala/app/tulz/diff/util/DiffCollapse.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.