-
Notifications
You must be signed in to change notification settings - Fork 275
Expand file tree
/
Copy pathScene.java
More file actions
48 lines (38 loc) · 1.12 KB
/
Copy pathScene.java
File metadata and controls
48 lines (38 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package subway;
import java.io.PrintStream;
import java.util.Scanner;
import java.util.Stack;
import subway.controller.MainViewController;
import subway.controller.ViewController;
public class Scene {
private final Scanner scanner;
private final PrintStream printStream;
private final Stack<ViewController> controllers = new Stack<ViewController>();
public Scene(Scanner scanner, PrintStream printStream) {
this.scanner = scanner;
this.printStream = printStream;
controllers.add(new MainViewController(scanner, printStream));
}
public void runCurrentView() {
ViewController viewController = controllers.peek();
viewController.run(this);
}
public void goView(ViewController controller) {
controllers.push(controller);
}
public void back() {
controllers.pop();
}
public void exit() {
controllers.clear();
}
public boolean isExit() {
return controllers.empty();
}
public Scanner getScanner() {
return scanner;
}
public PrintStream getPrinstream() {
return printStream;
}
}