aboutsummaryrefslogtreecommitdiff
path: root/src/main/ui/UIHandler.java
blob: f451542a2a723341f952bf4503d43b1fcb1ee6a4 (plain)
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
package ui;

/**
 * Represents a screen
 */
public interface UIHandler {
    /**
     * EFFECTS: Called when the screen is switched to.
     */
    default void enter(Object... args) {

    }

    /**
     * EFFECTS: Show objects. command() will not be called.
     */
    void show();

    /**
     * EFFECTS: Commit changes and exit. command() will not be called.
     */
    default void commit() {
    }

    /**
     * EFFECTS: Discard changes and exit. command() will not be called. Returns the next screen.
     */
    Screen exit();

    /**
     * EFFECTS: Run help. command() will not be called.
     */
    void help();

    /**
     * EFFECTS: Any commands rather than commit / exit / help.
     * REQUIRES: args != null && args.length >= 1
     */
    void command(String... args);

    /**
     * EFFECTS: Return the current PS1 prompt.
     */
    String getPS1();
}