PCCTest V2

This commit is contained in:
Marie Brunetto 2023-04-19 16:02:07 +02:00
parent 49859bc50c
commit 31222aaf62

View file

@ -18,11 +18,62 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import org.junit.BeforeClass;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.FileInputStream;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import org.insa.graphs.model.Graph;
import org.insa.graphs.model.Path;
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.PathReader;
import org.insa.graphs.algorithm.ArcInspector;
import org.insa.graphs.algorithm.ArcInspectorFactory;
import org.insa.graphs.algorithm.shortestpath.DijkstraAlgorithm;
import org.insa.graphs.algorithm.shortestpath.ShortestPathData;
public class PCCTest{
@BeforeClass
public static void initAll() throws Exception
{
final String nomUser = "brunetto";
// Visit these directory to see the list of available files on Commetud.
final String mapName = "/home/" + nomUser + "/Bureau/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Maps/insa.mapgr";
final String pathName = "/home/" + nomUser + "/Bureau/commetud/3eme Annee MIC/Graphes-et-Algorithmes/Paths/path_fr31insa_rangueil_r2.path";
// Create a graph reader.
final GraphReader reader = new BinaryGraphReader(
new DataInputStream(new BufferedInputStream(new FileInputStream(mapName))));
// Read the graph.
final Graph graph = reader.read();
@BeforeClass
public static void initAll()
{
// Create a PathReader.
final PathReader pathReader = new BinaryPathReader(
new DataInputStream(new BufferedInputStream(new FileInputStream(pathName))));
// Read the path.
final Path path = pathReader.readPath(graph);
final ArcInspector arcInspector = ArcInspectorFactory.getAllFilters().get(0) ;
ShortestPathData theData = new ShortestPathData(graph, path.getOrigin(), path.getDestination(), arcInspector);
//ArcInspectorFactory liste d'ArcInspectors avec permissions etc existants en static
DijkstraAlgorithm dji = new DijkstraAlgorithm(theData);
System.out.println("");
}
}
}