updae for scala 2.13 changes

This commit is contained in:
Michael D. McCray 2020-03-29 12:37:53 -05:00
parent 95e33fd0d7
commit 7c00f26760
2 changed files with 13 additions and 8 deletions

View File

@ -2,7 +2,7 @@ package org.gerweck.scalafx.akka
import language.implicitConversions
import scala.collection.generic.{ Clearable, Growable }
import scala.collection.mutable.{ Clearable, Growable }
import scala.concurrent._
import scala.concurrent.duration._
import scala.util._

View File

@ -6,19 +6,24 @@ import java.util.function.{ Predicate => JPredicate }
import scalafx.beans.property._
import scalafx.beans.value._
import scalafx.collections._
import scalafx.collections.transformation._
import scalafx.collections.ObservableSet
import scalafx.collections.ObservableArray
import scalafx.collections.ObservableBuffer
import scalafx.collections.transformation.FilteredBuffer
import scala.collection.immutable.ArraySeq
sealed trait ToFlatObservable[-A, +B] extends Calculable[A, B]
object ToFlatObservable extends CalculableObservable[ToFlatObservable[_, _]] {
implicit def obOps[A] = new ToFlatObservable[ObservableBuffer[A], Seq[A]] {
def recalculate(oba: ObservableBuffer[A]) = oba.toVector
override def recalculate(oba: ObservableBuffer[A]) = oba.toVector
}
implicit def oaOps[A] = new ToFlatObservable[ObservableArray[A, _, _], Seq[A]] {
def recalculate(oaa: ObservableArray[A, _, _]) = oaa.toVector
override def recalculate(oaa: ObservableArray[A, _, _]) = {
ArraySeq.unsafeWrapArray(oaa.toArray)
}
}
implicit def osOps[A] = new ToFlatObservable[ObservableSet[A], collection.immutable.Set[A]] {
def recalculate(os: ObservableSet[A]) = os.toSet
override def recalculate(os: ObservableSet[A]) = os.toSet
}
}
@ -45,11 +50,11 @@ final class RichObservableBuffer[A](val obs: ObservableBuffer[A]) extends AnyVal
def observableSize = ObservableSized.toObservable(obs)
def observeFiltered(predicate: A => Boolean) = {
new transformation.FilteredBuffer(obs, predicate)
new FilteredBuffer(obs, predicate)
}
/* The dummy implicit is here to ensure the `observeFiltered` methods all have different post-erasure types */
def observeFiltered[B >: A](predicate: ObservableValue[JPredicate[B], JPredicate[B]])(implicit dummy: DummyImplicit): FilteredBuffer[A] = {
val fb = new transformation.FilteredBuffer(obs)
val fb = new FilteredBuffer(obs)
fb.predicate <== predicate
fb
}