-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To understand the command pattern Fan model added.
- Loading branch information
sandeep
committed
Feb 3, 2016
1 parent
8c6e6b8
commit 1ff97a9
Showing
6 changed files
with
82 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.sandeep.command; | ||
|
||
public class Fan { | ||
|
||
public void rotateFan(){ | ||
|
||
System.out.println("Fan is rotating now"); | ||
} | ||
|
||
public void stopFan(){ | ||
|
||
System.out.println("Fan is stoped"); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package org.sandeep.command; | ||
|
||
public class Light { | ||
public void turnOn(){ | ||
|
||
System.out.println("Light are on.."); | ||
} | ||
public void turnOn(){ | ||
|
||
public void turnOff(){ | ||
|
||
System.out.println("Light are Off"); | ||
} | ||
System.out.println("Light are on.."); | ||
} | ||
|
||
public void turnOff(){ | ||
|
||
System.out.println("Light are Off"); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.sandeep.command; | ||
|
||
public class RotateFan implements Command { | ||
|
||
private Fan fan; | ||
|
||
|
||
|
||
|
||
public RotateFan(Fan fan) { | ||
// TODO Auto-generated constructor stub | ||
this.fan= fan; | ||
} | ||
|
||
|
||
|
||
@Override | ||
public void execute() { | ||
// TODO Auto-generated method stub | ||
this.fan.rotateFan(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.sandeep.command; | ||
|
||
public class StopFan implements Command { | ||
|
||
private Fan fan ; | ||
public StopFan(Fan fan){ | ||
this.fan= fan; | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
// TODO Auto-generated method stub | ||
this.fan.stopFan(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters