Skip to content

Commit

Permalink
refactor: remove environment data module and directly exposes classes
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGiulianelli committed Feb 23, 2023
1 parent 27795cb commit 7a2a034
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 43 deletions.
78 changes: 36 additions & 42 deletions src/main/kotlin/entity/environment/EnvironmentData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,50 @@
package entity.environment

/**
* Module that contains all the data useful to describe an environment.
* Temperature concept.
* It is described by the current temperature [value] expressed in a [unit].
*/
object EnvironmentData {

/**
* Temperature concept.
* It is described by the current temperature [value] expressed in a [unit].
*/
data class Temperature(val value: Double, val unit: TemperatureUnit = TemperatureUnit.CELSIUS)

/**
* This enum describe the possible [Temperature] unit of measurement.
*/
enum class TemperatureUnit {
/**
* Celsius unit.
*/
CELSIUS
}
data class Temperature(val value: Double, val unit: TemperatureUnit = TemperatureUnit.CELSIUS)

/**
* This enum describe the possible [Temperature] unit of measurement.
*/
enum class TemperatureUnit {
/**
* Humidity concept.
* It is described by the current [percentage] of humidity. So it describes the Relative Humidity.
* Celsius unit.
*/
data class Humidity(val percentage: Double)
CELSIUS
}

/**
* Luminosity concept.
* It is described by the current luminosity [value] expressed in a [unit].
*/
data class Luminosity(val value: Double, val unit: LightUnit = LightUnit.LUX) {
init {
// Constructor validation
require(this.value >= 0)
}
}
/**
* Humidity concept.
* It is described by the current [percentage] of humidity. So it describes the Relative Humidity.
*/
data class Humidity(val percentage: Double)

/**
* This enum describe the possibile [Luminosity] unit of measurement.
*/
enum class LightUnit {
/**
* Lux unit.
*/
LUX
/**
* Luminosity concept.
* It is described by the current luminosity [value] expressed in a [unit].
*/
data class Luminosity(val value: Double, val unit: LightUnit = LightUnit.LUX) {
init {
// Constructor validation
require(this.value >= 0)
}
}

/**
* This enum describe the possibile [Luminosity] unit of measurement.
*/
enum class LightUnit {
/**
* Describe the presence inside a Room of the Operating Block.
* @param[presenceDetected] true if someone is in the room, false otherwise.
* Lux unit.
*/
data class Presence(val presenceDetected: Boolean)
LUX
}

/**
* Describe the presence inside a Room of the Operating Block.
* @param[presenceDetected] true if someone is in the room, false otherwise.
*/
data class Presence(val presenceDetected: Boolean)
1 change: 0 additions & 1 deletion src/test/kotlin/entity/environment/LuminosityTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

package entity.environment

import entity.environment.EnvironmentData.Luminosity
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.StringSpec

Expand Down

0 comments on commit 7a2a034

Please sign in to comment.