Added JavaFX Dependencies and resource mapping for seperation of concerns.
This commit is contained in:
parent
5c2fde6c69
commit
53d046858f
30
pom.xml
30
pom.xml
@ -13,5 +13,33 @@
|
||||
<maven.compiler.target>19</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
<version>12.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>20.0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
<version>0.0.8</version>
|
||||
<configuration>
|
||||
<mainClass>edu.jturn.cs3642.CS3642-Artificial_Intelligence/Assignments.A1.GUIDriver</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -14,6 +14,8 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.PriorityQueue;
|
||||
@ -122,32 +124,17 @@ public class Driver {
|
||||
}
|
||||
|
||||
private static void writeToFile(String name, StringBuffer values) {
|
||||
File directory = new File("src/Assignments/A1/results");
|
||||
if (!directory.exists()) {
|
||||
directory.mkdirs();
|
||||
System.out.println("Creating Directory: results");
|
||||
}
|
||||
URL resourcePath = Driver.class.getResource("/A1/results/AStar.txt");
|
||||
URI resourceURI = URI.create(resourcePath.toString());
|
||||
File resource = new File(resourceURI.getPath());
|
||||
|
||||
File output = new File(directory, name + ".txt");
|
||||
|
||||
try {
|
||||
if (!output.createNewFile()) {
|
||||
System.out.println("File Already Exists: " + name + ".txt");
|
||||
} else {
|
||||
System.out.println("File Created: " + name + ".txt");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("Error creating file: " + e.getMessage());
|
||||
}
|
||||
|
||||
try (FileWriter out = new FileWriter(output)) {
|
||||
try (FileWriter out = new FileWriter(resource)) {
|
||||
out.write(values.toString());
|
||||
System.out.println("Data written to file: " + name + ".txt");
|
||||
} catch (IOException e) {
|
||||
System.err.println("Error writing to file: " + e.getMessage());
|
||||
}
|
||||
|
||||
openDirectoryFile(output);
|
||||
openDirectoryFile(resource);
|
||||
}
|
||||
|
||||
private static void openDirectoryFile(File open) {
|
||||
|
0
src/main/resources/A1/results/AStar.txt
Normal file
0
src/main/resources/A1/results/AStar.txt
Normal file
0
src/main/resources/A1/results/BFS.txt
Normal file
0
src/main/resources/A1/results/BFS.txt
Normal file
0
src/main/resources/A1/results/DFS.txt
Normal file
0
src/main/resources/A1/results/DFS.txt
Normal file
0
src/main/resources/A1/results/UCS.txt
Normal file
0
src/main/resources/A1/results/UCS.txt
Normal file
Loading…
Reference in New Issue
Block a user