Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Complex parts */
- class CPU {
- public void freeze() { ... }
- public void jump(long position) { ... }
- public void execute() { ... }
- }
- class HardDrive {
- public byte[] read(long lba, int size) { ... }
- }
- class Memory {
- public void load(long position, byte[] data) { ... }
- }
- /* Facade */
- class ComputerFacade {
- 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();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement