Skip to content
Snippets Groups Projects
Commit 9cff2d4c authored by Ali Najafi's avatar Ali Najafi
Browse files

example notify and uml

parent 1203b74a
No related branches found
No related tags found
No related merge requests found
class Device
{
-SmartHomeHub Mediator
}
Device <--> Mediator : uses
class Thermometer
{
+TempratureChanged()
+GetCurrentTemp() : double
}
class Heater
{
+TurnOnHeater()
+TurnOffHeater()
}
interface Mediator
{
+Notify(device: Device, event: string)
}
class SmartHomeHub
{
- Heater heater
- Thermostat thermostat
+ Notify(device: Device, event: string)
}
SmartHomeHub *-- Heater
SmartHomeHub *-- Thermometer
Mediator <|.. SmartHomeHub
Device <|-- Heater
Device <|-- Thermometer
\ No newline at end of file
......@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("SmartHome.App")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2c766bda0e67a7f9be27b4ba6d4f91cca15aa2a9")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1203b74a0327e89c5bf7c2a2be7344d5c270c07b")]
[assembly: System.Reflection.AssemblyProductAttribute("SmartHome.App")]
[assembly: System.Reflection.AssemblyTitleAttribute("SmartHome.App")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
......
e03fef4ec976f84142376e3337b66f93f73111c5ceeda4f1e43e9080a835d2bb
094e9587b339822b322bdc7f49db8e0db36ebb4254fb05a258b5d68a55ba3013
......@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("SmartHome.Lib")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2c766bda0e67a7f9be27b4ba6d4f91cca15aa2a9")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1203b74a0327e89c5bf7c2a2be7344d5c270c07b")]
[assembly: System.Reflection.AssemblyProductAttribute("SmartHome.Lib")]
[assembly: System.Reflection.AssemblyTitleAttribute("SmartHome.Lib")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
......
6c935025f0df1424bfd70ce21c08753c6b935a6c2942052a26ece32a379ee75d
4c1849acca165cecac1d9db0e7ff2529e34a890df5713e1757a1c0dcb2d66321
@startuml
@startuml
interface SmartHomeMediator {
+notify(SmartDevice sender, string event)
......
test.cs 0 → 100644
public void Notify(Device sender, string event)
{
if (sender == thermostat && event== "Temprature Changed")
{
double currentTemp = thermostat.GetCurrentTemp();
if (currentTemp < 15) Heater.TurnOnHeater();
else if (currentTemp > 20) Heater.TurnOffHeater();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment