Chronos Plugins 5.11.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
MockPlugin.Device.CoffeMakerParams Class Reference

We have a fancy coffee machine that can regulate the warmer temperature for the pot and has lamps for ambient light. More...

Public Member Functions

override string ToString ()
override bool Equals (object obj)
override int GetHashCode ()
 Since all parameters are represented in the ToString representation, we can use its hash code instead of coming up with a different calculation method.
int CompareTo (object obj)
CoffeMakerParams Clone ()

Properties

bool AmbientLight [get, set]
int? WarmerTemperature [get, set]

Detailed Description

We have a fancy coffee machine that can regulate the warmer temperature for the pot and has lamps for ambient light.

You must override the Equals operator to allow Chronos to check if two method's settings are compatible. Any better ideas? Your suggestions are welcome.

Definition at line 16 of file CoffeMakerParams.cs.

Member Function Documentation

◆ Clone()

CoffeMakerParams MockPlugin.Device.CoffeMakerParams.Clone ( )

Definition at line 57 of file CoffeMakerParams.cs.

58 {
59 return new CoffeMakerParams() {AmbientLight = AmbientLight, WarmerTemperature = WarmerTemperature};
60 }

References AmbientLight, and WarmerTemperature.

◆ CompareTo()

int MockPlugin.Device.CoffeMakerParams.CompareTo ( object obj)

Definition at line 45 of file CoffeMakerParams.cs.

46 {
47 if (obj is CoffeMakerParams other && other.AmbientLight == AmbientLight && other.WarmerTemperature == WarmerTemperature)
48 {
49 return 0;
50 }
51 else
52 {
53 return 1;
54 }
55 }

References AmbientLight, and WarmerTemperature.

◆ Equals()

override bool MockPlugin.Device.CoffeMakerParams.Equals ( object obj)

Definition at line 28 of file CoffeMakerParams.cs.

29 {
30 return obj is CoffeMakerParams other && other.AmbientLight == AmbientLight &&
31 other.WarmerTemperature == WarmerTemperature;
32 }

References AmbientLight, and WarmerTemperature.

◆ GetHashCode()

override int MockPlugin.Device.CoffeMakerParams.GetHashCode ( )

Since all parameters are represented in the ToString representation, we can use its hash code instead of coming up with a different calculation method.

Returns

Definition at line 38 of file CoffeMakerParams.cs.

39 {
40 return ToString().GetHashCode();
41 }

References ToString().

◆ ToString()

override string MockPlugin.Device.CoffeMakerParams.ToString ( )

Definition at line 21 of file CoffeMakerParams.cs.

22 {
23 return $"Ambient light {(AmbientLight ? "on" : "off")}, warmer temperature (°C) {(WarmerTemperature?.ToString() ?? "(off)")}";
24 }

Referenced by GetHashCode().

Property Documentation

◆ AmbientLight

bool MockPlugin.Device.CoffeMakerParams.AmbientLight
getset

Definition at line 18 of file CoffeMakerParams.cs.

18{ get; set; }

Referenced by Clone(), CompareTo(), and Equals().

◆ WarmerTemperature

int? MockPlugin.Device.CoffeMakerParams.WarmerTemperature
getset

Definition at line 19 of file CoffeMakerParams.cs.

19{ get; set; }

Referenced by Clone(), CompareTo(), and Equals().


The documentation for this class was generated from the following file: