|
11 | 11 | */ |
12 | 12 | public class JShellState implements IShellState { |
13 | 13 | // this is the file system |
14 | | - private FileSystem fs; |
| 14 | + private final FileSystem fs; |
15 | 15 | // this is the current directory of JShell program |
16 | 16 | private Directory currentDir; |
17 | 17 | // this indicates if the program is running or not |
18 | 18 | private boolean running; |
19 | 19 | // a stack used for push and pop command |
20 | | - private Stack<Directory> directoryStack; |
21 | | - private ArrayList<String> commandsHistory; |
22 | | - private ArrayList<String> correctCommandsHistory; |
| 20 | + private final Stack<Directory> directoryStack; |
| 21 | + private final ArrayList<String> commandsHistory; |
| 22 | + private final ArrayList<String> correctCommandsHistory; |
23 | 23 |
|
24 | 24 | /** |
25 | 25 | * Constructs an object that holds JShell's important states including |
26 | 26 | * the root directory, current directory, directory stack and a boolean that |
27 | 27 | * indicates JShell is running |
28 | | - * @param rootDir determines root and current directory of the program |
29 | 28 | */ |
30 | 29 | public JShellState() { |
31 | 30 | this.running = true; |
32 | 31 | this.fs = FileSystem.createFileSystemInstance(); |
33 | 32 | this.currentDir = fs.getRoot(); |
34 | | - this.commandsHistory = new ArrayList<String>(); |
| 33 | + this.commandsHistory = new ArrayList<>(); |
35 | 34 | this.correctCommandsHistory = new ArrayList<>(); |
36 | | - this.directoryStack = new Stack<Directory>(); |
| 35 | + this.directoryStack = new Stack<>(); |
37 | 36 | } |
38 | 37 |
|
39 | 38 | public boolean isRunning() { |
|
0 commit comments