diff --git a/Historical/Multiversion Distributed/benchmarks/src/main/scala/rescala/benchmarks/distributed/rtt/ConflictDistances.scala b/Historical/Multiversion Distributed/benchmarks/src/main/scala/rescala/benchmarks/distributed/rtt/ConflictDistances.scala index 709814aab..63c374f5f 100644 --- a/Historical/Multiversion Distributed/benchmarks/src/main/scala/rescala/benchmarks/distributed/rtt/ConflictDistances.scala +++ b/Historical/Multiversion Distributed/benchmarks/src/main/scala/rescala/benchmarks/distributed/rtt/ConflictDistances.scala @@ -3,9 +3,7 @@ package reactives.benchmarks.distributed.rtt import java.util.concurrent._ import org.openjdk.jmh.annotations._ import reactives.core.ReInfo -import reactives.fullmv.DistributedFullMVApi.{ - FullMVEngine, ReactiveLocalClone, Signal, Signals, Var, scopedScheduler, transactionWithWrapup -} +import reactives.fullmv.DistributedFullMVApi.{FullMVEngine, ReactiveLocalClone, Signal, Signals, Var, scopedScheduler, transactionWithWrapup} import reactives.fullmv.mirrors.localcloning.FakeDelayer import scala.concurrent.duration._ diff --git a/Historical/Multiversion Distributed/benchmarks/src/main/scala/rescala/benchmarks/distributed/rtt/Remerge.scala b/Historical/Multiversion Distributed/benchmarks/src/main/scala/rescala/benchmarks/distributed/rtt/Remerge.scala index 6b554fee8..42478391c 100644 --- a/Historical/Multiversion Distributed/benchmarks/src/main/scala/rescala/benchmarks/distributed/rtt/Remerge.scala +++ b/Historical/Multiversion Distributed/benchmarks/src/main/scala/rescala/benchmarks/distributed/rtt/Remerge.scala @@ -2,9 +2,7 @@ package reactives.benchmarks.distributed.rtt import org.openjdk.jmh.annotations._ import reactives.core.ReInfo -import reactives.fullmv.DistributedFullMVApi.{ - FullMVEngine, ReactiveLocalClone, Signal, Signals, Var, scopedScheduler, transactionWithWrapup -} +import reactives.fullmv.DistributedFullMVApi.{FullMVEngine, ReactiveLocalClone, Signal, Signals, Var, scopedScheduler, transactionWithWrapup} import reactives.fullmv.mirrors.localcloning.FakeDelayer import java.util.concurrent._ diff --git a/Historical/Multiversion Distributed/multiversion/src/main/scala/rescala/fullmv/mirrors/localcloning/FullMVTurnLocalClone.scala b/Historical/Multiversion Distributed/multiversion/src/main/scala/rescala/fullmv/mirrors/localcloning/FullMVTurnLocalClone.scala index 6808ec327..61c40271e 100644 --- a/Historical/Multiversion Distributed/multiversion/src/main/scala/rescala/fullmv/mirrors/localcloning/FullMVTurnLocalClone.scala +++ b/Historical/Multiversion Distributed/multiversion/src/main/scala/rescala/fullmv/mirrors/localcloning/FullMVTurnLocalClone.scala @@ -3,9 +3,7 @@ package reactives.fullmv.mirrors.localcloning import reactives.fullmv.mirrors._ import reactives.fullmv.sgt.synchronization._ import reactives.fullmv.tasks.TaskBundle -import reactives.fullmv.{ - FullMVBundle, FullMVUtil, FullMvStateBundle, TransactionSpanningTreeNode, TurnImplBundle, TurnPhase -} +import reactives.fullmv.{FullMVBundle, FullMVUtil, FullMvStateBundle, TransactionSpanningTreeNode, TurnImplBundle, TurnPhase} import scala.concurrent.Future import scala.concurrent.duration.Duration diff --git a/Modules/Channels/js/src/main/scala/channel/webrtc/ConnectionArea.scala b/Modules/Channels/js/src/main/scala/channel/webrtc/ConnectionArea.scala index 7b54bdf4e..ffa04199c 100644 --- a/Modules/Channels/js/src/main/scala/channel/webrtc/ConnectionArea.scala +++ b/Modules/Channels/js/src/main/scala/channel/webrtc/ConnectionArea.scala @@ -8,9 +8,7 @@ import de.rmgk.delay.syntax.toAsync import de.rmgk.delay.{Async, Callback} import org.scalajs.dom import org.scalajs.dom.html.{Div, Input, Table} -import org.scalajs.dom.{ - MouseEvent, RTCIceConnectionState, RTCIceGatheringState, RTCIceServer, UIEvent, document, window -} +import org.scalajs.dom.{MouseEvent, RTCIceConnectionState, RTCIceGatheringState, RTCIceServer, UIEvent, document, window} import scalatags.JsDom.all.* import scalatags.JsDom.tags2.section diff --git a/Modules/Channels/js/src/main/scala/channel/webrtc/WebRTCConnector.scala b/Modules/Channels/js/src/main/scala/channel/webrtc/WebRTCConnector.scala index 81c026b51..c939c1526 100644 --- a/Modules/Channels/js/src/main/scala/channel/webrtc/WebRTCConnector.scala +++ b/Modules/Channels/js/src/main/scala/channel/webrtc/WebRTCConnector.scala @@ -5,10 +5,7 @@ import channel.{InChan, JsArrayBufferMessageBuffer, MessageBuffer, OutChan, Prod import de.rmgk.delay import de.rmgk.delay.{Async, Sync, syntax} import org.scalajs.dom -import org.scalajs.dom.{ - RTCConfiguration, RTCIceCandidate, RTCIceConnectionState, RTCIceGatheringState, RTCSessionDescription, - RTCSignalingState -} +import org.scalajs.dom.{RTCConfiguration, RTCIceCandidate, RTCIceConnectionState, RTCIceGatheringState, RTCSessionDescription, RTCSignalingState} import scala.annotation.nowarn import scala.concurrent.ExecutionContext.Implicits.global diff --git a/Modules/Channels/jvm/src/main/scala/channel/udp/UDP.scala b/Modules/Channels/jvm/src/main/scala/channel/udp/UDP.scala index cbfedfb57..242edd005 100644 --- a/Modules/Channels/jvm/src/main/scala/channel/udp/UDP.scala +++ b/Modules/Channels/jvm/src/main/scala/channel/udp/UDP.scala @@ -4,10 +4,7 @@ import channel.{ArrayMessageBuffer, BiChan, InChan, MessageBuffer, OutChan, Prod import de.rmgk.delay.Async import java.io.{BufferedInputStream, BufferedOutputStream, IOException} -import java.net.{ - DatagramPacket, DatagramSocket, InetAddress, InetSocketAddress, ServerSocket, Socket, SocketAddress, SocketException, - SocketTimeoutException -} +import java.net.{DatagramPacket, DatagramSocket, InetAddress, InetSocketAddress, ServerSocket, Socket, SocketAddress, SocketException, SocketTimeoutException} import java.util.concurrent.{Executors, ScheduledFuture, ThreadFactory, TimeUnit} import scala.collection.mutable import scala.concurrent.duration.Duration diff --git a/Modules/Example EncryptedTodoFx/src/main/scala/benchmarks/encrdt/ToDoAppBenchmark.scala b/Modules/Example EncryptedTodoFx/src/main/scala/benchmarks/encrdt/ToDoAppBenchmark.scala index dd68c972e..8b6a8a8a4 100644 --- a/Modules/Example EncryptedTodoFx/src/main/scala/benchmarks/encrdt/ToDoAppBenchmark.scala +++ b/Modules/Example EncryptedTodoFx/src/main/scala/benchmarks/encrdt/ToDoAppBenchmark.scala @@ -1,12 +1,8 @@ package benchmarks.encrdt import benchmarks.encrdt.mock.insecure.{AlternativeInsecureToDoListClient, AlternativeInsecureToDoListIntermediary} -import benchmarks.encrdt.mock.{ - DisseminationStats, IntermediarySizeInfo, SecureToDoListClient, ToDoListClient, ToDoListIntermediary -} -import benchmarks.encrdt.todolist.{ - AddToDoItem, CompleteToDoItem, RemoveToDoItems, ToDoEntry, ToDoListInteraction, ToDoListInteractionGenerator -} +import benchmarks.encrdt.mock.{DisseminationStats, IntermediarySizeInfo, SecureToDoListClient, ToDoListClient, ToDoListIntermediary} +import benchmarks.encrdt.todolist.{AddToDoItem, CompleteToDoItem, RemoveToDoItems, ToDoEntry, ToDoListInteraction, ToDoListInteractionGenerator} import com.google.crypto.tink.Aead import Codecs.* import encrdtlib.container.DeltaAddWinsLastWriterWinsMap diff --git a/Modules/Example Misc 2015/src/main/scala/reswing/reshapes/ReShapes.scala b/Modules/Example Misc 2015/src/main/scala/reswing/reshapes/ReShapes.scala index 649edf852..2b9749c0d 100644 --- a/Modules/Example Misc 2015/src/main/scala/reswing/reshapes/ReShapes.scala +++ b/Modules/Example Misc 2015/src/main/scala/reswing/reshapes/ReShapes.scala @@ -8,10 +8,7 @@ import reswing.reshapes.actions.{LoadAction, SaveAction} import reswing.reshapes.drawing.{Command, DrawingSpaceState, MergeDrawingSpaces, NetworkSpaceState} import reswing.reshapes.figures.Shape import reswing.reshapes.ui.dialogs.{NewTabDialog, ServerDialog} -import reswing.reshapes.ui.panels.{ - CommandPanel, DrawingPanel, InfoPanel, ShapePanel, ShapeSelectionPanel, ShowCoordinateSystem, ShowIntersection, - ShowNameLabels, StrokeInputPanel -} +import reswing.reshapes.ui.panels.{CommandPanel, DrawingPanel, InfoPanel, ShapePanel, ShapeSelectionPanel, ShowCoordinateSystem, ShowIntersection, ShowNameLabels, StrokeInputPanel} import reswing.reshapes.util.ReactiveUtil.{UnionEvent, bilateralValues} import reswing.ReMenuItem.toMenuItem import reswing.{ReMenu, ReMenuItem, ReSwingValue} @@ -19,10 +16,7 @@ import reswing.{ReMenu, ReMenuItem, ReSwingValue} import scala.collection.mutable.HashMap import scala.swing.BorderPanel.Position import scala.swing.TabbedPane.Page -import scala.swing.{ - Action, BorderPanel, Component, Dimension, MainFrame, Menu, MenuBar, MenuItem, Separator, SimpleSwingApplication, - Swing, TabbedPane -} +import scala.swing.{Action, BorderPanel, Component, Dimension, MainFrame, Menu, MenuBar, MenuItem, Separator, SimpleSwingApplication, Swing, TabbedPane} import scala.swing.event.SelectionChanged object ReShapes extends SimpleSwingApplication { diff --git a/Modules/Example ReactiveLenses/src/main/scala/copl/ConversionTest.scala b/Modules/Example ReactiveLenses/src/main/scala/copl/ConversionTest.scala index 133dd7c7d..8a60da8e1 100644 --- a/Modules/Example ReactiveLenses/src/main/scala/copl/ConversionTest.scala +++ b/Modules/Example ReactiveLenses/src/main/scala/copl/ConversionTest.scala @@ -22,77 +22,82 @@ object ConversionTest { () } - - /** - * Contains all supported units with their conversion from Celsius. To add support for a unit, simply add it to the - * enum with the lens representing the corresponding conversion - * @param lens the conversion lens from Celsius - */ + /** Contains all supported units with their conversion from Celsius. To add support for a unit, simply add it to the + * enum with the lens representing the corresponding conversion + * @param lens the conversion lens from Celsius + */ enum TempConversion(val lens: BijectiveLens[Double, Double]): - //All Conversions are given from Celsius + // All Conversions are given from Celsius case C extends TempConversion(new NeutralLens) case K extends TempConversion(new AddLens(274.15)) case L extends TempConversion(new AddLens(253)) case F extends TempConversion(new MulLens(1.8).compose(new AddLens(32.0))) end TempConversion - /** - * Creates a lens which converts between any supported units - */ - def conversionLens(from : TempConversion, to : TempConversion): BijectiveLens[Double, Double] = from.lens.inverse.compose(to.lens) + /** Creates a lens which converts between any supported units */ + def conversionLens(from: TempConversion, to: TempConversion): BijectiveLens[Double, Double] = + from.lens.inverse.compose(to.lens) - /** - * A demonstration of reactive lenses using a simple unit converter for temperature units - */ + /** A demonstration of reactive lenses using a simple unit converter for temperature units */ def unitConverter() = { - //Create selection for units and convert selected units to signals - val leftUnitInput: TypedTag[Select] = select(TempConversion.values.map{ unit => option(unit.toString) }) - val (leftUnitEvent: Event[String], renderedLeftUnit: Select) = RenderUtil.dropDownHandler(leftUnitInput, oninput, clear = false) - val leftUnitSignal: Signal[TempConversion] = leftUnitEvent.hold(init = renderedLeftUnit.value).map{TempConversion.valueOf(_)} + // Create selection for units and convert selected units to signals + val leftUnitInput: TypedTag[Select] = select(TempConversion.values.map { unit => option(unit.toString) }) + val (leftUnitEvent: Event[String], renderedLeftUnit: Select) = + RenderUtil.dropDownHandler(leftUnitInput, oninput, clear = false) + val leftUnitSignal: Signal[TempConversion] = + leftUnitEvent.hold(init = renderedLeftUnit.value).map { TempConversion.valueOf(_) } val rightUnitInput: TypedTag[Select] = select(TempConversion.values.map { unit => option(unit.toString) }) - val (rightUnitEvent: Event[String], renderedRightUnit: Select) = RenderUtil.dropDownHandler(rightUnitInput, oninput, clear = false) - val rightUnitSignal: Signal[TempConversion] = rightUnitEvent.hold(init = renderedRightUnit.value).map{TempConversion.valueOf(_)} + val (rightUnitEvent: Event[String], renderedRightUnit: Select) = + RenderUtil.dropDownHandler(rightUnitInput, oninput, clear = false) + val rightUnitSignal: Signal[TempConversion] = + rightUnitEvent.hold(init = renderedRightUnit.value).map { TempConversion.valueOf(_) } - //Create the two LVars containing the left and right value using reactive lenses. - val leftVar = LVar(0.0) - val rightVar = leftVar.applyLens(SignalLens(Signal{conversionLens(leftUnitSignal.value, rightUnitSignal.value)})) + // Create the two LVars containing the left and right value using reactive lenses. + val leftVar = LVar(0.0) + val rightVar = leftVar.applyLens(SignalLens(Signal { conversionLens(leftUnitSignal.value, rightUnitSignal.value) })) - //Create text fields and input events for the values + // Create text fields and input events for the values val leftValueInput: TypedTag[Input] = input(value := leftVar.now) - val (leftValueEvent: Event[String], renderedLeftValue: Input) = RenderUtil.inputFieldHandler(leftValueInput, oninput, clear = false) + val (leftValueEvent: Event[String], renderedLeftValue: Input) = + RenderUtil.inputFieldHandler(leftValueInput, oninput, clear = false) val rightValueInput: TypedTag[Input] = input(value := rightVar.now) - val (rightValueEvent: Event[String], renderedRightValue: Input) = RenderUtil.inputFieldHandler(rightValueInput, oninput, clear = false) - - //Register input events as source of change for LVars - leftVar.fire(leftValueEvent.map{toDoubleOr0(_)}) - rightVar.fire(rightValueEvent.map{toDoubleOr0(_)}) - - //Observe LVars to update UI - leftVar.observe{ value => RenderUtil.setInputDisplay(renderedLeftValue, value.toString) } - rightVar.observe{ value => RenderUtil.setInputDisplay(renderedRightValue, value.toString) } - - //Combine all UI elements - div(p("Unit Conversion with Lenses"), renderedLeftUnit, renderedRightUnit, br , renderedLeftValue, renderedRightValue) + val (rightValueEvent: Event[String], renderedRightValue: Input) = + RenderUtil.inputFieldHandler(rightValueInput, oninput, clear = false) + + // Register input events as source of change for LVars + leftVar.fire(leftValueEvent.map { toDoubleOr0(_) }) + rightVar.fire(rightValueEvent.map { toDoubleOr0(_) }) + + // Observe LVars to update UI + leftVar.observe { value => RenderUtil.setInputDisplay(renderedLeftValue, value.toString) } + rightVar.observe { value => RenderUtil.setInputDisplay(renderedRightValue, value.toString) } + + // Combine all UI elements + div( + p("Unit Conversion with Lenses"), + renderedLeftUnit, + renderedRightUnit, + br, + renderedLeftValue, + renderedRightValue + ) } - /** - * Returns the double represented by the string or 0 if no double is represented - */ - def toDoubleOr0(str : String): Double = { + /** Returns the double represented by the string or 0 if no double is represented */ + def toDoubleOr0(str: String): Double = { try { - {str.toDouble} + { str.toDouble } } catch { - case _ => {0.0} + case _ => { 0.0 } } } - /** - * A demonstration of the effect of declaration order on event execution if an event effects multiple LVars in the same - * cluster. When inverting the definition of b and c, the output changes. - */ + /** A demonstration of the effect of declaration order on event execution if an event effects multiple LVars in the same + * cluster. When inverting the definition of b and c, the output changes. + */ def raceConditionTest(): Unit = { val a = LVar(0) val b = a.applyLens(new AddLens(1)) diff --git a/Modules/Example ReactiveLenses/src/main/scala/copl/RenderUtil.scala b/Modules/Example ReactiveLenses/src/main/scala/copl/RenderUtil.scala index bf267624b..55d485458 100644 --- a/Modules/Example ReactiveLenses/src/main/scala/copl/RenderUtil.scala +++ b/Modules/Example ReactiveLenses/src/main/scala/copl/RenderUtil.scala @@ -8,7 +8,7 @@ import scalatags.JsDom.{Attr, TypedTag} object RenderUtil { def inputFieldHandler(tag: TypedTag[Input], attr: Attr, clear: Boolean = true): (Event[String], Input) = { - val handler = Event.fromCallback(tag(attr := Event.handle[UIEvent])) + val handler = Event.fromCallback(tag(attr := Event.handle[UIEvent])) val todoInputField: Input = handler.data.render // observer to prevent form submit and empty content @@ -24,7 +24,7 @@ object RenderUtil { } def dropDownHandler(tag: TypedTag[Select], attr: Attr, clear: Boolean = true): (Event[String], Select) = { - val handler = Event.fromCallback(tag(attr := Event.handle[UIEvent])) + val handler = Event.fromCallback(tag(attr := Event.handle[UIEvent])) val todoInputField: Select = handler.data.render // // observer to prevent form submit and empty content @@ -39,7 +39,7 @@ object RenderUtil { (inputFieldText, todoInputField) } - def setInputDisplay(in : Input, text : String): Unit = { + def setInputDisplay(in: Input, text: String): Unit = { in.value = text } } diff --git a/Modules/Example Replication/jvm/src/main/scala/replication/dtn/dtn.scala b/Modules/Example Replication/jvm/src/main/scala/replication/dtn/dtn.scala index 86e57b295..381683ddb 100644 --- a/Modules/Example Replication/jvm/src/main/scala/replication/dtn/dtn.scala +++ b/Modules/Example Replication/jvm/src/main/scala/replication/dtn/dtn.scala @@ -149,7 +149,7 @@ def run(): Unit = val nodeId = sget(URI.create(s"$api/status/nodeid")).bind sget(URI.create(s"$api/register?$service")).bind - val replica = Replica(Uid.gen(), nodeId, service, PosNegCounter.zero) + val replica = Replica(Uid.gen(), nodeId, service, PosNegCounter.zero) given LocalReplicaId = replica.id val bundleString = sget(URI.create(s"$api/status/bundles")).bind diff --git a/Modules/Example Replication/jvm/src/main/scala/replication/protocols/Paxos.scala b/Modules/Example Replication/jvm/src/main/scala/replication/protocols/Paxos.scala index 2c56ff2ae..970a96eb0 100644 --- a/Modules/Example Replication/jvm/src/main/scala/replication/protocols/Paxos.scala +++ b/Modules/Example Replication/jvm/src/main/scala/replication/protocols/Paxos.scala @@ -99,7 +99,7 @@ case class Paxos[A, N <: Int]( else Paxos.unchanged - def write(value: A): Paxos[A,N] = + def write(value: A): Paxos[A, N] = // TODO: What would write look like? Maybe return false if we can't write at the moment? ??? diff --git a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/AWSetTest.scala b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/AWSetTest.scala index 2ed84db6f..95289f9d2 100644 --- a/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/AWSetTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/deltaAntiEntropy/tests/AWSetTest.scala @@ -46,7 +46,7 @@ class AWSetTest extends munit.ScalaCheckSuite { implicit val IntCodec: JsonValueCodec[Int] = JsonCodecMaker.make property("add") { forAll { (set: AntiEntropyContainer[ReplicatedSet[Int]], e: Int) => - given LocalReplicaId = set.replicaID + given LocalReplicaId = set.replicaID val added: AntiEntropyContainer[ReplicatedSet[Int]] = set.add(e) val elems = added.elements @@ -58,7 +58,7 @@ class AWSetTest extends munit.ScalaCheckSuite { } property("remove") { forAll { (set: AntiEntropyContainer[ReplicatedSet[Int]], e: Int) => - given LocalReplicaId = set.replicaID + given LocalReplicaId = set.replicaID val removedNotContained = set.remove(e) val added = set.add(e) val removed = added.remove(e) diff --git a/Modules/Example Replication/jvm/src/test/scala/replication/protocols/PaxosTest.scala b/Modules/Example Replication/jvm/src/test/scala/replication/protocols/PaxosTest.scala index aa41d85de..36ee455af 100644 --- a/Modules/Example Replication/jvm/src/test/scala/replication/protocols/PaxosTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/replication/protocols/PaxosTest.scala @@ -11,21 +11,21 @@ import Paxos.* class PaxosTest extends munit.FunSuite { given Bottom[Int] with override def empty: Int = Int.MinValue - - given dots: Dots = Dots.empty - val id1 = LocalReplicaId.gen() - val id2 = LocalReplicaId.gen() - val id3 = LocalReplicaId.gen() - - test("Paxos for 3 participants without errors"){ + + given dots: Dots = Dots.empty + val id1 = LocalReplicaId.gen() + val id2 = LocalReplicaId.gen() + val id3 = LocalReplicaId.gen() + + test("Paxos for 3 participants without errors") { var a: Paxos[Int, 2] = Paxos.unchanged(using 2) - + a = a merge a.prepare()(using id1) a = a merge a.upkeep()(using id1) merge a.upkeep()(using id2) merge a.upkeep()(using id3) - assertEquals(a.read,None) + assertEquals(a.read, None) a = a merge a.accept(1)(using id1) a = a merge a.upkeep()(using id1) merge a.upkeep()(using id2) merge a.upkeep()(using id3) - assertEquals(a.read,Some(1)) + assertEquals(a.read, Some(1)) } - + } diff --git a/Modules/Example Replication/jvm/src/test/scala/replication/protocols/TokensTest.scala b/Modules/Example Replication/jvm/src/test/scala/replication/protocols/TokensTest.scala index 8afb0bea6..290b748c7 100644 --- a/Modules/Example Replication/jvm/src/test/scala/replication/protocols/TokensTest.scala +++ b/Modules/Example Replication/jvm/src/test/scala/replication/protocols/TokensTest.scala @@ -7,9 +7,9 @@ import rdts.dotted.Dotted import rdts.syntax.LocalReplicaId class TokensTest extends munit.FunSuite { - given dots: Dots = Dots.empty - given Lattice[Dotted[Token]] = Lattice.derived - val numOfReplicas = 5 + given dots: Dots = Dots.empty + given Lattice[Dotted[Token]] = Lattice.derived + val numOfReplicas = 5 val replicas: Seq[LocalReplicaId] = List.tabulate(numOfReplicas)(_ => LocalReplicaId.gen()) var token = Dotted(Token( os = Ownership.unchanged, diff --git a/Modules/Example Replication/shared/src/main/scala/replication/ConnectionManager.scala b/Modules/Example Replication/shared/src/main/scala/replication/ConnectionManager.scala index 9aeb888be..6b687c42a 100644 --- a/Modules/Example Replication/shared/src/main/scala/replication/ConnectionManager.scala +++ b/Modules/Example Replication/shared/src/main/scala/replication/ConnectionManager.scala @@ -54,8 +54,8 @@ class ConnectionManager(lrid: LocalReplicaId) { val addPeerRef: Evt[PeerRef[?]] = Evt() - val peers: Signal[List[PeerRef[?]]] = Fold(List.empty){ - addPeerRef act {_ :: current} + val peers: Signal[List[PeerRef[?]]] = Fold(List.empty) { + addPeerRef act { _ :: current } } def addConnection[T](connection: BiChan, coder: MessageCoder[T]): Async[Ctx, Unit] = { diff --git a/Modules/Example Replication/shared/src/main/scala/replication/JsoniterCodecs.scala b/Modules/Example Replication/shared/src/main/scala/replication/JsoniterCodecs.scala index 182e2ec1f..23fca79a3 100644 --- a/Modules/Example Replication/shared/src/main/scala/replication/JsoniterCodecs.scala +++ b/Modules/Example Replication/shared/src/main/scala/replication/JsoniterCodecs.scala @@ -6,9 +6,7 @@ import rdts.base.Uid import rdts.datatypes.alternatives.ResettableCounter import rdts.datatypes.contextual.{ReplicatedSet, EnableWinsFlag, MultiVersionRegister, ObserveRemoveMap, ReplicatedList} import rdts.datatypes.experiments.AuctionInterface.AuctionData -import rdts.datatypes.{ - Epoch, GrowOnlyCounter, GrowOnlyList, GrowOnlyMap, GrowOnlySet, LastWriterWins, PosNegCounter, TwoPhaseSet -} +import rdts.datatypes.{Epoch, GrowOnlyCounter, GrowOnlyList, GrowOnlyMap, GrowOnlySet, LastWriterWins, PosNegCounter, TwoPhaseSet} import rdts.dotted.Dotted import rdts.time.{ArrayRanges, Dot, Dots, Time} diff --git a/Modules/Example Todolist/src/main/scala/todo/NewWebRTCHandling.scala b/Modules/Example Todolist/src/main/scala/todo/NewWebRTCHandling.scala index fe2d998be..70dd9df42 100644 --- a/Modules/Example Todolist/src/main/scala/todo/NewWebRTCHandling.scala +++ b/Modules/Example Todolist/src/main/scala/todo/NewWebRTCHandling.scala @@ -32,9 +32,6 @@ given [T](using JsonValueCodec[T]): Conversion[T, MessageBuffer] = v => ArrayMes given JsonValueCodec[BroadcastCommunication] = JsonCodecMaker.make - - - object Example { // label seems mostly for auto negotiation @@ -57,12 +54,12 @@ object Example { val renderedAddConnectionButton = button("new peerConnection").render Async.fromCallback { - renderedAddConnectionButton.onclick = (ev: MouseEvent) => - Async.handler.succeed(()) - }.map: _ => - val handling = WebRTCHandling(None) - renderedConnectionTable.appendChild(handling.controlRow().render) - addDataChannel(handling) + renderedAddConnectionButton.onclick = (ev: MouseEvent) => + Async.handler.succeed(()) + }.map: _ => + val handling = WebRTCHandling(None) + renderedConnectionTable.appendChild(handling.controlRow().render) + addDataChannel(handling) .run(using ExecutionContext.global)(errorReporter) useLocalBroadcastChannel(renderedConnectionTable) diff --git a/Modules/Example Todolist/src/main/scala/todo/TaskData.scala b/Modules/Example Todolist/src/main/scala/todo/TaskData.scala index cd803c700..1d14ff7f9 100644 --- a/Modules/Example Todolist/src/main/scala/todo/TaskData.scala +++ b/Modules/Example Todolist/src/main/scala/todo/TaskData.scala @@ -141,12 +141,14 @@ class TaskReferences(toggleAll: Event[dom.Event], storePrefix: String) { doneClick.data, ).render.reattach(Signal: if taskData.value.done - then (elem: dom.html.Input) => - elem.checked = true - elem.setAttribute("checked", "checked") - else (elem: dom.html.Input) => - elem.checked = false - elem.removeAttribute("checked") + then + (elem: dom.html.Input) => + elem.checked = true + elem.setAttribute("checked", "checked") + else + (elem: dom.html.Input) => + elem.checked = false + elem.removeAttribute("checked") ), label.render.reattach(taskData.map(c => c.desc)), removeButton.data diff --git a/Modules/Example Todolist/src/main/scala/todo/TodoAppUI.scala b/Modules/Example Todolist/src/main/scala/todo/TodoAppUI.scala index a0c6021c9..d67b57d9e 100644 --- a/Modules/Example Todolist/src/main/scala/todo/TodoAppUI.scala +++ b/Modules/Example Todolist/src/main/scala/todo/TodoAppUI.scala @@ -20,7 +20,6 @@ import scala.annotation.targetName class TodoAppUI(val storagePrefix: String) { - def getContents(): Div = { val todoInputTag: Input = input( @@ -74,47 +73,49 @@ class TodoAppUI(val storagePrefix: String) { val hideEmpty = Signal: `style` := (if tasksData.value.isEmpty then "display:none" else "") - div(`class` := "appcontainer", div( - `class` := "todoapp", - header( - `class` := "header", - h1(if (largeheader.nonEmpty) largeheader else "todos"), - todoInputTag - ), - section( - `class` := "main", - toggleAll.data, - label(`for` := "toggle-all", "Mark all as complete"), - ul( - `class` := "todo-list", - ).render.reattach(taskTags) - ).render.reattach(hideEmpty), + `class` := "appcontainer", div( - `class` := "footer", - span( - `class` := "todo-count", - ).render.reattach( - Signal { - val remainingTasks = tasksData.value.count(!_.done) - println(s"remaining observer") - List( - strong(remainingTasks.toString).render, - span(if (remainingTasks == 1) - " item left" - else " items left").render - ) - } - ) - ).render.reattach(hideEmpty) - .reattach { - Signal { - removeAll.data( - `class` := s"clear-completed${if (!tasksData.value.exists(_.done)) " hidden" else ""}" - ).render + `class` := "todoapp", + header( + `class` := "header", + h1(if (largeheader.nonEmpty) largeheader else "todos"), + todoInputTag + ), + section( + `class` := "main", + toggleAll.data, + label(`for` := "toggle-all", "Mark all as complete"), + ul( + `class` := "todo-list", + ).render.reattach(taskTags) + ).render.reattach(hideEmpty), + div( + `class` := "footer", + span( + `class` := "todo-count", + ).render.reattach( + Signal { + val remainingTasks = tasksData.value.count(!_.done) + println(s"remaining observer") + List( + strong(remainingTasks.toString).render, + span(if (remainingTasks == 1) + " item left" + else " items left").render + ) + } + ) + ).render.reattach(hideEmpty) + .reattach { + Signal { + removeAll.data( + `class` := s"clear-completed${if (!tasksData.value.exists(_.done)) " hidden" else ""}" + ).render + } } - } - )).render + ) + ).render } } diff --git a/Modules/Graph-Compiler/src/main/scala/api2/GraphCompiler.scala b/Modules/Graph-Compiler/src/main/scala/api2/GraphCompiler.scala index 4239b9ef1..99f4119a0 100644 --- a/Modules/Graph-Compiler/src/main/scala/api2/GraphCompiler.scala +++ b/Modules/Graph-Compiler/src/main/scala/api2/GraphCompiler.scala @@ -4,9 +4,7 @@ import clangast.* import clangast.given import clangast.decl.* import clangast.expr.* -import clangast.expr.binaryop.{ - CAndExpr, CAssignmentExpr, CEqualsExpr, CGreaterThanExpr, CLessThanExpr, CNotEqualsExpr, COrExpr -} +import clangast.expr.binaryop.{CAndExpr, CAssignmentExpr, CEqualsExpr, CGreaterThanExpr, CLessThanExpr, CNotEqualsExpr, COrExpr} import clangast.expr.unaryop.CNotExpr import clangast.stmt.* import clangast.stubs.{CJSONH, DyadH, StdBoolH, StdLibH} diff --git a/Modules/Local-first Access Control/src/main/scala/lofi_acl/crypto/Ed25519Util.scala b/Modules/Local-first Access Control/src/main/scala/lofi_acl/crypto/Ed25519Util.scala index 5b3a169e8..b8624721a 100644 --- a/Modules/Local-first Access Control/src/main/scala/lofi_acl/crypto/Ed25519Util.scala +++ b/Modules/Local-first Access Control/src/main/scala/lofi_acl/crypto/Ed25519Util.scala @@ -5,9 +5,7 @@ import org.bouncycastle.asn1.pkcs.PrivateKeyInfo import org.bouncycastle.asn1.x509.{AlgorithmIdentifier, SubjectPublicKeyInfo} import org.bouncycastle.asn1.{ASN1InputStream, DEROctetString} import org.bouncycastle.crypto.generators.Ed25519KeyPairGenerator -import org.bouncycastle.crypto.params.{ - Ed25519KeyGenerationParameters, Ed25519PrivateKeyParameters, Ed25519PublicKeyParameters -} +import org.bouncycastle.crypto.params.{Ed25519KeyGenerationParameters, Ed25519PrivateKeyParameters, Ed25519PublicKeyParameters} import org.bouncycastle.jce.provider.BouncyCastleProvider import org.bouncycastle.util.io.pem.{PemObject, PemWriter} diff --git a/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/MVRegisterBench.scala b/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/MVRegisterBench.scala index 365f93a09..df511b9ec 100644 --- a/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/MVRegisterBench.scala +++ b/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/MVRegisterBench.scala @@ -28,7 +28,7 @@ class MVRegisterBench { reg = (0 until numWrites).foldLeft(NamedDeltaBuffer.dotted("-1", MultiVersionRegister.empty[Int])) { case (r, i) => given rid: rdts.syntax.LocalReplicaId = i.toString.asId - val delta = Dotted(MultiVersionRegister.empty[Int]).write(i) + val delta = Dotted(MultiVersionRegister.empty[Int]).write(i) r.applyDelta(rid.uid, delta) } } diff --git a/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/PNCounterBench.scala b/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/PNCounterBench.scala index 2843f575a..69923cfc8 100644 --- a/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/PNCounterBench.scala +++ b/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/PNCounterBench.scala @@ -25,7 +25,7 @@ class PNCounterBench { counter = (1 until numReplicas).foldLeft(NamedDeltaBuffer("0", PosNegCounter.zero).inc()(using "0".asId)) { case (c, n) => given rid: rdts.syntax.LocalReplicaId = rdts.base.Uid.predefined(n.toString) - val delta = PosNegCounter.zero.inc() + val delta = PosNegCounter.zero.inc() c.applyDelta(rid.uid, delta) } } diff --git a/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/RCounterBench.scala b/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/RCounterBench.scala index a68ef1f71..d2f837426 100644 --- a/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/RCounterBench.scala +++ b/Modules/Microbenchmarks/src/main/scala/benchmarks/lattices/delta/crdt/RCounterBench.scala @@ -27,7 +27,7 @@ class RCounterBench { (1 until numReplicas).foldLeft(NamedDeltaBuffer.dotted("0", ResettableCounter.zero).increment(using "0".asId)()) { case (c, n) => given rid: LocalReplicaId = n.toString.asId - val delta = Dotted(ResettableCounter.zero).increment() + val delta = Dotted(ResettableCounter.zero).increment() c.applyDelta(rid.uid, delta) } } diff --git a/Modules/RDTs/src/main/scala/rdts/base/Uid.scala b/Modules/RDTs/src/main/scala/rdts/base/Uid.scala index e5b70389e..1d0b9a4b4 100644 --- a/Modules/RDTs/src/main/scala/rdts/base/Uid.scala +++ b/Modules/RDTs/src/main/scala/rdts/base/Uid.scala @@ -4,7 +4,8 @@ import java.util.Base64 import scala.util.Random // opaque currently causes too many weird issues with library integrations, in particular the json libraries can no longer auto serialize -/* opaque */ type Uid = String +/* opaque */ +type Uid = String object Uid: given ordering: Ordering[Uid] = Ordering.String diff --git a/Modules/RDTs/src/main/scala/rdts/datatypes/LastWriterWins.scala b/Modules/RDTs/src/main/scala/rdts/datatypes/LastWriterWins.scala index 2a02f2e08..932356e90 100644 --- a/Modules/RDTs/src/main/scala/rdts/datatypes/LastWriterWins.scala +++ b/Modules/RDTs/src/main/scala/rdts/datatypes/LastWriterWins.scala @@ -15,7 +15,7 @@ import scala.math.Ordering.Implicits.infixOrderingOps */ case class LastWriterWins[+A](timestamp: CausalTime, payload: A) { def read: A = payload - + def value: A = read def write[B](v: B): LastWriterWins[B] = @@ -65,5 +65,4 @@ object LastWriterWins { given bottom[A: Bottom]: Bottom[LastWriterWins[A]] with override def empty: LastWriterWins[A] = LastWriterWins.this.empty - } diff --git a/Modules/RDTs/src/main/scala/rdts/datatypes/experiments/BoundedCounter.scala b/Modules/RDTs/src/main/scala/rdts/datatypes/experiments/BoundedCounter.scala index 42964099a..3a00d001b 100644 --- a/Modules/RDTs/src/main/scala/rdts/datatypes/experiments/BoundedCounter.scala +++ b/Modules/RDTs/src/main/scala/rdts/datatypes/experiments/BoundedCounter.scala @@ -24,11 +24,11 @@ object BoundedCounter { def addParticipants(part: Set[Uid])(using IsMutator): C = neutral.copy(participants = part).mutator - def allocated(using IsQuery)(id: Uid): Int = current.allocations.inner.getOrElse(id, 0) + def allocated(using IsQuery)(id: Uid): Int = current.allocations.inner.getOrElse(id, 0) def reserved(using LocalReplicaId, IsQuery): Int = reserved(replicaId) def reserved(using IsQuery)(id: Uid): Int = current.reservations.pos.inner.getOrElse(id, 0) - current.reservations.neg.inner.getOrElse(id, 0) - def available(using IsQuery)(id: Uid): Int = reserved(id) - allocated(id) + def available(using IsQuery)(id: Uid): Int = reserved(id) - allocated(id) def available(using LocalReplicaId, IsQuery): Int = available(replicaId) def allocate(value: Int): IdMutator = { diff --git a/Modules/RDTs/src/main/scala/rdts/dotted/Dotted.scala b/Modules/RDTs/src/main/scala/rdts/dotted/Dotted.scala index fff267f90..90297eb53 100644 --- a/Modules/RDTs/src/main/scala/rdts/dotted/Dotted.scala +++ b/Modules/RDTs/src/main/scala/rdts/dotted/Dotted.scala @@ -12,10 +12,10 @@ import rdts.time.{Dot, Dots} * Specifically, the `deletions` and `contained` methods reflect this interpretation. */ case class Dotted[A](data: A, context: Dots) { - def map[B](f: A => B): Dotted[B] = Dotted(f(data), context) - def knows(dot: Dot): Boolean = context.contains(dot) - def deletions(using HasDots[A]): Dots = context diff contained - def contained(using HasDots[A]): Dots = data.dots + def map[B](f: A => B): Dotted[B] = Dotted(f(data), context) + def knows(dot: Dot): Boolean = context.contains(dot) + def deletions(using HasDots[A]): Dots = context diff contained + def contained(using HasDots[A]): Dots = data.dots def advanced(r: LocalReplicaId): Dotted[A] = Dotted(data, context.advanced(r.uid)) } diff --git a/Modules/RDTs/src/main/scala/rdts/syntax/TestReplica.scala b/Modules/RDTs/src/main/scala/rdts/syntax/TestReplica.scala index 20ce0ded5..be87b5f78 100644 --- a/Modules/RDTs/src/main/scala/rdts/syntax/TestReplica.scala +++ b/Modules/RDTs/src/main/scala/rdts/syntax/TestReplica.scala @@ -14,8 +14,8 @@ object TestReplica { // @targetName("fromString") // def apply[L](replicaId: String, anon: L): TestReplica[L] = apply(Uid.predefined(replicaId), anon) - def apply[L](replicaID: Uid, anon: L): TestReplica[L] = new TestReplica(replicaID, anon) - def unapply[L](wnc: TestReplica[L]): Some[(Uid, L)] = Some((wnc.replicaId, wnc.anon)) + def apply[L](replicaID: Uid, anon: L): TestReplica[L] = new TestReplica(replicaID, anon) + def unapply[L](wnc: TestReplica[L]): Some[(Uid, L)] = Some((wnc.replicaId, wnc.anon)) given permissions[L](using Lattice[L]): PermMutate[TestReplica[L], L] with { diff --git a/Modules/RDTs/src/test/scala/test/rdts/UtilHacks.scala b/Modules/RDTs/src/test/scala/test/rdts/UtilHacks.scala index 12494a29e..3168c8b35 100644 --- a/Modules/RDTs/src/test/scala/test/rdts/UtilHacks.scala +++ b/Modules/RDTs/src/test/scala/test/rdts/UtilHacks.scala @@ -25,7 +25,6 @@ object UtilHacks2 { def write(v: V)(using Lattice[Dotted[LastWriterWins[V]]]) = dottedLww.transform(x => Dotted(x.data.write(v))) } - extension [V](dottedLww: DeltaBufferContainer[Dotted[LastWriterWins[V]]]) { private def workaround4: LastWriterWins[V] = dottedLww.result.state.data export workaround4.read diff --git a/Modules/RDTs/src/test/scala/test/rdts/baseproperties/LatticePropertyChecks.scala b/Modules/RDTs/src/test/scala/test/rdts/baseproperties/LatticePropertyChecks.scala index 0193b7a03..fa8d04939 100644 --- a/Modules/RDTs/src/test/scala/test/rdts/baseproperties/LatticePropertyChecks.scala +++ b/Modules/RDTs/src/test/scala/test/rdts/baseproperties/LatticePropertyChecks.scala @@ -5,9 +5,7 @@ import rdts.datatypes.alternatives.{MultiValueRegister, ObserveRemoveSet} import rdts.datatypes.contextual.{CausalQueue, ReplicatedList} import rdts.datatypes.experiments.AutomergyOpGraphLWW.OpGraph import rdts.datatypes.experiments.CausalStore -import rdts.datatypes.{ - GrowOnlyCounter, GrowOnlyList, GrowOnlyMap, LastWriterWins, PosNegCounter, TwoPhaseSet, contextual -} +import rdts.datatypes.{GrowOnlyCounter, GrowOnlyList, GrowOnlyMap, LastWriterWins, PosNegCounter, TwoPhaseSet, contextual} import rdts.dotted.{Dotted, HasDots} import rdts.time.{Dots, Time, VectorClock, Dot} import org.scalacheck.Prop.* diff --git a/Modules/RDTs/src/test/scala/test/rdts/bespoke/DecomposeManualTests.scala b/Modules/RDTs/src/test/scala/test/rdts/bespoke/DecomposeManualTests.scala index ed671f7f8..083890a90 100644 --- a/Modules/RDTs/src/test/scala/test/rdts/bespoke/DecomposeManualTests.scala +++ b/Modules/RDTs/src/test/scala/test/rdts/bespoke/DecomposeManualTests.scala @@ -15,7 +15,6 @@ class DecomposeManualTests extends munit.ScalaCheckSuite { val r1: LocalReplicaId = "r1".asId val r2: LocalReplicaId = "r2".asId - test("GrowOnlyCounter decomposition") { val empty: GrowOnlyCounter = Bottom[GrowOnlyCounter].empty diff --git a/Modules/RDTs/src/test/scala/test/rdts/bespoke/SyntaxTest.scala b/Modules/RDTs/src/test/scala/test/rdts/bespoke/SyntaxTest.scala index 3268cd8b5..d3775d378 100644 --- a/Modules/RDTs/src/test/scala/test/rdts/bespoke/SyntaxTest.scala +++ b/Modules/RDTs/src/test/scala/test/rdts/bespoke/SyntaxTest.scala @@ -15,7 +15,7 @@ class SyntaxTest extends munit.FunSuite { test("Manual Tests") { val flag: Dotted[EnableWinsFlag] = Dotted.empty - given LocalReplicaId = "me".asId + given LocalReplicaId = "me".asId assert(!flag.read) val enabled = flag.enable() diff --git a/Modules/RDTs/src/test/scala/test/rdts/containers/ContainerTest.scala b/Modules/RDTs/src/test/scala/test/rdts/containers/ContainerTest.scala index 6ff6df00a..6f70e5ea7 100644 --- a/Modules/RDTs/src/test/scala/test/rdts/containers/ContainerTest.scala +++ b/Modules/RDTs/src/test/scala/test/rdts/containers/ContainerTest.scala @@ -12,7 +12,6 @@ import rdts.syntax.{DeltaBuffer, DeltaBufferContainer, LocalReplicaId} import test.rdts.UtilHacks.* import test.rdts.UtilHacks2.* - class ContainerTest extends munit.FunSuite { object helper { @@ -31,7 +30,7 @@ class ContainerTest extends munit.FunSuite { test("Dotted can contain contextual EnableWinsFlag") { val flag: Dotted[EnableWinsFlag] = Dotted.empty - given LocalReplicaId = "me".asId + given LocalReplicaId = "me".asId assertEquals(flag.read, false) diff --git a/Modules/Reactives/js/src/main/scala/reactives/extra/Tags.scala b/Modules/Reactives/js/src/main/scala/reactives/extra/Tags.scala index b6432cc63..a5f713ca0 100644 --- a/Modules/Reactives/js/src/main/scala/reactives/extra/Tags.scala +++ b/Modules/Reactives/js/src/main/scala/reactives/extra/Tags.scala @@ -12,7 +12,6 @@ import reactives.operator.* import scala.annotation.targetName import scala.scalajs.js - object Tags { trait RangeSplice[-A <: dom.Element, -T]: @@ -42,7 +41,9 @@ object Tags { Observe.strong(signal, true) { tagObserver(anchor, signal) { v => if range.commonAncestorContainer != anchor then - println(s"weird state $anchor; $range; ${range.commonAncestorContainer} ${range.startContainer}; ${range.endContainer}") + println( + s"weird state $anchor; $range; ${range.commonAncestorContainer} ${range.startContainer}; ${range.endContainer}" + ) range.extractContents() splicer.splice(anchor, range, v) } diff --git a/Modules/Reactives/jvm/src/main/scala/reactives/fullmv/FullMVBundle.scala b/Modules/Reactives/jvm/src/main/scala/reactives/fullmv/FullMVBundle.scala index 413b3caab..ec1b2979d 100644 --- a/Modules/Reactives/jvm/src/main/scala/reactives/fullmv/FullMVBundle.scala +++ b/Modules/Reactives/jvm/src/main/scala/reactives/fullmv/FullMVBundle.scala @@ -118,7 +118,7 @@ case class TransactionHandle(ti: FullMVTurn) extends Transaction[State] { override def preconditionTicket: DynamicTicket[State] = new DynamicTicket[State](this): override private[reactives] def collectDynamic(reactive: ReSource.of[State]) = ti.dynamicBefore(reactive) - override private[reactives] def collectStatic(reactive: ReSource.of[State]) = ti.staticBefore(reactive) + override private[reactives] def collectStatic(reactive: ReSource.of[State]) = ti.staticBefore(reactive) } class FullMVEngine(val timeout: Duration, val schedulerName: String) diff --git a/Modules/Reactives/jvm/src/main/scala/reactives/fullmv/tasks/TaskBundle.scala b/Modules/Reactives/jvm/src/main/scala/reactives/fullmv/tasks/TaskBundle.scala index 286f634d4..48a288ade 100644 --- a/Modules/Reactives/jvm/src/main/scala/reactives/fullmv/tasks/TaskBundle.scala +++ b/Modules/Reactives/jvm/src/main/scala/reactives/fullmv/tasks/TaskBundle.scala @@ -2,9 +2,7 @@ package reactives.fullmv.tasks import reactives.core.{AccessHandler, Derived, ReSource, ReevTicket, Result} import reactives.fullmv.FramingBranchResult._ -import reactives.fullmv.NotificationBranchResult.ReevOutBranchResult.{ - NotifyAndNonReadySuccessor, NotifyAndReevaluationReadySuccessor, PureNotifyOnly -} +import reactives.fullmv.NotificationBranchResult.ReevOutBranchResult.{NotifyAndNonReadySuccessor, NotifyAndReevaluationReadySuccessor, PureNotifyOnly} import reactives.fullmv.NotificationBranchResult.* import reactives.fullmv.* import reactives.structure.Pulse diff --git a/Modules/Reactives/jvm/src/test/scala/tests/rescala/jvm/fullmv/NodeVersionHistoryTest.scala b/Modules/Reactives/jvm/src/test/scala/tests/rescala/jvm/fullmv/NodeVersionHistoryTest.scala index 1a95f7de1..412780659 100644 --- a/Modules/Reactives/jvm/src/test/scala/tests/rescala/jvm/fullmv/NodeVersionHistoryTest.scala +++ b/Modules/Reactives/jvm/src/test/scala/tests/rescala/jvm/fullmv/NodeVersionHistoryTest.scala @@ -2,9 +2,7 @@ package tests.rescala.fullmv import reactives.fullmv.FramingBranchResult.{Frame, FramingBranchEnd} import reactives.fullmv.NotificationBranchResult.{DoNothing, ReevaluationReady} -import reactives.fullmv.NotificationBranchResult.ReevOutBranchResult.{ - NotifyAndReevaluationReadySuccessor, PureNotifyOnly -} +import reactives.fullmv.NotificationBranchResult.ReevOutBranchResult.{NotifyAndReevaluationReadySuccessor, PureNotifyOnly} import reactives.fullmv._ import scala.concurrent.duration.Duration diff --git a/Modules/Reactives/shared/src/main/scala/reactives/core/Core.scala b/Modules/Reactives/shared/src/main/scala/reactives/core/Core.scala index f90f89de8..e1b0c01ac 100644 --- a/Modules/Reactives/shared/src/main/scala/reactives/core/Core.scala +++ b/Modules/Reactives/shared/src/main/scala/reactives/core/Core.scala @@ -119,7 +119,7 @@ object CreationTicket { final class CreationTicketCont[State[_]](ct: CreationTicket[State]) object CreationTicketCont { - given fromTicket[State[_]](using ct: CreationTicket[State]): CreationTicketCont[State] = CreationTicketCont(ct) + given fromTicket[State[_]](using ct: CreationTicket[State]): CreationTicketCont[State] = CreationTicketCont(ct) } /** Essentially a kill switch, that will remove the reactive at some point. */ diff --git a/Modules/Reactives/shared/src/main/scala/reactives/extra/lenses/LensBundle.scala b/Modules/Reactives/shared/src/main/scala/reactives/extra/lenses/LensBundle.scala index f30689fbc..ed9b17a30 100644 --- a/Modules/Reactives/shared/src/main/scala/reactives/extra/lenses/LensBundle.scala +++ b/Modules/Reactives/shared/src/main/scala/reactives/extra/lenses/LensBundle.scala @@ -32,7 +32,7 @@ class LVar[M] private[reactives] (state: Signal[M], events: Evt[Event[M]]) { export state.{now} final infix def observe(onValue: M => Unit, onError: Throwable => Unit = null, fireImmediately: Boolean = true)( - implicit ticket: CreationTicket[State] + implicit ticket: CreationTicket[State] ): Disconnectable = state.observe(onValue, onError, fireImmediately) /** Function to access state of LVar in reactives. Simple wrapper for internal.value. */ diff --git a/Modules/Reactives/shared/src/main/scala/reactives/operator/Sources.scala b/Modules/Reactives/shared/src/main/scala/reactives/operator/Sources.scala index 2114d51e3..713daba9b 100644 --- a/Modules/Reactives/shared/src/main/scala/reactives/operator/Sources.scala +++ b/Modules/Reactives/shared/src/main/scala/reactives/operator/Sources.scala @@ -1,8 +1,6 @@ package reactives.operator -import reactives.core.{ - AdmissionTicket, Base, CreationTicket, InitialChange, Observation, PlanTransactionScope, ReInfo, ReSource, Scheduler -} +import reactives.core.{AdmissionTicket, Base, CreationTicket, InitialChange, Observation, PlanTransactionScope, ReInfo, ReSource, Scheduler} import reactives.operator.Interface.State import reactives.structure.Pulse diff --git a/Modules/Reactives/shared/src/main/scala/reactives/scheduler/CalculusLike.scala b/Modules/Reactives/shared/src/main/scala/reactives/scheduler/CalculusLike.scala index ef5bf2c0b..5425b3267 100644 --- a/Modules/Reactives/shared/src/main/scala/reactives/scheduler/CalculusLike.scala +++ b/Modules/Reactives/shared/src/main/scala/reactives/scheduler/CalculusLike.scala @@ -72,7 +72,7 @@ object CalculusLike { override def preconditionTicket: DynamicTicket[State] = new DynamicTicket[State](this): override private[reactives] def collectDynamic(reactive: ReSource.of[State]) = access(reactive) - override private[reactives] def collectStatic(reactive: ReSource.of[State]) = access(reactive) + override private[reactives] def collectStatic(reactive: ReSource.of[State]) = access(reactive) } object FScheduler diff --git a/Modules/Reactives/shared/src/main/scala/reactives/scheduler/TopoBundle.scala b/Modules/Reactives/shared/src/main/scala/reactives/scheduler/TopoBundle.scala index fd5562001..810772f1a 100644 --- a/Modules/Reactives/shared/src/main/scala/reactives/scheduler/TopoBundle.scala +++ b/Modules/Reactives/shared/src/main/scala/reactives/scheduler/TopoBundle.scala @@ -87,7 +87,7 @@ trait TopoBundle { override def preconditionTicket: DynamicTicket[State] = new DynamicTicket[State](this): override private[reactives] def collectDynamic(reactive: ReSource.of[State]) = access(reactive) - override private[reactives] def collectStatic(reactive: ReSource.of[State]) = access(reactive) + override private[reactives] def collectStatic(reactive: ReSource.of[State]) = access(reactive) } object TopoScheduler extends TopoSchedulerInterface diff --git a/Modules/Reactives/shared/src/main/scala/reactives/scheduler/Twoversion.scala b/Modules/Reactives/shared/src/main/scala/reactives/scheduler/Twoversion.scala index c2cc138b3..4a8a65ca4 100644 --- a/Modules/Reactives/shared/src/main/scala/reactives/scheduler/Twoversion.scala +++ b/Modules/Reactives/shared/src/main/scala/reactives/scheduler/Twoversion.scala @@ -243,10 +243,10 @@ trait Twoversion { } override def preconditionTicket: DynamicTicket[State] = new DynamicTicket[State](this): - override private[reactives] def collectDynamic(reactive: ReSource.of[State]) = accessHandler.dynamicAccess(reactive) + override private[reactives] def collectDynamic(reactive: ReSource.of[State]) = + accessHandler.dynamicAccess(reactive) override private[reactives] def collectStatic(reactive: ReSource.of[State]) = accessHandler.staticAccess(reactive) - override private[reactives] def makeAdmissionPhaseTicket(initialWrites: Set[ReSource]): AdmissionTicket[State] = new AdmissionTicket[State](this, initialWrites) private[reactives] def makeDynamicReevaluationTicket[V, N](b: V): ReevTicket[State, V] = diff --git a/Modules/Reactives/shared/src/test/scala/tests/rescala/misc/CreationTicketTest.scala b/Modules/Reactives/shared/src/test/scala/tests/rescala/misc/CreationTicketTest.scala index 77381e0d2..be7442c32 100644 --- a/Modules/Reactives/shared/src/test/scala/tests/rescala/misc/CreationTicketTest.scala +++ b/Modules/Reactives/shared/src/test/scala/tests/rescala/misc/CreationTicketTest.scala @@ -30,7 +30,7 @@ class CreationTicketTest extends RETests { implicit val implicitTurn: Transaction[State] = getTurn implicitly[CreationTicket[State]].scope match case StaticCreationScope(tx) => assertEquals(tx, implicitTurn) - case other => assert(false) + case other => assert(false) assertEquals(implicitly[CreationTicket[State]].scope.embedCreation(x ?=> x), implicitTurn) } @@ -39,7 +39,7 @@ class CreationTicketTest extends RETests { implicit val implicitTurn: Transaction[State] = getTurn implicitly[CreationTicket[State]].scope match case StaticCreationScope(tx) => assertEquals(tx, implicitTurn) - case other => assert(false) + case other => assert(false) assertEquals(implicitly[CreationTicket[State]].scope.embedCreation(x ?=> x), implicitTurn) } } @@ -53,7 +53,7 @@ class CreationTicketTest extends RETests { transaction() { _ => closure().scope match case StaticCreationScope(tx) => assertEquals(tx, closureDefinition) - case other => assert(false) + case other => assert(false) assertEquals(closure().scope.embedCreation(x ?=> x), closureDefinition) } } diff --git a/Modules/Reactives/shared/src/test/scala/tests/rescala/static/lenses/LensTest.scala b/Modules/Reactives/shared/src/test/scala/tests/rescala/static/lenses/LensTest.scala index cdce2ab26..d9a2e8337 100644 --- a/Modules/Reactives/shared/src/test/scala/tests/rescala/static/lenses/LensTest.scala +++ b/Modules/Reactives/shared/src/test/scala/tests/rescala/static/lenses/LensTest.scala @@ -4,77 +4,81 @@ import reactives.extra.lenses.{AddLens, LVar, Lens, MulLens, SignalLens, toSigna import tests.rescala.testtools.RETests class LensTest extends RETests { - multiEngined { engine => - import engine._ + multiEngined { engine => + import engine._ - test("Bijective Lens Addition"){ - val a = LVar[Int](3) - val b = a.applyLens(new AddLens[Int](3)) - val e1 = Evt[Int]() - val test = Var(0) - a.fire(e1) - e1.fire(5) - assert(a.now == 5) - assert(b.now == 8) - b.observe(value => test.set(value)) - assert(test.now == 8) - } + test("Bijective Lens Addition") { + val a = LVar[Int](3) + val b = a.applyLens(new AddLens[Int](3)) + val e1 = Evt[Int]() + val test = Var(0) + a.fire(e1) + e1.fire(5) + assert(a.now == 5) + assert(b.now == 8) + b.observe(value => test.set(value)) + assert(test.now == 8) + } - test("Bijective Lens Inversion") { - val a = LVar[Int](3) - val b = a.applyLens(new AddLens[Int](3)) - val c = b.applyLens(new AddLens[Int](3).inverse) - val e1 = Evt[Int]() - a.fire(e1) - e1.fire(5) - assert(a.now == 5) - assert(b.now == 8) - assert(c.now == a.now) - } + test("Bijective Lens Inversion") { + val a = LVar[Int](3) + val b = a.applyLens(new AddLens[Int](3)) + val c = b.applyLens(new AddLens[Int](3).inverse) + val e1 = Evt[Int]() + a.fire(e1) + e1.fire(5) + assert(a.now == 5) + assert(b.now == 8) + assert(c.now == a.now) + } - test("Bijective Lens Composition") { - val a = LVar(3.0) - val b = a.applyLens(new AddLens(3.0).compose(new MulLens(3.0))) - val e1 = Evt[Double]() - a.fire(e1) - e1.fire(5.0) - assert(a.now == 5.0) - assert(b.now == 24.0) - } + test("Bijective Lens Composition") { + val a = LVar(3.0) + val b = a.applyLens(new AddLens(3.0).compose(new MulLens(3.0))) + val e1 = Evt[Double]() + a.fire(e1) + e1.fire(5.0) + assert(a.now == 5.0) + assert(b.now == 24.0) + } - test("Bijective SignalLens Addition") { - val a = LVar[Int](3) - val lens = Var(new AddLens(3)) - val b = a.applyLens(SignalLens{ Signal {lens.value }}) - val e1 = Evt[Int]() - a.fire(e1) - e1.fire(5) - assert(a.now == 5) - assert(b.now == 8) - lens.set(new AddLens[Int](5)) - assert(a.now == 5) - assert(b.now == 10) - } + test("Bijective SignalLens Addition") { + val a = LVar[Int](3) + val lens = Var(new AddLens(3)) + val b = a.applyLens(SignalLens { Signal { lens.value } }) + val e1 = Evt[Int]() + a.fire(e1) + e1.fire(5) + assert(a.now == 5) + assert(b.now == 8) + lens.set(new AddLens[Int](5)) + assert(a.now == 5) + assert(b.now == 10) + } - class testType (val intValue : Int, val stringValue : String) + class testType(val intValue: Int, val stringValue: String) - class testLens extends Lens[testType, Int] { - def toView(m: testType): Int = m.intValue + 3 + class testLens extends Lens[testType, Int] { + def toView(m: testType): Int = m.intValue + 3 - def toModel(v: Int, m : testType): testType = testType(v - 3, m.stringValue)//Record("intValue" -> v, "stringValue" -> m.stringValue).asInstanceOf[testType] - } + def toModel(v: Int, m: testType): testType = + testType(v - 3, m.stringValue) // Record("intValue" -> v, "stringValue" -> m.stringValue).asInstanceOf[testType] + } - test("Non-Bijective Lens ") { - val a = LVar[testType](testType(5, "THISDOESNOTCHANGE")) //(Record("intValue" -> 5, "stringValue" -> "THISDOESNTCHANGE").asInstanceOf[testType]) - val b = a.applyLens(testLens()) - val e1 = Evt[Int]() - val test = Var(0) - b.fire(e1) - e1.fire(5) - assert(a.now.intValue == 2) - assert(a.now.stringValue == "THISDOESNOTCHANGE") - assert(b.now == 5) - } + test("Non-Bijective Lens ") { + val a = + LVar[testType](testType( + 5, + "THISDOESNOTCHANGE" + )) // (Record("intValue" -> 5, "stringValue" -> "THISDOESNTCHANGE").asInstanceOf[testType]) + val b = a.applyLens(testLens()) + val e1 = Evt[Int]() + val test = Var(0) + b.fire(e1) + e1.fire(5) + assert(a.now.intValue == 2) + assert(a.now.stringValue == "THISDOESNOTCHANGE") + assert(b.now == 5) } } - +} diff --git a/Modules/Swing/src/main/scala/reswing/ReTable.scala b/Modules/Swing/src/main/scala/reswing/ReTable.scala index 49997ff9f..3d7c6a97e 100644 --- a/Modules/Swing/src/main/scala/reswing/ReTable.scala +++ b/Modules/Swing/src/main/scala/reswing/ReTable.scala @@ -2,10 +2,7 @@ package reswing import scala.swing.{Color, Dimension, Font, Table} import scala.swing.Table.{AutoResizeMode, ElementMode, IntervalMode} -import scala.swing.event.{ - TableChanged, TableColumnsSelected, TableRowsAdded, TableRowsRemoved, TableRowsSelected, TableStructureChanged, - TableUpdated -} +import scala.swing.event.{TableChanged, TableColumnsSelected, TableRowsAdded, TableRowsRemoved, TableRowsSelected, TableStructureChanged, TableUpdated} class ReTable[A <: AnyRef]( val rowData: ReSwingValue[Seq[Seq[A]]] = ReSwingNoValue[Seq[Seq[A]]](), diff --git a/build.sbt b/build.sbt index 16f04daca..8f6c51925 100644 --- a/build.sbt +++ b/build.sbt @@ -136,8 +136,8 @@ lazy val lore = (project in file("Modules/Lore")) libraryDependencies += "org.typelevel" %% "cats-core" % "2.10.0", libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.4", libraryDependencies += "com.monovore" %% "decline" % "2.4.1", - libraryDependencies += "org.typelevel" %% "cats-parse" % "1.0.0", - libraryDependencies += ("com.lihaoyi" %% "fansi" % "0.5.0"), + libraryDependencies += "org.typelevel" %% "cats-parse" % "1.0.0", + libraryDependencies += ("com.lihaoyi" %% "fansi" % "0.5.0"), // optics dependencies libraryDependencies ++= Seq( "dev.optics" %% "monocle-core" % "3.2.0"