-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilePathManager.java
More file actions
81 lines (73 loc) · 2.82 KB
/
FilePathManager.java
File metadata and controls
81 lines (73 loc) · 2.82 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package ie.atu.sw;
import java.util.Scanner;
/**
* Manages file path updates for all the files
* Handler for specifying and modifying file paths
*
*/
public class FilePathManager {
private MenuFilePathProcessor menuFilePathProcessor;
/**
* Constructs a new FilePathManager
*
* Initializes a MenuFilePathProcessor with MenuFilePathDisplay for handling user interaction
*/
public FilePathManager() {
MenuFilePathDisplay display = new MenuFilePathDisplay();
this.menuFilePathProcessor = new MenuFilePathProcessor(display);
}
/**
* Specifies the file path for the given PathType
*
* Delegates the file path specification to the appropriate private method
*
* @param scanner Instance for capturing user input
* @param pathType Enum value indicating the type of file path
* @throws IllegalArgumentException If the pathType is unknown
*/
public void specifyFile(Scanner scanner, PathType pathType) { //Big O = O(1)
switch (pathType) {
case EMBEDDING -> specifyEmbeddingFile(scanner);
case GOOGLE -> specifyGoogleFile(scanner);
case TEXT -> specifyTextFile(scanner);
case OUTPUT -> specifyOutputFile(scanner);
default -> throw new IllegalArgumentException("Unknown PathType: " + pathType);
}
}
/**
* Specifies the file path for the embeddings file delegating input and validation to
* MenuFilePathProcessor
*
* @param scanner Instance for capturing user input
*/
private void specifyEmbeddingFile(Scanner scanner) { //Big O = O(1)
menuFilePathProcessor.processFilePath(scanner, PathType.EMBEDDING);
}
/**
* Specifies the file path for the Google-1000 file delegating input and validation to
* MenuFilePathProcessor
*
* @param scanner Instance for capturing user input
*/
private void specifyGoogleFile(Scanner scanner) { //Big O = O(1)
menuFilePathProcessor.processFilePath(scanner, PathType.GOOGLE);
}
/**
* Specifies the file path for the InputText file delegating input and validation to
* MenuFilePathProcessor
*
* @param scanner Instance for capturing user input
*/
private void specifyTextFile(Scanner scanner) { //Big O = O(1)
menuFilePathProcessor.processFilePath(scanner, PathType.TEXT);
}
/**
* Specifies the file path for the Output file delegating input and validation to
* MenuFilePathProcessor
*
* @param scanner Instance for capturing user input
*/
private void specifyOutputFile(Scanner scanner) { //Big O = O(1)
menuFilePathProcessor.processFilePath(scanner, PathType.OUTPUT);
}
}