This file contains hidden or 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
| package DIP; | |
| public enum Relationship { | |
| PARENT, | |
| CHILD, | |
| SIBLING | |
| } |
This file contains hidden or 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
| package ISP; | |
| public class MultiFunctionMachine implements MultiFunctionDevice{ | |
| private Printer printer; | |
| private Scanner scanner; | |
| public MultiFunctionMachine(Printer printer, Scanner scanner) { | |
| super(); | |
| this.printer = printer; | |
| this.scanner = scanner; |
This file contains hidden or 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
| package ISP; | |
| public class MultiFunctionMachine implements MultiFunctionDevice{ | |
| private Printer printer; | |
| private Scanner scanner; | |
| public MultiFunctionMachine(Printer printer, Scanner scanner) { | |
| super(); | |
| this.printer = printer; | |
| this.scanner = scanner; |
This file contains hidden or 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
| package ISP; | |
| public interface MultiFunctionDevice extends Printer,Scanner{} |
This file contains hidden or 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
| package ISP; | |
| public class Photocopier implements Printer,Scanner{ | |
| @Override | |
| public void scan(Document d) { | |
| // doSomething scan | |
| } | |
| @Override |
This file contains hidden or 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
| package ISP; | |
| public class JustAPrinter implements Printer{ | |
| @Override | |
| public void print(Document d) { | |
| // doSomething print | |
| } | |
| } |
This file contains hidden or 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
| package ISP; | |
| public interface Scanner { | |
| void scan(Document d); | |
| } |
This file contains hidden or 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
| package ISP; | |
| public interface Printer { | |
| void print(Document d); | |
| } |
This file contains hidden or 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
| package ISP; | |
| public class OldFashionPrinter implements Machine{ | |
| @Override | |
| public void print(Document d) { | |
| // still can doSomething print | |
| } | |
| @Override |
This file contains hidden or 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
| package ISP; | |
| public class MultiFunctionPrinter implements Machine{ | |
| @Override | |
| public void print(Document d) { | |
| // doSomething print | |
| } | |
| @Override |