remove main from parse

This commit is contained in:
HU helene 2024-04-29 17:31:17 +02:00
parent 2dd7abcc0c
commit 8b6c78ca75
2 changed files with 15 additions and 32 deletions

View file

@ -62,7 +62,7 @@
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>${project.build.finalName}.lib/</classpathPrefix>
<mainClass>fr.u_paris.gla.project.itinerary.ItineraryCalculator</mainClass>
<mainClass>fr.u_paris.gla.project.App</mainClass>
</manifest>
</archive>
</configuration>

View file

@ -9,7 +9,7 @@ import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ItineraryCalculator {
public class Parse {
private static final Logger LOGGER = Logger
.getLogger(IDFMNetworkExtractor.class.getName());
@ -44,6 +44,10 @@ public class ItineraryCalculator {
//Walking speed in m/s
private static final double WALK_SPEED = 1.;
private HashSet<Stop> nodes = new HashSet<>();
private HashMap<Stop, Set<Connection>> connections = new HashMap<>();
private HashMap<String, ArrayList<Stop>> tmp = new HashMap<>();
/**
* Returns the coordinates from a String to a double array:
* "49.08, 3.07" -> {49.08, 3.07}
@ -204,17 +208,12 @@ public class ItineraryCalculator {
}
}
public static void main(String[] args){
if (args.length != 0) {
LOGGER.severe("Invalid command line. Target file names are in the main file for now.");
return;
}
public void parseFiles(){
IDFMNetworkExtractor.buildFiles();
try {
HashSet<Stop> nodes = new HashSet<>();
HashMap<Stop, Set<Connection>> connections = new HashMap<>();
HashMap<String, ArrayList<Stop>> tmp = new HashMap<>();
CSVTools.readCSVFromFile(TRACE_FILE_NAME,
(String[] line) -> addLine(line, nodes, tmp, connections));
@ -227,32 +226,16 @@ public class ItineraryCalculator {
}
}
Stop porteivry = tmp.get("Porte d'Ivry").get(0);
Stop repu = tmp.get("République").get(0);
Graph graph = new Graph(nodes, connections);
int cpt = 0;
for (Map.Entry<Stop, Set<Connection>> entry : graph.getConnections().entrySet()) {
if (entry.getValue() == null) cpt +=1;
}
Stop garenord = tmp.get("Gare du Nord").get(0);
Stop chatelet = tmp.get("Châtelet").get(0);
//System.out.println(graph.getConnections(garenord));
//System.out.println(cpt);
//System.out.println(graph.getConnections(porteivry));
Finder finder = new Finder(graph);
List<Path> res = finder.findPath(chatelet, garenord, 43200);
for (Path element : res) {
System.out.println(element.getCurrentStop());
}
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Error while reading the line paths", e);
}
}
public List<Path> getItinerary(Stop src, Stop dst, double startTime ){
Graph graph = new Graph(nodes, connections);
Finder finder = new Finder(graph);
return finder.findPath(src, dst, startTime);
}
}