Created
May 20, 2019 05:39
-
-
Save hackjutsu/ca24edcb1f4dbf9a9ef77b2869d50b9f to your computer and use it in GitHub Desktop.
[medium snippets] #medium #designPattern #FacadePattern
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
public class ComputerFacade { | |
static private final long BOOT_ADDRESS = 0; | |
static private final long BOOT_SECTOR = 0; | |
static private final int SECTOR_SIZE = 0; | |
private CPU processor; | |
private Memory ram; | |
private HardDrive hd; | |
public ComputerFacade() { | |
this.processor = new CPU(); | |
this.ram = new Memory(); | |
this.hd = new HardDrive(); | |
} | |
public void start() { | |
processor.freeze(); | |
ram.load(BOOT_ADDRESS, hd.read(BOOT_SECTOR, SECTOR_SIZE)); | |
processor.jump(BOOT_ADDRESS); | |
processor.execute(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment