You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
579 B
23 lines
579 B
package patronCommand;
|
|
|
|
//Esta clase seria el Cliente, que pulsa el interruptor.
|
|
public class Main {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
//instancia del RECEPTOR.
|
|
//Llamada bombilla por facilitar entender el programa.
|
|
Luz bombilla = new Luz();
|
|
|
|
//intancias de las ordenes concretas
|
|
Orden interruptorUp = new OrdenEncender(bombilla);
|
|
Orden interruptorDown = new OrdenApagar(bombilla);
|
|
|
|
//instancia del INVOCADOR pasandole las ordenes concretas.
|
|
Interruptor i = new Interruptor(interruptorUp,interruptorDown);
|
|
|
|
i.encender();
|
|
i.apagar();
|
|
}
|
|
|
|
}
|
|
|