class Sensor
{
private Command _command;
public void SetCommand(Command cmd)
{
_command = cmd;
}
public void ActEvent()
{
_command.Do();
}
}
class Command
{
public void Do()
{
// Some Action
}
}
class Sensor
{
private List<Command> _commandList;
public void AddCommand(Command cmd)
{
_commandList.Add(cmd);
}
public void ActEvent()
{
foreach (var command in _commandList)
{
command.Do();
}
}
}
class Sensor
{
private Command _command;
public void SetCommand(Command cmd)
{
_command = cmd;
}
public void ActEvent()
{
command.Do();
}
}
class Command
{
public virtual void Do()
{
// Some Action
}
}
class CompositeCommand : Command
{
private List<Command> _commands;
public override void Do()
{
foreach (var command in _commands)
{
command.Do();
}
}
}