]> git.leonardobizzoni.com Git - astar-visualizer/commitdiff
Changed checks while create end/start node
authorleo <leo@EnvyPhoenix.lan>
Fri, 19 Nov 2021 20:17:54 +0000 (21:17 +0100)
committerleo <leo@EnvyPhoenix.lan>
Fri, 19 Nov 2021 20:17:54 +0000 (21:17 +0100)
src/main/java/Main/Map.java
target/PathVisualizer-1.0-SNAPSHOT.jar
target/classes/Main/Map.class
target/surefire-reports/Main.AppTest.txt
target/surefire-reports/TEST-Main.AppTest.xml

index 6b15afcd20edb716023010292d877bb21ec5af55..5a7fdc2ed704ac1419864e3bb0bdc199e3be5587 100644 (file)
@@ -22,7 +22,7 @@ class Map extends JPanel implements MouseListener, MouseMotionListener, KeyListe
     private boolean running = false;
 
     private int size = 20;
-    int speed = 10;
+    int speed = 2;
 
     public Map() {
         this.setBackground(new Color(40, 40, 40));
@@ -127,7 +127,7 @@ class Map extends JPanel implements MouseListener, MouseMotionListener, KeyListe
 
                 // If they both exist check if same node else move che start node
                 else {
-                    if (PathfinderUtils.isSameNode(node, PathfinderUtils.endNode)) {
+                    if (PathfinderUtils.endNode != null && PathfinderUtils.isSameNode(node, PathfinderUtils.endNode)) {
                         JOptionPane.showMessageDialog(null, "End node and start node can't be the same node",
                                 "Same node error", JOptionPane.ERROR_MESSAGE);
                         return;
@@ -161,7 +161,7 @@ class Map extends JPanel implements MouseListener, MouseMotionListener, KeyListe
                 }
                 // If they both exist check if same node else move the end node
                 else {
-                    if (PathfinderUtils.startNode != null && PathfinderUtils.endNode == null) {
+                    if (PathfinderUtils.startNode !=null && PathfinderUtils.isSameNode(node, PathfinderUtils.startNode)) {
                         JOptionPane.showMessageDialog(null, "End node and start node can't be the same node",
                                 "Same node error", JOptionPane.ERROR_MESSAGE);
                         return;
index 81eb8c0ada0e33f68b060c4da339c9e355039d83..b8d5142c8c67c2c6f90ed4f3cfa5df5fed7fcfc0 100644 (file)
Binary files a/target/PathVisualizer-1.0-SNAPSHOT.jar and b/target/PathVisualizer-1.0-SNAPSHOT.jar differ
index d0ad2d530fe71fa2d3126e86d2b3719f4cae464a..c18b509284a356f978a21749fb994f65218aa1d3 100644 (file)
Binary files a/target/classes/Main/Map.class and b/target/classes/Main/Map.class differ
index 49e3cc667a56ec8fabe44d229ab17f49ad612220..3aed94744c09ae4d1bfd4c23a7def682c112096d 100644 (file)
@@ -1,4 +1,4 @@
 -------------------------------------------------------------------------------
 Test set: Main.AppTest
 -------------------------------------------------------------------------------
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.03 s - in Main.AppTest
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.025 s - in Main.AppTest
index bc761a0eeda639a8965866d06dc8f01a64402977..595731f553a69bdf4da4af1359fb7ea0e55f8872 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="Main.AppTest" time="0.03" tests="1" errors="0" skipped="0" failures="0">
+<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="Main.AppTest" time="0.025" tests="1" errors="0" skipped="0" failures="0">
   <properties>
     <property name="awt.toolkit" value="sun.awt.X11.XToolkit"/>
     <property name="java.specification.version" value="11"/>
@@ -15,7 +15,7 @@
     <property name="sun.java.launcher" value="SUN_STANDARD"/>
     <property name="user.country" value="US"/>
     <property name="sun.boot.library.path" value="/usr/lib/jvm/openjdk11-bin/lib"/>
-    <property name="sun.java.command" value="/home/leo/Docs/Proj/Pathfinder/target/surefire/surefirebooter4082728071684051500.jar /home/leo/Docs/Proj/Pathfinder/target/surefire 2021-11-19T20-44-45_157-jvmRun1 surefire17835783201909300860tmp surefire_02185374437203797851tmp"/>
+    <property name="sun.java.command" value="/home/leo/Docs/Proj/Pathfinder/target/surefire/surefirebooter7497617524640717844.jar /home/leo/Docs/Proj/Pathfinder/target/surefire 2021-11-19T21-17-25_132-jvmRun1 surefire5030477053776971331tmp surefire_02397316267537071803tmp"/>
     <property name="jdk.debug" value="release"/>
     <property name="surefire.test.class.path" value="/home/leo/Docs/Proj/Pathfinder/target/test-classes:/home/leo/Docs/Proj/Pathfinder/target/classes:/home/leo/.m2/repository/junit/junit/4.11/junit-4.11.jar:/home/leo/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:"/>
     <property name="sun.cpu.endian" value="little"/>
@@ -31,7 +31,7 @@
     <property name="java.specification.name" value="Java Platform API Specification"/>
     <property name="java.vm.specification.vendor" value="Oracle Corporation"/>
     <property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/>
-    <property name="surefire.real.class.path" value="/home/leo/Docs/Proj/Pathfinder/target/surefire/surefirebooter4082728071684051500.jar"/>
+    <property name="surefire.real.class.path" value="/home/leo/Docs/Proj/Pathfinder/target/surefire/surefirebooter7497617524640717844.jar"/>
     <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
     <property name="java.runtime.version" value="11+28"/>
     <property name="user.name" value="leo"/>