Chronos Plugins 5.4.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()

◆ 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 MockPlugin.Device.CoffeMakerParams.AmbientLight, and MockPlugin.Device.CoffeMakerParams.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 MockPlugin.Device.CoffeMakerParams.AmbientLight, and MockPlugin.Device.CoffeMakerParams.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 MockPlugin.Device.CoffeMakerParams.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 MockPlugin.Device.CoffeMakerParams.GetHashCode().

Property Documentation

◆ AmbientLight

bool MockPlugin.Device.CoffeMakerParams.AmbientLight
getset

◆ WarmerTemperature

int? MockPlugin.Device.CoffeMakerParams.WarmerTemperature
getset

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