1
0
Fork 0

done Launch.java

This commit is contained in:
Sebastien Moll 2026-04-15 18:08:01 +02:00
parent 684c8ea6ac
commit 6f126202ca
2 changed files with 13 additions and 9 deletions

View file

@ -14,6 +14,7 @@ import org.insa.graphs.gui.drawing.components.BasicDrawing;
import org.insa.graphs.model.Graph; import org.insa.graphs.model.Graph;
import org.insa.graphs.model.Path; import org.insa.graphs.model.Path;
import org.insa.graphs.model.io.BinaryGraphReader; import org.insa.graphs.model.io.BinaryGraphReader;
import org.insa.graphs.model.io.BinaryPathReader;
import org.insa.graphs.model.io.GraphReader; import org.insa.graphs.model.io.GraphReader;
import org.insa.graphs.model.io.PathReader; import org.insa.graphs.model.io.PathReader;
@ -57,23 +58,26 @@ public class Launch {
try (final GraphReader reader = new BinaryGraphReader(new DataInputStream( try (final GraphReader reader = new BinaryGraphReader(new DataInputStream(
new BufferedInputStream(new FileInputStream(mapName))))) { new BufferedInputStream(new FileInputStream(mapName))))) {
// TODO: read the graph // DONE: read the graph
graph = null; graph = reader.read();
} }
// create the drawing // create the drawing
final Drawing drawing = createDrawing(); final Drawing drawing = createDrawing();
// TODO: draw the graph on the drawing // DONE: draw the graph on the drawing
drawing.drawGraph(graph);
// TODO: create a path reader // DONE: create a path reader
try (final PathReader pathReader = null) { try (final PathReader pathReader = new BinaryPathReader(new DataInputStream(
new BufferedInputStream(new FileInputStream(pathName))))) {
// TODO: read the path // DONE: read the path
path = null; path = pathReader.readPath(graph);
} }
// TODO: draw the path on the drawing // DONE: draw the path on the drawing
drawing.drawPath(path);
} }
} }

View file

@ -3,6 +3,7 @@ package org.insa.graphs.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Iterator;
/** /**
* <p> * <p>
@ -43,7 +44,6 @@ public class Path {
bestSpeed = arcsucc.getTravelTime(succspeed); bestSpeed = arcsucc.getTravelTime(succspeed);
} }
} }
} }
if (bestArc == null) { if (bestArc == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();