-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
45 lines (37 loc) · 1.05 KB
/
Main.java
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
import interpreter.*;
import graphing.*;
import java.io.*;
import java.util.Scanner;
import java.util.ArrayList;
//UI
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import org.jfree.chart.JFreeChart;
import org.xml.sax.ErrorHandler;
import ui.*;
public class Main {
public static void main(String[] args) {
extractFiles();
CreateGraph.setUpUI();
}
private static void extractFiles() {
String[] filesToExtract = {"rules", "variables", "iterations"};
for (String fileName: filesToExtract) {
File file = new File(fileName);
if (!file.exists()) {
try (InputStream inputStream = Main.class.getResourceAsStream(fileName);
OutputStream outputStream = new FileOutputStream(file)) {
byte[] buffer = new byte[1024];
int length;
while (true) {
assert inputStream != null;
if (!((length = inputStream.read(buffer)) > 0)) break;
outputStream.write(buffer, 0, length);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}