From 61a5b6385c13ebe8d0c8d53f819273e8c58b41c2 Mon Sep 17 00:00:00 2001 From: ragnar Date: Sat, 24 Aug 2024 14:53:09 +0200 Subject: [PATCH] format/imports --- .../scala/ex2013reswing/ReSwingEvent.scala | 2 +- .../scala/ex2013reswing/ReSwingValue.scala | 8 ++-- .../dropdown/DropdownSample0.scala | 2 +- .../dropdown/DropdownSample1.scala | 2 +- .../dropdown/DropdownSample2.scala | 2 +- .../dropdown/DropdownSample2b.scala | 2 +- .../dropdown/DropdownSample3.scala | 2 +- .../versions/signals/MainWindow.scala | 4 +- .../millgame/versions/signals/MillBoard.scala | 2 +- .../millgame/versions/signals/MillGame.scala | 2 +- .../ex201x/reswingexamples/reader/Main.scala | 2 +- .../reader/connectors/EventMediators.scala | 2 +- .../reader/data/XmlParser.scala | 2 +- .../reswingexamples/reader/gui/GUI.scala | 4 +- .../reader/gui/RssRenderPane.scala | 2 +- .../reader/network/Fetcher.scala | 2 +- .../reader/network/UrlChecker.scala | 2 +- .../reswingexamples/reshapes/ReShapes.scala | 4 +- .../reshapes/actions/Actions.scala | 2 +- .../reshapes/drawing/DrawingSpaceState.scala | 2 +- .../reshapes/ui/panels/CommandPanel.scala | 2 +- .../reshapes/ui/panels/DrawingPanel.scala | 2 +- .../reshapes/ui/panels/InfoPanel.scala | 2 +- .../reshapes/ui/panels/ShapePanel.scala | 2 +- .../ui/panels/ShapeSelectionPanel.scala | 2 +- .../reshapes/ui/panels/StrokeInputPanel.scala | 3 +- .../Application.scala | 2 +- .../ApplicationSwingTextArea.scala | 3 +- .../TextArea.scala | 2 +- .../src/main/scala/ex2024bft/BFT.scala | 39 ++++++++++--------- .../src/test/scala/ex2024bft/BFTTest.scala | 1 - .../src/main/scala/todo/Todolist.scala | 2 +- 32 files changed, 56 insertions(+), 58 deletions(-) diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex2013reswing/ReSwingEvent.scala b/Modules/Examples/Misc JVM/src/main/scala/ex2013reswing/ReSwingEvent.scala index cea2b3490..4eadefad8 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex2013reswing/ReSwingEvent.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex2013reswing/ReSwingEvent.scala @@ -10,7 +10,7 @@ sealed abstract class ReSwingEvent[T] { } final class ReSwingEventOut[T] private[ex2013reswing] (initLazily: ReSwingEventOut[T] => Unit) extends ReSwingEvent[T] { - private val event: Lazy[Evt[T]] = Lazy { Evt[T]() } + private val event: Lazy[Evt[T]] = Lazy { Evt[T]() } private[ex2013reswing] def toEvent = { if !event.isDefined then initLazily(this); event() } private[ex2013reswing] def apply(value: T) = if event.isDefined then event().fire(value) } diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex2013reswing/ReSwingValue.scala b/Modules/Examples/Misc JVM/src/main/scala/ex2013reswing/ReSwingValue.scala index c2d7f261e..a134dc624 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex2013reswing/ReSwingValue.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex2013reswing/ReSwingValue.scala @@ -29,21 +29,21 @@ sealed abstract class ReSwingValue[T] { } final case class ReSwingNoValue[T]() extends ReSwingValue[T] { - protected val signal = Lazy { event().hold(latestValue) } + protected val signal = Lazy { event().hold(latestValue) } private[ex2013reswing] def fixed = false private[ex2013reswing] def get = latestValue private[ex2013reswing] def use(setter: T => Unit): Unit = {} } final case class ReSwingValueValue[T](private val value: T) extends ReSwingValue[T] { - protected val signal = Lazy { event() `hold` latestValue } + protected val signal = Lazy { event() `hold` latestValue } private[ex2013reswing] def fixed = false private[ex2013reswing] def get = latestValue private[ex2013reswing] def use(setter: T => Unit) = setter(value) } final case class ReSwingEventValue[T](private val value: Lazy[Event[T]]) extends ReSwingValue[T] { - protected val signal = Lazy { (value() || event()) `hold` latestValue } + protected val signal = Lazy { (value() || event()) `hold` latestValue } private[ex2013reswing] def fixed = false private[ex2013reswing] def get = latestValue private[ex2013reswing] def use(setter: T => Unit) = { @@ -53,7 +53,7 @@ final case class ReSwingEventValue[T](private val value: Lazy[Event[T]]) extends } final case class ReSwingSignalValue[T](private val value: Lazy[Signal[T]]) extends ReSwingValue[T] { - protected val signal = Lazy { (value().changed || event()) `hold` value().readValueOnce } + protected val signal = Lazy { (value().changed || event()) `hold` value().readValueOnce } private[ex2013reswing] def fixed = true private[ex2013reswing] def get = value().readValueOnce private[ex2013reswing] def use(setter: T => Unit): Unit = { diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample0.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample0.scala index 9db3dc2bf..c28c459f1 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample0.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample0.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.dropdown -import reactives.default.* import ex2013reswing.ReTextField +import reactives.default.* import scala.swing.{BoxPanel, FlowPanel, Label, MainFrame, Orientation, SimpleSwingApplication} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample1.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample1.scala index 0d9202a03..e9f11dbb1 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample1.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample1.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.dropdown -import reactives.default.* import ex2013reswing.ReTextField +import reactives.default.* import scala.swing.{BoxPanel, FlowPanel, Label, MainFrame, Orientation, SimpleSwingApplication} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample2.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample2.scala index d7583fd68..ba0144eb5 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample2.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample2.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.dropdown -import reactives.default.* import ex2013reswing.ReTextField +import reactives.default.* import scala.swing.{BoxPanel, FlowPanel, Label, MainFrame, Orientation, SimpleSwingApplication} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample2b.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample2b.scala index c476b8cfa..a08608029 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample2b.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample2b.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.dropdown -import reactives.default.* import ex2013reswing.ReTextField +import reactives.default.* import scala.swing.{BoxPanel, FlowPanel, Label, MainFrame, Orientation, SimpleSwingApplication} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample3.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample3.scala index b58c97e86..c40d916fa 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample3.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/dropdown/DropdownSample3.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.dropdown -import reactives.default.* import ex2013reswing.ReTextField +import reactives.default.* import scala.swing.* diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MainWindow.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MainWindow.scala index 6b0258145..d925f6458 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MainWindow.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MainWindow.scala @@ -1,9 +1,9 @@ package ex201x.reswingexamples.millgame.versions.signals -import reactives.default.* +import ex2013reswing.{ReComponent, ReLabel, ReSwingValue} import ex201x.reswingexamples.millgame.* import ex201x.reswingexamples.millgame.types.* -import ex2013reswing.{ReComponent, ReLabel, ReSwingValue} +import reactives.default.* import java.awt.{BasicStroke, Color, Dimension, Font, RenderingHints} import scala.swing.* diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MillBoard.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MillBoard.scala index ef40199c2..5d8ac3485 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MillBoard.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MillBoard.scala @@ -1,8 +1,8 @@ package ex201x.reswingexamples.millgame.versions.signals -import reactives.default.* import ex201x.reswingexamples.millgame.* import ex201x.reswingexamples.millgame.types.* +import reactives.default.* class MillBoard { /* wrap stones Var, to have the same interface as other versions */ diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MillGame.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MillGame.scala index 20930deb1..9c988bdf6 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MillGame.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/millgame/versions/signals/MillGame.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.millgame.versions.signals -import reactives.default.* import ex201x.reswingexamples.millgame.types.* +import reactives.default.* sealed abstract class Gamestate { def getPlayer: Slot diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/Main.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/Main.scala index 5aedf6d43..2beddfab1 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/Main.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/Main.scala @@ -1,10 +1,10 @@ package ex201x.reswingexamples.reader -import reactives.default.* import ex201x.reswingexamples.reader.connectors.{CentralizedEvents, SimpleReporter} import ex201x.reswingexamples.reader.data.{FeedStore, RSSItem, XmlParser} import ex201x.reswingexamples.reader.gui.GUI import ex201x.reswingexamples.reader.network.{Fetcher, UrlChecker} +import reactives.default.* import java.net.URL import scala.io.Source diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/connectors/EventMediators.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/connectors/EventMediators.scala index d52a66961..57278e5a0 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/connectors/EventMediators.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/connectors/EventMediators.scala @@ -1,8 +1,8 @@ package ex201x.reswingexamples.reader.connectors -import reactives.default.* import ex201x.reswingexamples.reader.data.{FeedStore, XmlParser} import ex201x.reswingexamples.reader.network.{Fetcher, UrlChecker} +import reactives.default.* trait EventMediator { def mediate(fetcher: Fetcher, parser: XmlParser, store: FeedStore, checker: UrlChecker): Unit diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/data/XmlParser.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/data/XmlParser.scala index acad16725..e385734a9 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/data/XmlParser.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/data/XmlParser.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.reader.data -import reactives.default.* import ex201x.reswingexamples.reader.Observable +import reactives.default.* import java.net.{MalformedURLException, URI, URL} import java.text.{ParseException, SimpleDateFormat} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/gui/GUI.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/gui/GUI.scala index 63c9ea71e..70a70e3a3 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/gui/GUI.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/gui/GUI.scala @@ -1,8 +1,8 @@ package ex201x.reswingexamples.reader.gui -import reactives.default.* -import ex201x.reswingexamples.reader.data.{FeedStore, RSSChannel, RSSItem} import ex2013reswing.{ReButton, ReCheckBox, ReLabel, ReSwingValue} +import ex201x.reswingexamples.reader.data.{FeedStore, RSSChannel, RSSItem} +import reactives.default.* import java.awt.{Dimension, Point, Toolkit} import javax.swing.ImageIcon diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/gui/RssRenderPane.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/gui/RssRenderPane.scala index 3b6288423..084c75094 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/gui/RssRenderPane.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/gui/RssRenderPane.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.reader.gui -import reactives.default.* import ex201x.reswingexamples.reader.data.RSSItem +import reactives.default.* import java.awt.Desktop import java.io.IOException diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/network/Fetcher.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/network/Fetcher.scala index 1a2519397..029cb79f0 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/network/Fetcher.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/network/Fetcher.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.reader.network -import reactives.default.* import ex201x.reswingexamples.reader.Observable +import reactives.default.* import java.net.{SocketException, SocketTimeoutException, URL, UnknownHostException} import scala.xml.{NodeSeq, XML} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/network/UrlChecker.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/network/UrlChecker.scala index e026ed5b7..6baaff1d3 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/network/UrlChecker.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reader/network/UrlChecker.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.reader.network -import reactives.default.* import ex201x.reswingexamples.reader.Observable +import reactives.default.* import java.io.FileNotFoundException import java.net.{MalformedURLException, URI, URL, UnknownHostException} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ReShapes.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ReShapes.scala index 0aa52a4c1..0c1b4128e 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ReShapes.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ReShapes.scala @@ -1,14 +1,14 @@ package ex201x.reswingexamples.reshapes -import ex2013reswing.{ReMenu, ReMenuItem, ReSwingValue} -import reactives.default.* import ex2013reswing.ReMenuItem.toMenuItem +import ex2013reswing.{ReMenu, ReMenuItem, ReSwingValue} import ex201x.reswingexamples.reshapes.actions.{LoadAction, SaveAction} import ex201x.reswingexamples.reshapes.drawing.{Command, DrawingSpaceState, MergeDrawingSpaces, NetworkSpaceState} import ex201x.reswingexamples.reshapes.figures.Shape import ex201x.reswingexamples.reshapes.ui.dialogs.{NewTabDialog, ServerDialog} import ex201x.reswingexamples.reshapes.ui.panels.{CommandPanel, DrawingPanel, InfoPanel, ShapePanel, ShapeSelectionPanel, ShowCoordinateSystem, ShowIntersection, ShowNameLabels, StrokeInputPanel} import ex201x.reswingexamples.reshapes.util.ReactiveUtil.{UnionEvent, bilateralValues} +import reactives.default.* import java.net.{BindException, ConnectException} import javax.swing.JOptionPane diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/actions/Actions.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/actions/Actions.scala index 176e39d55..2b180dc17 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/actions/Actions.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/actions/Actions.scala @@ -1,9 +1,9 @@ package ex201x.reswingexamples.reshapes.actions -import reactives.default.* import ex201x.reswingexamples.reshapes.ReShapes import ex201x.reswingexamples.reshapes.drawing.CreateShape import ex201x.reswingexamples.reshapes.figures.Shape +import reactives.default.* import java.io.File import scala.swing.{Action, FileChooser} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/drawing/DrawingSpaceState.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/drawing/DrawingSpaceState.scala index 727d2349f..ba01b36e7 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/drawing/DrawingSpaceState.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/drawing/DrawingSpaceState.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.reshapes.drawing -import reactives.default.* import ex201x.reswingexamples.reshapes.figures.{Line, Shape} +import reactives.default.* import java.awt.Color import java.io.{OutputStreamWriter, PrintWriter} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/CommandPanel.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/CommandPanel.scala index bafd82069..3117667c2 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/CommandPanel.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/CommandPanel.scala @@ -1,10 +1,10 @@ package ex201x.reswingexamples.reshapes.ui.panels -import reactives.default.* import ex2013reswing.{ReBoxPanel, ReButton} import ex201x.reswingexamples.reshapes.ReShapes import ex201x.reswingexamples.reshapes.drawing.Command import ex201x.reswingexamples.reshapes.util.ReactiveUtil.UnionEvent +import reactives.default.* import scala.swing.{BoxPanel, Component, Orientation, ScrollPane} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/DrawingPanel.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/DrawingPanel.scala index 27b9181a1..9e9458659 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/DrawingPanel.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/DrawingPanel.scala @@ -1,9 +1,9 @@ package ex201x.reswingexamples.reshapes.ui.panels -import reactives.default.* import ex201x.reswingexamples.reshapes.drawing.{Command, CreateShape, DrawingSpaceState, EditShape} import ex201x.reswingexamples.reshapes.figures.{Movable, Resizable, Shape} import ex201x.reswingexamples.reshapes.util.MathUtil +import reactives.default.* import java.awt.BasicStroke import scala.collection.mutable.ListBuffer diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/InfoPanel.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/InfoPanel.scala index a5db0872f..78add4b38 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/InfoPanel.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/InfoPanel.scala @@ -1,8 +1,8 @@ package ex201x.reswingexamples.reshapes.ui.panels -import reactives.default.* import ex2013reswing.ReLabel import ex201x.reswingexamples.reshapes.ReShapes +import reactives.default.* import scala.swing.FlowPanel diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/ShapePanel.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/ShapePanel.scala index aaebf29cc..eb7b46db0 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/ShapePanel.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/ShapePanel.scala @@ -1,11 +1,11 @@ package ex201x.reswingexamples.reshapes.ui.panels -import reactives.default.* import ex2013reswing.{ReBoxPanel, ReButton} import ex201x.reswingexamples.reshapes.ReShapes import ex201x.reswingexamples.reshapes.drawing.{DeleteShape, DrawingSpaceState} import ex201x.reswingexamples.reshapes.figures.Shape import ex201x.reswingexamples.reshapes.util.ReactiveUtil.UnionEvent +import reactives.default.* import scala.swing.{BoxPanel, Color, Component, Label, Orientation, ScrollPane} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/ShapeSelectionPanel.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/ShapeSelectionPanel.scala index d8ad5383c..034767699 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/ShapeSelectionPanel.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/ShapeSelectionPanel.scala @@ -1,9 +1,9 @@ package ex201x.reswingexamples.reshapes.ui.panels -import reactives.default.* import ex2013reswing.ReButton import ex201x.reswingexamples.reshapes.ReShapes import ex201x.reswingexamples.reshapes.figures.{Freedraw, Line, Oval, Rectangle, Shape, Triangle} +import reactives.default.* import scala.swing.{BoxPanel, Orientation} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/StrokeInputPanel.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/StrokeInputPanel.scala index 7ee090427..3bc5417fa 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/StrokeInputPanel.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/reshapes/ui/panels/StrokeInputPanel.scala @@ -1,8 +1,7 @@ package ex201x.reswingexamples.reshapes.ui.panels -import ex2013reswing.{ReSlider, ReSwingValue} +import ex2013reswing.{ReButton, ReSlider, ReSwingValue} import reactives.default.* -import ex2013reswing.ReButton import java.awt.Color import javax.swing.JColorChooser diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/Application.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/Application.scala index 2058df1b6..50ca2c63e 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/Application.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/Application.scala @@ -1,7 +1,7 @@ package ex201x.reswingexamples.texteditor.signalsAndEventsFromImperative -import reactives.default.* import ex2013reswing.{ReButton, ReLabel} +import reactives.default.* import scala.swing.BorderPanel.Position import scala.swing.{BorderPanel, Dimension, GridPanel, MainFrame, ScrollPane, SimpleSwingApplication} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/ApplicationSwingTextArea.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/ApplicationSwingTextArea.scala index 7e8d3da90..817336c87 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/ApplicationSwingTextArea.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/ApplicationSwingTextArea.scala @@ -1,8 +1,7 @@ package ex201x.reswingexamples.texteditor.signalsAndEventsFromImperative -import ex2013reswing.{ReLabel, ReTextArea} +import ex2013reswing.{ReButton, ReLabel, ReTextArea} import reactives.default.* -import ex2013reswing.ReButton import scala.math.min import scala.swing.BorderPanel.Position diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/TextArea.scala b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/TextArea.scala index cf8caa65c..1c791aa17 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/TextArea.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex201x/reswingexamples/texteditor/signalsAndEventsFromImperative/TextArea.scala @@ -1,8 +1,8 @@ package ex201x.reswingexamples.texteditor.signalsAndEventsFromImperative import ex2013reswing.{ReComponent, ReSwingValue} -import reactives.default.* import ex201x.reswingexamples.texteditor.{JScrollableComponent, LineIterator, LineOffset, Position} +import reactives.default.* import java.awt.datatransfer.{DataFlavor, StringSelection} import java.awt.{Dimension, Graphics2D, Point, Rectangle, SystemColor, Toolkit} diff --git a/Modules/Examples/Misc JVM/src/main/scala/ex2024bft/BFT.scala b/Modules/Examples/Misc JVM/src/main/scala/ex2024bft/BFT.scala index 2fb95900a..e41e4cfb4 100644 --- a/Modules/Examples/Misc JVM/src/main/scala/ex2024bft/BFT.scala +++ b/Modules/Examples/Misc JVM/src/main/scala/ex2024bft/BFT.scala @@ -42,18 +42,18 @@ object BFTDelta { } -case class BFT[V] (deltas: Set[BFTDelta[V]]) { +case class BFT[V](deltas: Set[BFTDelta[V]]) { def value(using b: Bottom[V], lat: Lattice[V]): V = { val graph = reverseGraph() - if (!graph.contains(None)) return b.empty + if !graph.contains(None) then return b.empty - val worklist = mutable.Queue[BFTDelta[V]](graph(None).toList *) + val worklist = mutable.Queue[BFTDelta[V]](graph(None).toList*) val connected = mutable.Set[BFTDelta[V]]() - while (worklist.nonEmpty) { + while worklist.nonEmpty do { val elem = worklist.dequeue() connected.add(elem) worklist.enqueueAll(graph.getOrElse(Some(elem.hash), Set.empty[BFTDelta[V]])) @@ -62,13 +62,12 @@ case class BFT[V] (deltas: Set[BFTDelta[V]]) { connected.map(_.value).foldLeft(b.empty)((l, r) => l.merge(r)) } - /** - * Generates a BFT delta containing an update with a value delta. This assumes, that the RDT that's wrapped in the - * BFT generates deltas. - * - * @param f Function which takes the current state as input and returns a new delta. - * @return BFT containing one BFTDelta with the update. - */ + /** Generates a BFT delta containing an update with a value delta. This assumes, that the RDT that's wrapped in the + * BFT generates deltas. + * + * @param f Function which takes the current state as input and returns a new delta. + * @return BFT containing one BFTDelta with the update. + */ def update(f: V => V)(using Byteable[V], Lattice[V], Bottom[V]): BFT[V] = { val newValue = f(value) @@ -77,7 +76,8 @@ case class BFT[V] (deltas: Set[BFTDelta[V]]) { BFT(Set(delta)) } - lazy val heads: Set[Hash] = deltas.filter { item => deltas.forall { a => !a.predecessors.contains(item.hash) } }.map(_.hash) + lazy val heads: Set[Hash] = + deltas.filter { item => deltas.forall { a => !a.predecessors.contains(item.hash) } }.map(_.hash) def reverseGraph(): Map[Option[Hash], Set[BFTDelta[V]]] = { val reverseGraph = mutable.Map[Option[Hash], Set[BFTDelta[V]]]() @@ -86,9 +86,9 @@ case class BFT[V] (deltas: Set[BFTDelta[V]]) { reverseGraph.updateWith(from)(_.fold(Some(Set(to)))(it => Some(it + to))) } - for (delta <- deltas) { - if (delta.predecessors.isEmpty) addToGraph(None, delta) - else for (hash <- delta.predecessors) addToGraph(Some(hash), delta) + for delta <- deltas do { + if delta.predecessors.isEmpty then addToGraph(None, delta) + else for hash <- delta.predecessors do addToGraph(Some(hash), delta) } reverseGraph.toMap @@ -103,12 +103,13 @@ object BFT { def apply[V](initial: V)(using Byteable[V]): BFT[V] = BFT(Set(BFTDelta(initial, Set.empty))) def lattice[V](using lat: Lattice[V])(using Byteable[V]): Lattice[BFT[V]] = { - (left: BFT[V], right: BFT[V]) => { - BFT((left.deltas ++ right.deltas).filter(_.hashCorrect)) - } + (left: BFT[V], right: BFT[V]) => + { + BFT((left.deltas ++ right.deltas).filter(_.hashCorrect)) + } } def hash[V](value: V, heads: Set[Hash])(using ch: Byteable[V]): Hash = - Hash(BFT.digest.digest(Array.concat(ch.toBytes(value) :: heads.toList.map(_.content) *))) + Hash(BFT.digest.digest(Array.concat(ch.toBytes(value) :: heads.toList.map(_.content)*))) } diff --git a/Modules/Examples/Misc JVM/src/test/scala/ex2024bft/BFTTest.scala b/Modules/Examples/Misc JVM/src/test/scala/ex2024bft/BFTTest.scala index 154ec0f54..c0d5ae4fe 100644 --- a/Modules/Examples/Misc JVM/src/test/scala/ex2024bft/BFTTest.scala +++ b/Modules/Examples/Misc JVM/src/test/scala/ex2024bft/BFTTest.scala @@ -1,6 +1,5 @@ package ex2024bft -import ex2024bft.{BFT, Byteable} import rdts.base.* import rdts.datatypes.* diff --git a/Modules/Examples/TodoMVC/src/main/scala/todo/Todolist.scala b/Modules/Examples/TodoMVC/src/main/scala/todo/Todolist.scala index f61301a7b..359122741 100644 --- a/Modules/Examples/TodoMVC/src/main/scala/todo/Todolist.scala +++ b/Modules/Examples/TodoMVC/src/main/scala/todo/Todolist.scala @@ -1,9 +1,9 @@ package todo +import dtn.rdt.Channel import org.scalajs.dom.{document, window} import rdts.base.{Lattice, LocalUid} import reactives.extra.Tags.reattach -import dtn.rdt.Channel import replication.WebRTCConnectionView import scalatags.JsDom.all import scalatags.JsDom.all.given