• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Scala-Robotics-Simulator / PPS-22-srs / #432

28 Aug 2025 06:46PM UTC coverage: 47.623% (-0.2%) from 47.836%
#432

push

github

srs-mate
refactor: update output message to clarify simulation result in CLI

0 of 1 new or added line in 1 file covered. (0.0%)

125 existing lines in 8 files now uncovered.

1282 of 2692 relevant lines covered (47.62%)

6.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/scala/io/github/srs/view/ViewModule.scala
1
package io.github.srs.view
2

3
import cats.effect.IO
4
import cats.effect.std.Queue
5
import io.github.srs.controller.protocol.Event
6
import io.github.srs.model.ModelModule
7

8
/**
9
 * Module that defines the view logic for the Scala Robotics Simulator.
10
 */
11
object ViewModule:
12

×
13
  /**
14
   * View trait that defines the interface for the view.
15
   *
16
   * @tparam S
17
   *   the type of the state, which must extend [[ModelModule.State]].
18
   */
19
  trait View[S <: ModelModule.State]:
20

×
21
    /**
22
     * Initializes the view with a queue for handling events.
23
     * @param queue
24
     *   the queue that will be used to handle events in the view.
25
     * @return
26
     *   an [[IO]] task that completes when the initialization is done.
27
     */
28
    def init(queue: Queue[IO, Event]): IO[Unit]
29

30
    /**
31
     * Renders the view based on the current state.
32
     * @param state
33
     *   the current state of the simulation, which must extend [[ModelModule.State]].
34
     * @return
35
     *   the rendering task, which is an [[IO]] that completes when the rendering is done.
36
     */
37
    def render(state: S): IO[Unit]
38

39
    /**
40
     * Closes the view and releases any resources.
41
     * @return
42
     *   an [[IO]] task that completes when the view is closed.
43
     */
44
    def close(): IO[Unit]
45

46
    /**
47
     * Handles the event when a certain amount of time has elapsed in the simulation.
48
     * @param state
49
     *   the resulting state after time has elapsed.
50
     * @return
51
     *   an [[IO]] task that completes when the time elapsed event is handled.
52
     */
53
    def timeElapsed(state: S): IO[Unit]
54

55
  end View
56

57
  /**
58
   * Provider trait that defines the interface for providing a view.
59
   * @tparam S
60
   *   the type of the state, which must extend [[ModelModule.State]].
61
   */
62
  trait Provider[S <: ModelModule.State]:
63
    val view: View[S]
64

65
  /**
66
   * Defines the dependencies required by the view module. In particular, it requires a
67
   * [[io.github.srs.controller.ControllerModule.Provider]].
68
   */
69
  type Requirements[S <: ModelModule.State] = io.github.srs.controller.ControllerModule.Provider[S]
70

71
  /**
72
   * Component trait that defines the interface for creating a view.
73
   *
74
   * @tparam S
75
   *   the type of the simulation state, which must extend [[ModelModule.State]].
76
   */
77
  trait Component[S <: ModelModule.State]:
UNCOV
78
    context: Requirements[S] =>
×
79

80
    /**
81
     * Factory method to create a new instance of the view.
82
     */
83
    object View:
UNCOV
84
      /**
×
85
       * Creates a new instance of the view.
86
       * @return
87
       *   the newly created view instance.
88
       */
89
      def apply(): View[S] = makeView()
UNCOV
90

×
91
    /**
92
     * Creates a new instance of the view.
93
     * @return
94
     *   the newly created view instance.
95
     */
96
    protected def makeView(): View[S]
97

98
  end Component
99

100
  /**
101
   * Interface trait that combines the provider and component traits for the view module.
102
   * @tparam S
103
   *   the type of the state, which must extend [[ModelModule.State]].
104
   */
105
  trait Interface[S <: ModelModule.State] extends Provider[S] with Component[S]:
106
    self: Requirements[S] =>
107
end ViewModule
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc