-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTargets.java
More file actions
49 lines (42 loc) · 1.45 KB
/
Targets.java
File metadata and controls
49 lines (42 loc) · 1.45 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
import java.io.File;
import java.io.FileNotFoundException;
import java.util.NoSuchElementException;
import java.util.Scanner;
public class Targets {
public static final boolean isWeb = false;
public static final boolean systemPrint = true;
public static final boolean customWhile = false;
public static final boolean isInThread = false;
public static boolean awaitedInput = false;
public static void tokenizerError(int i, String line) {
//empty! this function used just when targeting web(via teaVM)
}
public static String readFile(String fileName) {
File file = new File(fileName);
Scanner scanner = null;
try {
scanner = new Scanner(file);
} catch (FileNotFoundException e) {
System.err.println("Failed to open file: " + fileName);
System.exit(1);
}
try {
scanner.useDelimiter("\\Z");
return scanner.next() + "\n";
} catch (NoSuchElementException ignored) {
return "";
}
}
public static boolean fileExists(String fileName) {
File file = new File(fileName);
return file.exists();
}
public interface CustomWhileInterface {
boolean run();
}
public static void _while(CustomWhileInterface customWhileInterface) {
while (customWhileInterface.run());
}
public static void print(ValueBase value) {}
public static void error(String value) {}
}