Skip to content

Instantly share code, notes, and snippets.

@hackjutsu
Created May 20, 2019 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hackjutsu/ca24edcb1f4dbf9a9ef77b2869d50b9f to your computer and use it in GitHub Desktop.
Save hackjutsu/ca24edcb1f4dbf9a9ef77b2869d50b9f to your computer and use it in GitHub Desktop.
[medium snippets] #medium #designPattern #FacadePattern
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