This repository has been archived by the owner on Mar 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify case classes which use a Map by inheritance
- Loading branch information
Showing
6 changed files
with
23 additions
and
21 deletions.
There are no files selected for viewing
5 changes: 1 addition & 4 deletions
5
src/main/scala/de/retest/guistatemachine/model/GuiApplications.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
package de.retest.guistatemachine.model | ||
|
||
final case class GuiApplications(applications: Map[GuiApplication]) { | ||
// TODO Generate IDs in a better way. Maybe random numbers until one unused element is found? | ||
def generateId: Id = this.synchronized { if (applications.values.isEmpty) Id(0) else Id(applications.values.keySet.max.id + 1) } | ||
} | ||
final case class GuiApplications(var values: scala.collection.immutable.Map[Id, GuiApplication]) extends Map[GuiApplication](values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
src/main/scala/de/retest/guistatemachine/model/TestSuites.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
package de.retest.guistatemachine.model | ||
|
||
final case class TestSuites(testSuites: Map[TestSuite]) { | ||
// TODO Generate IDs in a better way. Maybe random numbers until one unused element is found? | ||
def generateId: Id = this.synchronized { if (testSuites.values.isEmpty) Id(0) else Id(testSuites.values.keySet.max.id + 1) } | ||
} | ||
final case class TestSuites(var values: scala.collection.immutable.Map[Id, TestSuite]) extends Map[TestSuite](values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters