Last active
April 30, 2019 13:15
-
-
Save NRBPerdijk/4c64c4966621cbd6567b39e15208bc47 to your computer and use it in GitHub Desktop.
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
/* | |
* Our Domain object functions as a factory for our domain-related classes. | |
* It has methods that create new instances of these classes, which can then safely be used from another Context. | |
*/ | |
class Domain { | |
def weatherForecastList(): WeatherForecastList = WeatherForecastList(List()) | |
def percentage(percent: Int): Percentage = Percentage(percent: Double) | |
def chanceOfRain(chance: Percentage): ChanceOfRain = ChanceOfRain(chance: Percentage) | |
def temperature(degrees: Int, temperatureScale: String): Temperature = | |
Temperature(degrees: Int, temperatureScale: String) | |
def windSpeed(scale: String, speed: Int): WindSpeed = | |
WindSpeed(scale: String, speed: Int) | |
def windForecast(windSpeed: WindSpeed, direction: String): WindForecast = | |
WindForecast(windSpeed: WindSpeed, direction: String) | |
def weatherForecast( | |
humidity: Percentage, | |
windForecast: WindForecast, | |
sunshine: Percentage, | |
temperature: Temperature, | |
chanceOfRain: ChanceOfRain): WeatherForecast = | |
WeatherForecast(humidity, windForecast, sunshine, temperature, chanceOfRain) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment