[chore] advices from ide
This commit is contained in:
parent
110e81eb8c
commit
c06261be6c
22 changed files with 161 additions and 215 deletions
|
@ -1,25 +1,25 @@
|
|||
# Comment contribuer à ce projet
|
||||
|
||||
2 cas sont possibles pour contribuer à ce projet:
|
||||
2 cas sont possibles pour contribuer à ce projet :
|
||||
|
||||
- Vous ête un étudiant et l'utilisez pour créer votre projet, dans ce cas reportez vous
|
||||
- Vous ête un étudiant et l'utilisez pour créer votre projet, dans ce cas, reportez-vous
|
||||
à [la section étudiant](#etudiant)
|
||||
- Vous êtes un enseignant améliorant ce modèle, dans ce cas reportez vous
|
||||
- Vous êtes un enseignant améliorant ce modèle, dans ce cas, reportez-vous
|
||||
à [la section enseignant](#enseignant)
|
||||
|
||||
## Etudiant
|
||||
|
||||
Vous ne devez pas contribuer directement à ce projet mais devez en effectuer un fork. Une fois cela
|
||||
effectué vous devez:
|
||||
Vous ne devez pas contribuer directement à ce projet, mais devez en effectuer un fork. Une fois cela
|
||||
effectué, vous devez :
|
||||
|
||||
- [x] Ajouter votre identifiant de groupe au champs `groupId` du fichier [pom.xml](pom.xml) sous la
|
||||
- [x] Ajouter votre identifiant de groupe au champ `groupId` du fichier [pom.xml](pom.xml) sous la
|
||||
forme de `fr.u-paris.gla.votreequipe`
|
||||
- [ ] Modifier le package principal afin de refleter le nouveau nom de groupe.
|
||||
- [ ] Adapter le fichier [README](README.md) au contenu de votre projet specifique
|
||||
- [ ] Adapter ce fichier (CONTRIBUTING.md) à vos propres instructions de contribution, notamment:
|
||||
- [ ] Convention de style de codage
|
||||
- [ ] Convention d'utilisation de git
|
||||
- [ ] Lien avec d'autres projets et d'autres dépôts.
|
||||
- [x] Modifier le package principal afin de refléter le nouveau nom de groupe.
|
||||
- [x] Adapter le fichier [README](README.md) au contenu de votre projet spécifique
|
||||
- [x] Adapter ce fichier (CONTRIBUTING.md) à vos propres instructions de contribution, notamment :
|
||||
- [x] Convention de style de codage
|
||||
- [x] Convention d'utilisation de Git
|
||||
- [x] Lien avec d'autres projets et d'autres dépôts.
|
||||
- [x] Modifier le fichier `application.properties` au besoin.
|
||||
|
||||
## Convention de style
|
||||
|
@ -41,9 +41,9 @@ séparées,
|
|||
intégrées dans la branche dev une fois terminée.
|
||||
La branche main ne doit contenir que des versions stables de ce modèle.
|
||||
|
||||
Le code est écrit en Java, manipulé par l'outils de construction maven et doit suivre les
|
||||
conventions usuelles du langage et de l'outils.
|
||||
Le code est écrit en Java, manipulé par l'outil de construction maven et doit suivre les
|
||||
conventions usuelles du langage et de l'outil.
|
||||
|
||||
Le package principal du code Java est `fr.u_paris.gla.project`
|
||||
Le fichier de properties `application.properties` permet d'accéder depuis le code Java aux diverses
|
||||
informations inscrite dans maven.
|
||||
informations inscrites dans maven.
|
||||
|
|
|
@ -32,7 +32,7 @@ Dans sa version initiale, le programme fournit est un simple code qui se lance e
|
|||
application graphique.
|
||||
|
||||
Une fois le programme compilé, vous trouverez un jar executable dans le dossier target. Au nom de
|
||||
jar près (version changeante), vous pourrez l'exécuter avec:
|
||||
jar près (version changeante), vous pourrez l'exécuter avec :
|
||||
|
||||
```
|
||||
java -jar target/project-2024.1.0.0-SNAPSHOT.jar --info
|
||||
|
|
|
@ -6,8 +6,6 @@ import java.awt.Dimension;
|
|||
import java.awt.GridLayout;
|
||||
import java.awt.HeadlessException;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
|
@ -29,13 +27,9 @@ import javax.swing.table.TableModel;
|
|||
public class View extends JFrame {
|
||||
|
||||
private final JPanel CardPanel;
|
||||
private final JMenuItem Home;
|
||||
private final JMenuItem Network;
|
||||
private final JPanel NetworkPanel;
|
||||
private final JTextField TextLocation;
|
||||
private final JButton ButtonLocation;
|
||||
private final JPanel HomePanel;
|
||||
private final JPanel MainPanel;
|
||||
private final DefaultTableModel modelStops;
|
||||
private final JTable tableStops;
|
||||
private final JTable tableItinerary;
|
||||
|
@ -43,19 +37,9 @@ public class View extends JFrame {
|
|||
private final JScrollPane paneStops;
|
||||
private final JScrollPane paneItinerary;
|
||||
private final JPanel ItineraryPanel;
|
||||
private final JMenuItem Itinerary;
|
||||
private final JPanel stationsPanel;
|
||||
private final JLabel departText;
|
||||
private final JLabel arrText;
|
||||
private final JTextField TextCoord;
|
||||
private final JButton ButtonCoord;
|
||||
private final JPanel SearchCoordPanel;
|
||||
private final JPanel SearchLocationPanel;
|
||||
private final JLabel NetworkLabel;
|
||||
private final JMenuBar ButtonBar;
|
||||
private final ArrayList<Stop> StopList;
|
||||
private JMenuItem Favorites;
|
||||
private JLabel FavLabel;
|
||||
private String departureCur;
|
||||
|
||||
private String arrivalCur;
|
||||
|
@ -64,50 +48,46 @@ public class View extends JFrame {
|
|||
|
||||
private String searchCoord;
|
||||
|
||||
private ArrayList<Stop> searchRes;
|
||||
|
||||
private int count = 0;
|
||||
|
||||
|
||||
public View(ArrayList<Stop> s) throws HeadlessException {
|
||||
MainPanel = new JPanel();
|
||||
JPanel mainPanel = new JPanel();
|
||||
GridLayout MainLayout = new GridLayout(1, 2, 50, 0);
|
||||
MainPanel.setLayout(MainLayout);
|
||||
mainPanel.setLayout(MainLayout);
|
||||
CardLayout CardLay = new CardLayout();
|
||||
CardPanel = new JPanel(CardLay);
|
||||
|
||||
HomePanel = new JPanel();
|
||||
CardPanel.add(HomePanel);
|
||||
SearchCoordPanel = new JPanel();
|
||||
SearchLocationPanel = new JPanel();
|
||||
JPanel searchCoordPanel = new JPanel();
|
||||
JPanel searchLocationPanel = new JPanel();
|
||||
GridLayout SearchLayout = new GridLayout(1, 2);
|
||||
HomePanel.setLayout(SearchLayout);
|
||||
HomePanel.add(SearchCoordPanel);
|
||||
HomePanel.add(SearchLocationPanel);
|
||||
HomePanel.add(searchCoordPanel);
|
||||
HomePanel.add(searchLocationPanel);
|
||||
GridLayout SearchCoordLayout = new GridLayout(2, 1);
|
||||
GridLayout SearchLocationLayout = new GridLayout(2, 1);
|
||||
SearchCoordPanel.setLayout(SearchCoordLayout);
|
||||
SearchLocationPanel.setLayout(SearchLocationLayout);
|
||||
searchCoordPanel.setLayout(SearchCoordLayout);
|
||||
searchLocationPanel.setLayout(SearchLocationLayout);
|
||||
TextCoord = new JTextField();
|
||||
ButtonCoord = new JButton("Look for coords");
|
||||
SearchCoordPanel.add(TextCoord);
|
||||
SearchCoordPanel.add(ButtonCoord);
|
||||
JButton buttonCoord = new JButton("Look for coords");
|
||||
searchCoordPanel.add(TextCoord);
|
||||
searchCoordPanel.add(buttonCoord);
|
||||
TextLocation = new JTextField();
|
||||
ButtonLocation = new JButton("Look for string");
|
||||
SearchLocationPanel.add(TextLocation);
|
||||
SearchLocationPanel.add(ButtonLocation);
|
||||
JButton buttonLocation = new JButton("Look for string");
|
||||
searchLocationPanel.add(TextLocation);
|
||||
searchLocationPanel.add(buttonLocation);
|
||||
|
||||
NetworkPanel = new JPanel();
|
||||
CardPanel.add(NetworkPanel);
|
||||
GridLayout NetworkLayout = new GridLayout(3, 1);
|
||||
NetworkPanel.setLayout(NetworkLayout);
|
||||
NetworkLabel = new JLabel("Network");
|
||||
NetworkPanel.add(NetworkLabel);
|
||||
stationsPanel = new JPanel();
|
||||
JLabel networkLabel = new JLabel("Network");
|
||||
NetworkPanel.add(networkLabel);
|
||||
JPanel stationsPanel = new JPanel();
|
||||
NetworkPanel.add(stationsPanel);
|
||||
GridLayout StationsLayout = new GridLayout(2, 1);
|
||||
departText = new JLabel("Départ: ");
|
||||
arrText = new JLabel("Arivée: ");
|
||||
arrText = new JLabel("Arrivée: ");
|
||||
stationsPanel.setLayout(StationsLayout);
|
||||
stationsPanel.add(departText);
|
||||
stationsPanel.add(arrText);
|
||||
|
@ -125,20 +105,20 @@ public class View extends JFrame {
|
|||
paneItinerary.add(tableItinerary);
|
||||
ItineraryPanel.add(paneItinerary);
|
||||
|
||||
ButtonBar = new JMenuBar();
|
||||
JMenuBar buttonBar = new JMenuBar();
|
||||
GridLayout ButtonLayout = new GridLayout(3, 1);
|
||||
ButtonBar.setLayout(ButtonLayout);
|
||||
Home = new JMenuItem("Home");
|
||||
ButtonBar.add(Home);
|
||||
Network = new JMenuItem("Network");
|
||||
ButtonBar.add(Network);
|
||||
buttonBar.setLayout(ButtonLayout);
|
||||
JMenuItem home = new JMenuItem("Home");
|
||||
buttonBar.add(home);
|
||||
JMenuItem network = new JMenuItem("Network");
|
||||
buttonBar.add(network);
|
||||
|
||||
Itinerary = new JMenuItem("Itinerary");
|
||||
ButtonBar.add(Itinerary);
|
||||
ButtonBar.setPreferredSize(new Dimension(50, 500));
|
||||
JMenuItem itinerary = new JMenuItem("Itinerary");
|
||||
buttonBar.add(itinerary);
|
||||
buttonBar.setPreferredSize(new Dimension(50, 500));
|
||||
|
||||
MainPanel.add(ButtonBar);
|
||||
MainPanel.add(CardPanel);
|
||||
mainPanel.add(buttonBar);
|
||||
mainPanel.add(CardPanel);
|
||||
|
||||
modelStops = (DefaultTableModel) tableStops.getModel();
|
||||
modelStops.setColumnCount(2);
|
||||
|
@ -147,47 +127,37 @@ public class View extends JFrame {
|
|||
modelItinerary = (DefaultTableModel) tableItinerary.getModel();
|
||||
modelItinerary.setColumnCount(3);
|
||||
modelItinerary.setColumnIdentifiers(new Object[]{"Line", "Stop", "Time"});
|
||||
this.StopList = s;
|
||||
|
||||
setContentPane(MainPanel);
|
||||
setContentPane(mainPanel);
|
||||
setTitle("app");
|
||||
setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||
//setUndecorated(true);
|
||||
setVisible(true);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
Home.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
home.addActionListener(e -> {
|
||||
CardPanel.removeAll();
|
||||
CardPanel.add(HomePanel);
|
||||
CardPanel.repaint();
|
||||
CardPanel.revalidate();
|
||||
}
|
||||
});
|
||||
|
||||
Network.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
network.addActionListener(e -> {
|
||||
LoadSearchResult(s, modelStops);
|
||||
CardPanel.removeAll();
|
||||
CardPanel.add(NetworkPanel);
|
||||
|
||||
CardPanel.repaint();
|
||||
CardPanel.revalidate();
|
||||
}
|
||||
});
|
||||
|
||||
Itinerary.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
itinerary.addActionListener(e -> {
|
||||
LoadSearchResult(s, modelItinerary);
|
||||
CardPanel.removeAll();
|
||||
CardPanel.add(ItineraryPanel);
|
||||
|
||||
CardPanel.repaint();
|
||||
CardPanel.revalidate();
|
||||
}
|
||||
});
|
||||
|
||||
TextLocation.addKeyListener(new KeyAdapter() {
|
||||
|
@ -208,9 +178,7 @@ public class View extends JFrame {
|
|||
}
|
||||
});
|
||||
|
||||
ButtonLocation.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
buttonLocation.addActionListener(e -> {
|
||||
CardPanel.removeAll();
|
||||
searchLocation = TextLocation.getText();
|
||||
LoadSearchResult(s, modelStops);
|
||||
|
@ -219,12 +187,9 @@ public class View extends JFrame {
|
|||
|
||||
CardPanel.repaint();
|
||||
CardPanel.revalidate();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonCoord.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
buttonCoord.addActionListener(e -> {
|
||||
CardPanel.removeAll();
|
||||
searchCoord = TextCoord.getText();
|
||||
LoadSearchResult(s, modelStops);
|
||||
|
@ -233,7 +198,6 @@ public class View extends JFrame {
|
|||
|
||||
CardPanel.repaint();
|
||||
CardPanel.revalidate();
|
||||
}
|
||||
});
|
||||
tableStops.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
|
@ -259,7 +223,6 @@ public class View extends JFrame {
|
|||
s.add(new Stop("M14", "Gare de Lyon", 2.4658452681, 3.0265513));
|
||||
View v = new View(s);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void showOptionsDialog(JTable table, int x, int y) {
|
||||
|
@ -296,7 +259,7 @@ public class View extends JFrame {
|
|||
model.setColumnCount(cols);
|
||||
|
||||
// Add new rows based on the search results
|
||||
count = 0;
|
||||
int count = 0;
|
||||
for (Stop stop : stops) {
|
||||
// Add a row to the table with Stop's line in the first column and Stop's name in the second column
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public class CSVSchedulesProvider {
|
|||
|
||||
private static final DateTimeFormatter HOUR_MINUTE_FORMATTER = ScheduleFormat.getTimeFormatter();
|
||||
|
||||
private static final HashMap<String, int[]> timings = new HashMap<String, int[]>() {{
|
||||
private static final HashMap<String, int[]> timings = new HashMap<>() {{
|
||||
put("Bus", new int[]{11, 8, 7});
|
||||
put("Funicular", new int[]{15, 25, 20});
|
||||
put("Tram", new int[]{6, 7, 8, 9});
|
||||
|
@ -36,7 +36,7 @@ public class CSVSchedulesProvider {
|
|||
private final Iterator<Transport> currentTransport;
|
||||
private Iterator<TraceDescription> currentDescription = Collections.emptyIterator();
|
||||
|
||||
private String current_tansport_type = "";
|
||||
private String current_transport_type = "";
|
||||
private LocalDateTime currentHour = null;
|
||||
private LocalDateTime lastHour = null;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class CSVSchedulesProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param transportType the type of a transport
|
||||
* @param transportType the type of transport
|
||||
* @return a random minute depending on the type of the transport
|
||||
*/
|
||||
public static int pickMinute(String transportType) {
|
||||
|
@ -84,17 +84,15 @@ public class CSVSchedulesProvider {
|
|||
} else if (currentHour.isBefore(lastHour)) {
|
||||
// System.out.println("**Skip: Le current hour est plus petit "+currentHour+"|||"+lastHour);
|
||||
addRandomMinutes();
|
||||
} else if (!currentHour.isBefore(lastHour)) {
|
||||
} else {
|
||||
// System.out.println("**Skip: Le current hour est plus grand "+currentHour+"|||"+lastHour);
|
||||
skipToNextDescription();
|
||||
} else if (!this.currentDescription.hasNext()) {
|
||||
skipToNextTransport();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Move to the the nextDescription of a Transport line
|
||||
* Move to the nextDescription of a Transport line
|
||||
*/
|
||||
private void skipToNextDescription() {
|
||||
if (this.currentDescription.hasNext()) {
|
||||
|
@ -123,7 +121,7 @@ public class CSVSchedulesProvider {
|
|||
Transport transport = this.currentTransport.next();
|
||||
this.line[ScheduleFormat.LINE_INDEX] = transport.name;
|
||||
|
||||
current_tansport_type = transport.type;
|
||||
current_transport_type = transport.type;
|
||||
this.currentDescription = transport.descriptions.iterator();
|
||||
skipToNextDescription();
|
||||
}
|
||||
|
@ -141,12 +139,12 @@ public class CSVSchedulesProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add random minutes for the next passage of a transport. The random minutes depends on the type
|
||||
* of the transport
|
||||
* Add random minutes for the next passage of transport. The random minutes depends on the type of
|
||||
* the transport
|
||||
*/
|
||||
private void addRandomMinutes() {
|
||||
// System.out.println("** addM: AVANT: "+currentHour);
|
||||
currentHour = currentHour.plusMinutes(pickMinute(current_tansport_type));
|
||||
currentHour = currentHour.plusMinutes(pickMinute(current_transport_type));
|
||||
this.line[ScheduleFormat.TIME_INDEX] = currentHour.format(HOUR_MINUTE_FORMATTER);
|
||||
// System.out.println("** addM: APRES: "+currentHour);
|
||||
// debut ++;
|
||||
|
|
|
@ -92,7 +92,7 @@ public final class CSVStreamProvider {
|
|||
*/
|
||||
private Iterator<List<StopEntry>> currentPath = Collections.emptyIterator();
|
||||
/**
|
||||
* current iterator for the begin of the line
|
||||
* current iterator for the beginning of the line
|
||||
*/
|
||||
private Iterator<StopEntry> currentSegmentStart = Collections.emptyIterator();
|
||||
/**
|
||||
|
@ -162,7 +162,7 @@ public final class CSVStreamProvider {
|
|||
/**
|
||||
* A tool method to give a delay to go through a certain distance.
|
||||
* <p>
|
||||
* This is a model with an linear acceleration and deceleration periods and a constant speed in
|
||||
* This is a model with a linear acceleration and deceleration periods and a constant speed in
|
||||
* between.
|
||||
*
|
||||
* @param distance the distance (in km)
|
||||
|
@ -268,7 +268,7 @@ public final class CSVStreamProvider {
|
|||
// }
|
||||
|
||||
/**
|
||||
* Store current trace' data as a String array
|
||||
* Store current trace's data as a String array
|
||||
*
|
||||
* @return The newly generated line of text
|
||||
*/
|
||||
|
@ -302,7 +302,7 @@ public final class CSVStreamProvider {
|
|||
String end_p = this.line[NetworkFormat.STOP_INDEX];
|
||||
// String bifurcation = this.line[NetworkFormat.VARIANT_INDEX];
|
||||
|
||||
Transport transp = null;
|
||||
Transport transp;
|
||||
if (!transports.containsKey(traceId)) {
|
||||
transp = new Transport(nameTransport, traceType, url_image);
|
||||
transports.put(traceId, transp);
|
||||
|
|
|
@ -154,7 +154,7 @@ public class IDFMNetworkExtractor {
|
|||
long startTime = System.currentTimeMillis();
|
||||
|
||||
for (Transport entry : transports.values()) {
|
||||
entry.buildBifurcationOptimzed();
|
||||
entry.buildBifurcationOptimized();
|
||||
}
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
|
|
|
@ -19,7 +19,7 @@ public class Stop {
|
|||
/**
|
||||
* Checks is stopName is connected to this one
|
||||
*
|
||||
* @param stopName
|
||||
* @param stopName stop name
|
||||
* @return True if stopName is connected to the current stop
|
||||
*/
|
||||
public boolean isStopConnected(String stopName) {
|
||||
|
@ -38,7 +38,7 @@ public class Stop {
|
|||
/**
|
||||
* Return the connected stop with the name : stopName
|
||||
*
|
||||
* @param stopName
|
||||
* @param stopName stop name
|
||||
* @return the connected stop with the name : stopName
|
||||
*/
|
||||
public BifStop getConnectedStop(String stopName) {
|
||||
|
|
|
@ -6,20 +6,24 @@ package fr.u_paris.gla.project.idfm;
|
|||
import java.text.MessageFormat;
|
||||
import java.util.Objects;
|
||||
|
||||
/** A transport stop data.
|
||||
/**
|
||||
* A transport stop data.
|
||||
*
|
||||
* @author Emmanuel Bigeon */
|
||||
* @author Emmanuel Bigeon
|
||||
*/
|
||||
public class StopEntry implements Comparable<StopEntry> {
|
||||
|
||||
public final String lname;
|
||||
public final double longitude;
|
||||
public final double latitude;
|
||||
|
||||
/** Create the stop
|
||||
/**
|
||||
* Create the stop
|
||||
*
|
||||
* @param lname
|
||||
* @param longitude
|
||||
* @param latitude */
|
||||
* @param lname line name
|
||||
* @param longitude longitude
|
||||
* @param latitude latitude
|
||||
*/
|
||||
public StopEntry(String lname, double longitude, double latitude) {
|
||||
super();
|
||||
this.lname = lname;
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A representation of a transport description encompansing its first and last stop in all of its
|
||||
* A representation of a transport description encompassing its first and last stop in all of its
|
||||
* direction, the first and last schedule and all the bifurcation that direction takes. The
|
||||
* description comes from the fourth column * of the stop csv file.
|
||||
*/
|
||||
|
|
|
@ -67,9 +67,9 @@ public final class TraceEntry {
|
|||
/**
|
||||
* Add all the description to the current one
|
||||
*
|
||||
* @param desctipt
|
||||
* @param ldescription
|
||||
*/
|
||||
public void addDescriptions(List<TraceDescription> desctipt) {
|
||||
descriptions.addAll(desctipt);
|
||||
public void addDescriptions(List<TraceDescription> ldescription) {
|
||||
descriptions.addAll(ldescription);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class Transport {
|
|||
Stop fin = stopsMap.get(d.to);
|
||||
if (debut != null && fin != null) {
|
||||
SimpleEntry<Boolean, List<Integer>> sol = roadToLast(debut.name, fin.name,
|
||||
new ArrayList<String>(), new ArrayList<Integer>());
|
||||
new ArrayList<>(), new ArrayList<>());
|
||||
if (sol.getKey()) {
|
||||
// found++;
|
||||
d.bifurcation = sol.getValue();
|
||||
|
@ -55,7 +55,7 @@ public class Transport {
|
|||
/**
|
||||
* Build the bifurcation for all the descriptions but optimized
|
||||
*/
|
||||
public void buildBifurcationOptimzed() {
|
||||
public void buildBifurcationOptimized() {
|
||||
// int found = 0;
|
||||
for (TraceDescription d : descriptions) {
|
||||
Stop debut = stopsMap.get(d.from);
|
||||
|
@ -63,7 +63,7 @@ public class Transport {
|
|||
if (debut != null && fin != null) {
|
||||
Set<String> alreadyVisited = new HashSet<>();
|
||||
SimpleEntry<Boolean, List<Integer>> sol = roadToLastOptimized(debut.name, fin.name,
|
||||
alreadyVisited, new ArrayList<Integer>());
|
||||
alreadyVisited, new ArrayList<>());
|
||||
if (sol.getKey()) {
|
||||
// found++;
|
||||
d.bifurcation = sol.getValue();
|
||||
|
@ -95,8 +95,8 @@ public class Transport {
|
|||
*
|
||||
* @param currentStop the current stop we are visiting
|
||||
* @param last The last stop we are trying to go to
|
||||
* @param alreadyVisited All the stop we already have visisted
|
||||
* @param bif All the bifurcation encountered from the first stop to the current one
|
||||
* @param alreadyVisited All the stop we already have visited
|
||||
* @param bifurcation All the bifurcation encountered from the first stop to the current one
|
||||
* @return True and the bifurcation if we found our road to the last stop and false if we didn't
|
||||
*/
|
||||
public SimpleEntry<Boolean, List<Integer>> roadToLast(String currentStop, String last,
|
||||
|
@ -142,8 +142,8 @@ public class Transport {
|
|||
*
|
||||
* @param currentStop the current stop we are visiting
|
||||
* @param last The last stop we are trying to go to
|
||||
* @param alreadyVisited All the stop we already have visisted
|
||||
* @param bif All the bifurcation encountered from the first stop to the current one
|
||||
* @param alreadyVisited All the stop we already have visited
|
||||
* @param bifurcation All the bifurcation encountered from the first stop to the current one
|
||||
* @return True and the bifurcation if we found our road to the last stop and false if we didn't
|
||||
*/
|
||||
public SimpleEntry<Boolean, List<Integer>> roadToLastOptimized(String currentStop, String last,
|
||||
|
@ -204,7 +204,7 @@ public class Transport {
|
|||
}
|
||||
|
||||
/**
|
||||
* Print every stops of the line and its connections
|
||||
* Print every stop of the line and its connections
|
||||
*/
|
||||
public void printAllConnectionStops() {
|
||||
System.out.println("Affichage des couples (stop, next du stop):");
|
||||
|
@ -222,11 +222,10 @@ public class Transport {
|
|||
/**
|
||||
* Add all the description to the current one
|
||||
*
|
||||
* @param desctipt
|
||||
* @param ldescription
|
||||
*/
|
||||
public void addDescriptions(List<TraceDescription> desctipt) {
|
||||
descriptions.addAll(desctipt);
|
||||
public void addDescriptions(List<TraceDescription> ldescription) {
|
||||
descriptions.addAll(ldescription);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ public final class UnidentifiedStopEntry extends StopEntry {
|
|||
/**
|
||||
* Create the stop
|
||||
*
|
||||
* @param longitude
|
||||
* @param latitude
|
||||
* @param longitude longitude
|
||||
* @param latitude latitude
|
||||
*/
|
||||
public UnidentifiedStopEntry(double longitude, double latitude) {
|
||||
super("Unidentified", longitude, latitude); //$NON-NLS-1$
|
||||
|
|
|
@ -72,7 +72,7 @@ public class Connection {
|
|||
}
|
||||
|
||||
public double getNextTime(double currentTime) {
|
||||
if (this.schedules.size() == 0) {
|
||||
if (this.schedules.isEmpty()) {
|
||||
return currentTime;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class Connection {
|
|||
}
|
||||
|
||||
public double getCost(double currentTime) {
|
||||
if (this.schedules.size() == 0) {
|
||||
if (this.schedules.isEmpty()) {
|
||||
if (this.lineName.equals("WALK")) {
|
||||
return this.time;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ public class Finder {
|
|||
/**
|
||||
* return a path from startNode to goalNode using A* algorithm
|
||||
*
|
||||
* @param startNode
|
||||
* @param goalNode
|
||||
* @param startNode start of algorithm
|
||||
* @param goalNode end of algorithm
|
||||
*/
|
||||
public List<Path> findPath(Stop startNode, Stop goalNode, double startTime) {
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class Finder {
|
|||
HashMap<Stop, Double> fScore = new HashMap<>();
|
||||
|
||||
// Initialize scores for all nodes to infinity
|
||||
for (Stop node : graph.getNodes()) {
|
||||
for (Stop node : graph.nodes()) {
|
||||
gScore.put(node, Double.POSITIVE_INFINITY);
|
||||
fScore.put(node, Double.POSITIVE_INFINITY);
|
||||
}
|
||||
|
@ -89,8 +89,8 @@ public class Finder {
|
|||
/**
|
||||
* Once we found the destination we reconstruct the path
|
||||
*
|
||||
* @param cameFrom
|
||||
* @param current
|
||||
* @param cameFrom departure
|
||||
* @param current current stop
|
||||
* @return path
|
||||
*/
|
||||
private List<Path> reconstructPath(HashMap<Stop, Path> cameFrom, Stop current) {
|
||||
|
@ -111,9 +111,9 @@ public class Finder {
|
|||
/**
|
||||
* Update the priority queue
|
||||
*
|
||||
* @param openSet
|
||||
* @param node
|
||||
* @param newF
|
||||
* @param openSet stop queue
|
||||
* @param node stop
|
||||
* @param newF new stop
|
||||
*/
|
||||
public void updatePriority(PriorityQueue<Stop> openSet, Stop node, double newF) {
|
||||
openSet.remove(node);
|
||||
|
|
|
@ -3,26 +3,9 @@ package fr.u_paris.gla.project.itinerary;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class Graph {
|
||||
|
||||
private final Set<Stop> nodes;
|
||||
|
||||
private final Map<Stop, Set<Connection>> connections;
|
||||
|
||||
public Graph(Set<Stop> nodes, Map<Stop, Set<Connection>> connections) {
|
||||
this.nodes = nodes;
|
||||
this.connections = connections;
|
||||
}
|
||||
public record Graph(Set<Stop> nodes, Map<Stop, Set<Connection>> connections) {
|
||||
|
||||
public Set<Connection> getConnections(Stop node) {
|
||||
return connections.get(node);
|
||||
}
|
||||
|
||||
public Set<Stop> getNodes() {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
public Map<Stop, Set<Connection>> getConnections() {
|
||||
return connections;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ public class Parse {
|
|||
* @param line the current line we want to parse
|
||||
* @param nodes the graph of stops
|
||||
* @param tmp list of the created stops
|
||||
* @param connections
|
||||
* @param connections set of connections
|
||||
*/
|
||||
private static void addLine(String[] line, HashSet<Stop> nodes,
|
||||
HashMap<String, ArrayList<Stop>> tmp, HashMap<Stop, Set<Connection>> connections) {
|
||||
|
@ -162,14 +162,14 @@ public class Parse {
|
|||
}
|
||||
}
|
||||
|
||||
if (directions.size() == 0) {
|
||||
if (directions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Stop next_stop = null;
|
||||
if (directions.size() > 1) {
|
||||
int bifurcation = bifurcations.size() == 0 ? 0 : bifurcations.get(0);
|
||||
if (bifurcations.size() > 0) {
|
||||
int bifurcation = bifurcations.isEmpty() ? 0 : bifurcations.get(0);
|
||||
if (!bifurcations.isEmpty()) {
|
||||
bifurcations.remove(0);
|
||||
}
|
||||
for (Connection d : directions) {
|
||||
|
@ -184,7 +184,7 @@ public class Parse {
|
|||
} else {
|
||||
next_stop = directions.get(0).getStop();
|
||||
if (directions.get(0).getBifurcation() != 0) {
|
||||
if (bifurcations.size() > 0 && directions.get(0).getBifurcation() == bifurcations.get(0)) {
|
||||
if (!bifurcations.isEmpty() && directions.get(0).getBifurcation() == bifurcations.get(0)) {
|
||||
bifurcations.remove(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ public class Path {
|
|||
private final double travelTime;
|
||||
private final String line;
|
||||
private final Connection connection;
|
||||
private double distance;
|
||||
|
||||
public Path(Stop current, Connection connection, double startTime) {
|
||||
this.current = current;
|
||||
|
|
|
@ -93,7 +93,7 @@ public final class CSVTools {
|
|||
* Save our current CSV variable's data into an actual file
|
||||
*
|
||||
* @param filename the saved file's name and path
|
||||
* @param contentLineConsumer our data variable
|
||||
* @param contentLinesConsumer our data variable
|
||||
* @throws IOException if we can't write the data into the file
|
||||
*/
|
||||
public static void writeCSVToFile(String filename,
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
public class CSVStreamProviderTest {
|
||||
|
||||
//Test de hasNext, pour le cas ou il y'a un trace et cas ou il n'y en a pas
|
||||
//Test de hasNext, pour le cas où il y a un "trace" et cas ou il n'y en a pas
|
||||
@Test
|
||||
public void testHasNext() {
|
||||
// Scénario sans Trace
|
||||
|
|
|
@ -63,7 +63,7 @@ class IDFMNetworkExtractorTest {
|
|||
|
||||
method.invoke(null, trace, candidate);
|
||||
|
||||
//L'appel c'est derouler correctement
|
||||
// L'appel s'est déroulé correctement
|
||||
assertTrue(true, "L'appel de addCandidate s'est déroulé sans erreur.");
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ public class TraceEntryTest {
|
|||
String terminus1 = "Terminus A";
|
||||
String terminus2 = "Terminus B";
|
||||
|
||||
//Ajouter des arrêt sur la ligne
|
||||
//Ajouter des arrêts sur la ligne
|
||||
traceEntry.addTerminus(terminus1);
|
||||
traceEntry.addTerminus(terminus2);
|
||||
List<String> terminusList = traceEntry.getTerminus();
|
||||
|
@ -45,7 +45,7 @@ public class TraceEntryTest {
|
|||
}
|
||||
|
||||
|
||||
//Verfier si le nom de la ligne lname est correctement initialiser
|
||||
// Verifier si le nom de la ligne lname est correctement initialisé
|
||||
@Test
|
||||
public void testTraceEntryName() {
|
||||
TraceEntry traceEntry = new TraceEntry("Ligne 1", "IDFM:03434", "Bus", "dummy_url");
|
||||
|
|
Reference in a new issue