[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
|
# 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)
|
à [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)
|
à [la section enseignant](#enseignant)
|
||||||
|
|
||||||
## Etudiant
|
## Etudiant
|
||||||
|
|
||||||
Vous ne devez pas contribuer directement à ce projet mais devez en effectuer un fork. Une fois cela
|
Vous ne devez pas contribuer directement à ce projet, mais devez en effectuer un fork. Une fois cela
|
||||||
effectué vous devez:
|
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`
|
forme de `fr.u-paris.gla.votreequipe`
|
||||||
- [ ] Modifier le package principal afin de refleter le nouveau nom de groupe.
|
- [x] Modifier le package principal afin de refléter le nouveau nom de groupe.
|
||||||
- [ ] Adapter le fichier [README](README.md) au contenu de votre projet specifique
|
- [x] Adapter le fichier [README](README.md) au contenu de votre projet spécifique
|
||||||
- [ ] Adapter ce fichier (CONTRIBUTING.md) à vos propres instructions de contribution, notamment:
|
- [x] Adapter ce fichier (CONTRIBUTING.md) à vos propres instructions de contribution, notamment :
|
||||||
- [ ] Convention de style de codage
|
- [x] Convention de style de codage
|
||||||
- [ ] Convention d'utilisation de git
|
- [x] Convention d'utilisation de Git
|
||||||
- [ ] Lien avec d'autres projets et d'autres dépôts.
|
- [x] Lien avec d'autres projets et d'autres dépôts.
|
||||||
- [x] Modifier le fichier `application.properties` au besoin.
|
- [x] Modifier le fichier `application.properties` au besoin.
|
||||||
|
|
||||||
## Convention de style
|
## Convention de style
|
||||||
|
@ -41,9 +41,9 @@ séparées,
|
||||||
intégrées dans la branche dev une fois terminée.
|
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.
|
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
|
Le code est écrit en Java, manipulé par l'outil de construction maven et doit suivre les
|
||||||
conventions usuelles du langage et de l'outils.
|
conventions usuelles du langage et de l'outil.
|
||||||
|
|
||||||
Le package principal du code Java est `fr.u_paris.gla.project`
|
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
|
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.
|
application graphique.
|
||||||
|
|
||||||
Une fois le programme compilé, vous trouverez un jar executable dans le dossier target. Au nom de
|
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
|
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.GridLayout;
|
||||||
import java.awt.HeadlessException;
|
import java.awt.HeadlessException;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
|
@ -29,13 +27,9 @@ import javax.swing.table.TableModel;
|
||||||
public class View extends JFrame {
|
public class View extends JFrame {
|
||||||
|
|
||||||
private final JPanel CardPanel;
|
private final JPanel CardPanel;
|
||||||
private final JMenuItem Home;
|
|
||||||
private final JMenuItem Network;
|
|
||||||
private final JPanel NetworkPanel;
|
private final JPanel NetworkPanel;
|
||||||
private final JTextField TextLocation;
|
private final JTextField TextLocation;
|
||||||
private final JButton ButtonLocation;
|
|
||||||
private final JPanel HomePanel;
|
private final JPanel HomePanel;
|
||||||
private final JPanel MainPanel;
|
|
||||||
private final DefaultTableModel modelStops;
|
private final DefaultTableModel modelStops;
|
||||||
private final JTable tableStops;
|
private final JTable tableStops;
|
||||||
private final JTable tableItinerary;
|
private final JTable tableItinerary;
|
||||||
|
@ -43,19 +37,9 @@ public class View extends JFrame {
|
||||||
private final JScrollPane paneStops;
|
private final JScrollPane paneStops;
|
||||||
private final JScrollPane paneItinerary;
|
private final JScrollPane paneItinerary;
|
||||||
private final JPanel ItineraryPanel;
|
private final JPanel ItineraryPanel;
|
||||||
private final JMenuItem Itinerary;
|
|
||||||
private final JPanel stationsPanel;
|
|
||||||
private final JLabel departText;
|
private final JLabel departText;
|
||||||
private final JLabel arrText;
|
private final JLabel arrText;
|
||||||
private final JTextField TextCoord;
|
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 departureCur;
|
||||||
|
|
||||||
private String arrivalCur;
|
private String arrivalCur;
|
||||||
|
@ -64,50 +48,46 @@ public class View extends JFrame {
|
||||||
|
|
||||||
private String searchCoord;
|
private String searchCoord;
|
||||||
|
|
||||||
private ArrayList<Stop> searchRes;
|
|
||||||
|
|
||||||
private int count = 0;
|
|
||||||
|
|
||||||
|
|
||||||
public View(ArrayList<Stop> s) throws HeadlessException {
|
public View(ArrayList<Stop> s) throws HeadlessException {
|
||||||
MainPanel = new JPanel();
|
JPanel mainPanel = new JPanel();
|
||||||
GridLayout MainLayout = new GridLayout(1, 2, 50, 0);
|
GridLayout MainLayout = new GridLayout(1, 2, 50, 0);
|
||||||
MainPanel.setLayout(MainLayout);
|
mainPanel.setLayout(MainLayout);
|
||||||
CardLayout CardLay = new CardLayout();
|
CardLayout CardLay = new CardLayout();
|
||||||
CardPanel = new JPanel(CardLay);
|
CardPanel = new JPanel(CardLay);
|
||||||
|
|
||||||
HomePanel = new JPanel();
|
HomePanel = new JPanel();
|
||||||
CardPanel.add(HomePanel);
|
CardPanel.add(HomePanel);
|
||||||
SearchCoordPanel = new JPanel();
|
JPanel searchCoordPanel = new JPanel();
|
||||||
SearchLocationPanel = new JPanel();
|
JPanel searchLocationPanel = new JPanel();
|
||||||
GridLayout SearchLayout = new GridLayout(1, 2);
|
GridLayout SearchLayout = new GridLayout(1, 2);
|
||||||
HomePanel.setLayout(SearchLayout);
|
HomePanel.setLayout(SearchLayout);
|
||||||
HomePanel.add(SearchCoordPanel);
|
HomePanel.add(searchCoordPanel);
|
||||||
HomePanel.add(SearchLocationPanel);
|
HomePanel.add(searchLocationPanel);
|
||||||
GridLayout SearchCoordLayout = new GridLayout(2, 1);
|
GridLayout SearchCoordLayout = new GridLayout(2, 1);
|
||||||
GridLayout SearchLocationLayout = new GridLayout(2, 1);
|
GridLayout SearchLocationLayout = new GridLayout(2, 1);
|
||||||
SearchCoordPanel.setLayout(SearchCoordLayout);
|
searchCoordPanel.setLayout(SearchCoordLayout);
|
||||||
SearchLocationPanel.setLayout(SearchLocationLayout);
|
searchLocationPanel.setLayout(SearchLocationLayout);
|
||||||
TextCoord = new JTextField();
|
TextCoord = new JTextField();
|
||||||
ButtonCoord = new JButton("Look for coords");
|
JButton buttonCoord = new JButton("Look for coords");
|
||||||
SearchCoordPanel.add(TextCoord);
|
searchCoordPanel.add(TextCoord);
|
||||||
SearchCoordPanel.add(ButtonCoord);
|
searchCoordPanel.add(buttonCoord);
|
||||||
TextLocation = new JTextField();
|
TextLocation = new JTextField();
|
||||||
ButtonLocation = new JButton("Look for string");
|
JButton buttonLocation = new JButton("Look for string");
|
||||||
SearchLocationPanel.add(TextLocation);
|
searchLocationPanel.add(TextLocation);
|
||||||
SearchLocationPanel.add(ButtonLocation);
|
searchLocationPanel.add(buttonLocation);
|
||||||
|
|
||||||
NetworkPanel = new JPanel();
|
NetworkPanel = new JPanel();
|
||||||
CardPanel.add(NetworkPanel);
|
CardPanel.add(NetworkPanel);
|
||||||
GridLayout NetworkLayout = new GridLayout(3, 1);
|
GridLayout NetworkLayout = new GridLayout(3, 1);
|
||||||
NetworkPanel.setLayout(NetworkLayout);
|
NetworkPanel.setLayout(NetworkLayout);
|
||||||
NetworkLabel = new JLabel("Network");
|
JLabel networkLabel = new JLabel("Network");
|
||||||
NetworkPanel.add(NetworkLabel);
|
NetworkPanel.add(networkLabel);
|
||||||
stationsPanel = new JPanel();
|
JPanel stationsPanel = new JPanel();
|
||||||
NetworkPanel.add(stationsPanel);
|
NetworkPanel.add(stationsPanel);
|
||||||
GridLayout StationsLayout = new GridLayout(2, 1);
|
GridLayout StationsLayout = new GridLayout(2, 1);
|
||||||
departText = new JLabel("Départ: ");
|
departText = new JLabel("Départ: ");
|
||||||
arrText = new JLabel("Arivée: ");
|
arrText = new JLabel("Arrivée: ");
|
||||||
stationsPanel.setLayout(StationsLayout);
|
stationsPanel.setLayout(StationsLayout);
|
||||||
stationsPanel.add(departText);
|
stationsPanel.add(departText);
|
||||||
stationsPanel.add(arrText);
|
stationsPanel.add(arrText);
|
||||||
|
@ -125,20 +105,20 @@ public class View extends JFrame {
|
||||||
paneItinerary.add(tableItinerary);
|
paneItinerary.add(tableItinerary);
|
||||||
ItineraryPanel.add(paneItinerary);
|
ItineraryPanel.add(paneItinerary);
|
||||||
|
|
||||||
ButtonBar = new JMenuBar();
|
JMenuBar buttonBar = new JMenuBar();
|
||||||
GridLayout ButtonLayout = new GridLayout(3, 1);
|
GridLayout ButtonLayout = new GridLayout(3, 1);
|
||||||
ButtonBar.setLayout(ButtonLayout);
|
buttonBar.setLayout(ButtonLayout);
|
||||||
Home = new JMenuItem("Home");
|
JMenuItem home = new JMenuItem("Home");
|
||||||
ButtonBar.add(Home);
|
buttonBar.add(home);
|
||||||
Network = new JMenuItem("Network");
|
JMenuItem network = new JMenuItem("Network");
|
||||||
ButtonBar.add(Network);
|
buttonBar.add(network);
|
||||||
|
|
||||||
Itinerary = new JMenuItem("Itinerary");
|
JMenuItem itinerary = new JMenuItem("Itinerary");
|
||||||
ButtonBar.add(Itinerary);
|
buttonBar.add(itinerary);
|
||||||
ButtonBar.setPreferredSize(new Dimension(50, 500));
|
buttonBar.setPreferredSize(new Dimension(50, 500));
|
||||||
|
|
||||||
MainPanel.add(ButtonBar);
|
mainPanel.add(buttonBar);
|
||||||
MainPanel.add(CardPanel);
|
mainPanel.add(CardPanel);
|
||||||
|
|
||||||
modelStops = (DefaultTableModel) tableStops.getModel();
|
modelStops = (DefaultTableModel) tableStops.getModel();
|
||||||
modelStops.setColumnCount(2);
|
modelStops.setColumnCount(2);
|
||||||
|
@ -147,47 +127,37 @@ public class View extends JFrame {
|
||||||
modelItinerary = (DefaultTableModel) tableItinerary.getModel();
|
modelItinerary = (DefaultTableModel) tableItinerary.getModel();
|
||||||
modelItinerary.setColumnCount(3);
|
modelItinerary.setColumnCount(3);
|
||||||
modelItinerary.setColumnIdentifiers(new Object[]{"Line", "Stop", "Time"});
|
modelItinerary.setColumnIdentifiers(new Object[]{"Line", "Stop", "Time"});
|
||||||
this.StopList = s;
|
|
||||||
|
|
||||||
setContentPane(MainPanel);
|
setContentPane(mainPanel);
|
||||||
setTitle("app");
|
setTitle("app");
|
||||||
setExtendedState(JFrame.MAXIMIZED_BOTH);
|
setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||||
//setUndecorated(true);
|
//setUndecorated(true);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
Home.addActionListener(new ActionListener() {
|
home.addActionListener(e -> {
|
||||||
@Override
|
CardPanel.removeAll();
|
||||||
public void actionPerformed(ActionEvent e) {
|
CardPanel.add(HomePanel);
|
||||||
CardPanel.removeAll();
|
CardPanel.repaint();
|
||||||
CardPanel.add(HomePanel);
|
CardPanel.revalidate();
|
||||||
CardPanel.repaint();
|
|
||||||
CardPanel.revalidate();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Network.addActionListener(new ActionListener() {
|
network.addActionListener(e -> {
|
||||||
@Override
|
LoadSearchResult(s, modelStops);
|
||||||
public void actionPerformed(ActionEvent e) {
|
CardPanel.removeAll();
|
||||||
LoadSearchResult(s, modelStops);
|
CardPanel.add(NetworkPanel);
|
||||||
CardPanel.removeAll();
|
|
||||||
CardPanel.add(NetworkPanel);
|
|
||||||
|
|
||||||
CardPanel.repaint();
|
CardPanel.repaint();
|
||||||
CardPanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Itinerary.addActionListener(new ActionListener() {
|
itinerary.addActionListener(e -> {
|
||||||
@Override
|
LoadSearchResult(s, modelItinerary);
|
||||||
public void actionPerformed(ActionEvent e) {
|
CardPanel.removeAll();
|
||||||
LoadSearchResult(s, modelItinerary);
|
CardPanel.add(ItineraryPanel);
|
||||||
CardPanel.removeAll();
|
|
||||||
CardPanel.add(ItineraryPanel);
|
|
||||||
|
|
||||||
CardPanel.repaint();
|
CardPanel.repaint();
|
||||||
CardPanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
TextLocation.addKeyListener(new KeyAdapter() {
|
TextLocation.addKeyListener(new KeyAdapter() {
|
||||||
|
@ -208,32 +178,26 @@ public class View extends JFrame {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ButtonLocation.addActionListener(new ActionListener() {
|
buttonLocation.addActionListener(e -> {
|
||||||
@Override
|
CardPanel.removeAll();
|
||||||
public void actionPerformed(ActionEvent e) {
|
searchLocation = TextLocation.getText();
|
||||||
CardPanel.removeAll();
|
LoadSearchResult(s, modelStops);
|
||||||
searchLocation = TextLocation.getText();
|
System.out.println("search location clicked with text " + searchLocation);
|
||||||
LoadSearchResult(s, modelStops);
|
CardPanel.add(NetworkPanel);
|
||||||
System.out.println("search location clicked with text " + searchLocation);
|
|
||||||
CardPanel.add(NetworkPanel);
|
|
||||||
|
|
||||||
CardPanel.repaint();
|
CardPanel.repaint();
|
||||||
CardPanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ButtonCoord.addActionListener(new ActionListener() {
|
buttonCoord.addActionListener(e -> {
|
||||||
@Override
|
CardPanel.removeAll();
|
||||||
public void actionPerformed(ActionEvent e) {
|
searchCoord = TextCoord.getText();
|
||||||
CardPanel.removeAll();
|
LoadSearchResult(s, modelStops);
|
||||||
searchCoord = TextCoord.getText();
|
System.out.println("search coord clicked with text " + searchCoord);
|
||||||
LoadSearchResult(s, modelStops);
|
CardPanel.add(NetworkPanel);
|
||||||
System.out.println("search coord clicked with text " + searchCoord);
|
|
||||||
CardPanel.add(NetworkPanel);
|
|
||||||
|
|
||||||
CardPanel.repaint();
|
CardPanel.repaint();
|
||||||
CardPanel.revalidate();
|
CardPanel.revalidate();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
tableStops.addMouseListener(new MouseAdapter() {
|
tableStops.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -259,7 +223,6 @@ public class View extends JFrame {
|
||||||
s.add(new Stop("M14", "Gare de Lyon", 2.4658452681, 3.0265513));
|
s.add(new Stop("M14", "Gare de Lyon", 2.4658452681, 3.0265513));
|
||||||
View v = new View(s);
|
View v = new View(s);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showOptionsDialog(JTable table, int x, int y) {
|
private void showOptionsDialog(JTable table, int x, int y) {
|
||||||
|
@ -296,7 +259,7 @@ public class View extends JFrame {
|
||||||
model.setColumnCount(cols);
|
model.setColumnCount(cols);
|
||||||
|
|
||||||
// Add new rows based on the search results
|
// Add new rows based on the search results
|
||||||
count = 0;
|
int count = 0;
|
||||||
for (Stop stop : stops) {
|
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
|
// 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 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("Bus", new int[]{11, 8, 7});
|
||||||
put("Funicular", new int[]{15, 25, 20});
|
put("Funicular", new int[]{15, 25, 20});
|
||||||
put("Tram", new int[]{6, 7, 8, 9});
|
put("Tram", new int[]{6, 7, 8, 9});
|
||||||
|
@ -36,7 +36,7 @@ public class CSVSchedulesProvider {
|
||||||
private final Iterator<Transport> currentTransport;
|
private final Iterator<Transport> currentTransport;
|
||||||
private Iterator<TraceDescription> currentDescription = Collections.emptyIterator();
|
private Iterator<TraceDescription> currentDescription = Collections.emptyIterator();
|
||||||
|
|
||||||
private String current_tansport_type = "";
|
private String current_transport_type = "";
|
||||||
private LocalDateTime currentHour = null;
|
private LocalDateTime currentHour = null;
|
||||||
private LocalDateTime lastHour = 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
|
* @return a random minute depending on the type of the transport
|
||||||
*/
|
*/
|
||||||
public static int pickMinute(String transportType) {
|
public static int pickMinute(String transportType) {
|
||||||
|
@ -84,17 +84,15 @@ public class CSVSchedulesProvider {
|
||||||
} else if (currentHour.isBefore(lastHour)) {
|
} else if (currentHour.isBefore(lastHour)) {
|
||||||
// System.out.println("**Skip: Le current hour est plus petit "+currentHour+"|||"+lastHour);
|
// System.out.println("**Skip: Le current hour est plus petit "+currentHour+"|||"+lastHour);
|
||||||
addRandomMinutes();
|
addRandomMinutes();
|
||||||
} else if (!currentHour.isBefore(lastHour)) {
|
} else {
|
||||||
// System.out.println("**Skip: Le current hour est plus grand "+currentHour+"|||"+lastHour);
|
// System.out.println("**Skip: Le current hour est plus grand "+currentHour+"|||"+lastHour);
|
||||||
skipToNextDescription();
|
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() {
|
private void skipToNextDescription() {
|
||||||
if (this.currentDescription.hasNext()) {
|
if (this.currentDescription.hasNext()) {
|
||||||
|
@ -123,7 +121,7 @@ public class CSVSchedulesProvider {
|
||||||
Transport transport = this.currentTransport.next();
|
Transport transport = this.currentTransport.next();
|
||||||
this.line[ScheduleFormat.LINE_INDEX] = transport.name;
|
this.line[ScheduleFormat.LINE_INDEX] = transport.name;
|
||||||
|
|
||||||
current_tansport_type = transport.type;
|
current_transport_type = transport.type;
|
||||||
this.currentDescription = transport.descriptions.iterator();
|
this.currentDescription = transport.descriptions.iterator();
|
||||||
skipToNextDescription();
|
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
|
* Add random minutes for the next passage of transport. The random minutes depends on the type of
|
||||||
* of the transport
|
* the transport
|
||||||
*/
|
*/
|
||||||
private void addRandomMinutes() {
|
private void addRandomMinutes() {
|
||||||
// System.out.println("** addM: AVANT: "+currentHour);
|
// 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);
|
this.line[ScheduleFormat.TIME_INDEX] = currentHour.format(HOUR_MINUTE_FORMATTER);
|
||||||
// System.out.println("** addM: APRES: "+currentHour);
|
// System.out.println("** addM: APRES: "+currentHour);
|
||||||
// debut ++;
|
// debut ++;
|
||||||
|
|
|
@ -92,7 +92,7 @@ public final class CSVStreamProvider {
|
||||||
*/
|
*/
|
||||||
private Iterator<List<StopEntry>> currentPath = Collections.emptyIterator();
|
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();
|
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.
|
* A tool method to give a delay to go through a certain distance.
|
||||||
* <p>
|
* <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.
|
* between.
|
||||||
*
|
*
|
||||||
* @param distance the distance (in km)
|
* @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
|
* @return The newly generated line of text
|
||||||
*/
|
*/
|
||||||
|
@ -302,7 +302,7 @@ public final class CSVStreamProvider {
|
||||||
String end_p = this.line[NetworkFormat.STOP_INDEX];
|
String end_p = this.line[NetworkFormat.STOP_INDEX];
|
||||||
// String bifurcation = this.line[NetworkFormat.VARIANT_INDEX];
|
// String bifurcation = this.line[NetworkFormat.VARIANT_INDEX];
|
||||||
|
|
||||||
Transport transp = null;
|
Transport transp;
|
||||||
if (!transports.containsKey(traceId)) {
|
if (!transports.containsKey(traceId)) {
|
||||||
transp = new Transport(nameTransport, traceType, url_image);
|
transp = new Transport(nameTransport, traceType, url_image);
|
||||||
transports.put(traceId, transp);
|
transports.put(traceId, transp);
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class IDFMNetworkExtractor {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
for (Transport entry : transports.values()) {
|
for (Transport entry : transports.values()) {
|
||||||
entry.buildBifurcationOptimzed();
|
entry.buildBifurcationOptimized();
|
||||||
}
|
}
|
||||||
|
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class Stop {
|
||||||
/**
|
/**
|
||||||
* Checks is stopName is connected to this one
|
* Checks is stopName is connected to this one
|
||||||
*
|
*
|
||||||
* @param stopName
|
* @param stopName stop name
|
||||||
* @return True if stopName is connected to the current stop
|
* @return True if stopName is connected to the current stop
|
||||||
*/
|
*/
|
||||||
public boolean isStopConnected(String stopName) {
|
public boolean isStopConnected(String stopName) {
|
||||||
|
@ -38,7 +38,7 @@ public class Stop {
|
||||||
/**
|
/**
|
||||||
* Return the connected stop with the name : stopName
|
* Return the connected stop with the name : stopName
|
||||||
*
|
*
|
||||||
* @param stopName
|
* @param stopName stop name
|
||||||
* @return the connected stop with the name : stopName
|
* @return the connected stop with the name : stopName
|
||||||
*/
|
*/
|
||||||
public BifStop getConnectedStop(String stopName) {
|
public BifStop getConnectedStop(String stopName) {
|
||||||
|
|
|
@ -6,20 +6,24 @@ package fr.u_paris.gla.project.idfm;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Objects;
|
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 class StopEntry implements Comparable<StopEntry> {
|
||||||
|
|
||||||
public final String lname;
|
public final String lname;
|
||||||
public final double longitude;
|
public final double longitude;
|
||||||
public final double latitude;
|
public final double latitude;
|
||||||
|
|
||||||
/** Create the stop
|
/**
|
||||||
|
* Create the stop
|
||||||
*
|
*
|
||||||
* @param lname
|
* @param lname line name
|
||||||
* @param longitude
|
* @param longitude longitude
|
||||||
* @param latitude */
|
* @param latitude latitude
|
||||||
|
*/
|
||||||
public StopEntry(String lname, double longitude, double latitude) {
|
public StopEntry(String lname, double longitude, double latitude) {
|
||||||
super();
|
super();
|
||||||
this.lname = lname;
|
this.lname = lname;
|
||||||
|
@ -57,15 +61,15 @@ public class StopEntry implements Comparable<StopEntry> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getClass() != obj.getClass()) {
|
if (getClass() != obj.getClass()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
StopEntry other = (StopEntry) obj;
|
StopEntry other = (StopEntry) obj;
|
||||||
return Double.doubleToLongBits(latitude) == Double
|
return Double.doubleToLongBits(latitude) == Double
|
||||||
.doubleToLongBits(other.latitude) && Objects.equals(lname, other.lname)
|
.doubleToLongBits(other.latitude) && Objects.equals(lname, other.lname)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
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
|
* 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.
|
* 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
|
* Add all the description to the current one
|
||||||
*
|
*
|
||||||
* @param desctipt
|
* @param ldescription
|
||||||
*/
|
*/
|
||||||
public void addDescriptions(List<TraceDescription> desctipt) {
|
public void addDescriptions(List<TraceDescription> ldescription) {
|
||||||
descriptions.addAll(desctipt);
|
descriptions.addAll(ldescription);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class Transport {
|
||||||
Stop fin = stopsMap.get(d.to);
|
Stop fin = stopsMap.get(d.to);
|
||||||
if (debut != null && fin != null) {
|
if (debut != null && fin != null) {
|
||||||
SimpleEntry<Boolean, List<Integer>> sol = roadToLast(debut.name, fin.name,
|
SimpleEntry<Boolean, List<Integer>> sol = roadToLast(debut.name, fin.name,
|
||||||
new ArrayList<String>(), new ArrayList<Integer>());
|
new ArrayList<>(), new ArrayList<>());
|
||||||
if (sol.getKey()) {
|
if (sol.getKey()) {
|
||||||
// found++;
|
// found++;
|
||||||
d.bifurcation = sol.getValue();
|
d.bifurcation = sol.getValue();
|
||||||
|
@ -55,7 +55,7 @@ public class Transport {
|
||||||
/**
|
/**
|
||||||
* Build the bifurcation for all the descriptions but optimized
|
* Build the bifurcation for all the descriptions but optimized
|
||||||
*/
|
*/
|
||||||
public void buildBifurcationOptimzed() {
|
public void buildBifurcationOptimized() {
|
||||||
// int found = 0;
|
// int found = 0;
|
||||||
for (TraceDescription d : descriptions) {
|
for (TraceDescription d : descriptions) {
|
||||||
Stop debut = stopsMap.get(d.from);
|
Stop debut = stopsMap.get(d.from);
|
||||||
|
@ -63,7 +63,7 @@ public class Transport {
|
||||||
if (debut != null && fin != null) {
|
if (debut != null && fin != null) {
|
||||||
Set<String> alreadyVisited = new HashSet<>();
|
Set<String> alreadyVisited = new HashSet<>();
|
||||||
SimpleEntry<Boolean, List<Integer>> sol = roadToLastOptimized(debut.name, fin.name,
|
SimpleEntry<Boolean, List<Integer>> sol = roadToLastOptimized(debut.name, fin.name,
|
||||||
alreadyVisited, new ArrayList<Integer>());
|
alreadyVisited, new ArrayList<>());
|
||||||
if (sol.getKey()) {
|
if (sol.getKey()) {
|
||||||
// found++;
|
// found++;
|
||||||
d.bifurcation = sol.getValue();
|
d.bifurcation = sol.getValue();
|
||||||
|
@ -82,9 +82,9 @@ public class Transport {
|
||||||
*/
|
*/
|
||||||
public boolean isTerminus(String stop) {
|
public boolean isTerminus(String stop) {
|
||||||
for (TraceDescription t : descriptions) {
|
for (TraceDescription t : descriptions) {
|
||||||
if (stop.equals(t.first) || stop.equals(t.last)) {
|
if (stop.equals(t.first) || stop.equals(t.last)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -95,8 +95,8 @@ public class Transport {
|
||||||
*
|
*
|
||||||
* @param currentStop the current stop we are visiting
|
* @param currentStop the current stop we are visiting
|
||||||
* @param last The last stop we are trying to go to
|
* @param last The last stop we are trying to go to
|
||||||
* @param alreadyVisited All the stop we already have visisted
|
* @param alreadyVisited All the stop we already have visited
|
||||||
* @param bif All the bifurcation encountered from the first stop to the current one
|
* @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
|
* @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,
|
public SimpleEntry<Boolean, List<Integer>> roadToLast(String currentStop, String last,
|
||||||
|
@ -118,9 +118,9 @@ public class Transport {
|
||||||
for (BifStop b : current.connected.values()) {
|
for (BifStop b : current.connected.values()) {
|
||||||
if (!visitedCopy.contains(b.stop.name)) {
|
if (!visitedCopy.contains(b.stop.name)) {
|
||||||
List<Integer> bifCopy = new ArrayList<>(bifurcation);
|
List<Integer> bifCopy = new ArrayList<>(bifurcation);
|
||||||
if (b.bifurc != 0) {
|
if (b.bifurc != 0) {
|
||||||
bifCopy.add(b.bifurc);
|
bifCopy.add(b.bifurc);
|
||||||
}
|
}
|
||||||
solutions.add(roadToLast(b.stop.name, last, visitedCopy, bifCopy));
|
solutions.add(roadToLast(b.stop.name, last, visitedCopy, bifCopy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,8 +142,8 @@ public class Transport {
|
||||||
*
|
*
|
||||||
* @param currentStop the current stop we are visiting
|
* @param currentStop the current stop we are visiting
|
||||||
* @param last The last stop we are trying to go to
|
* @param last The last stop we are trying to go to
|
||||||
* @param alreadyVisited All the stop we already have visisted
|
* @param alreadyVisited All the stop we already have visited
|
||||||
* @param bif All the bifurcation encountered from the first stop to the current one
|
* @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
|
* @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,
|
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() {
|
public void printAllConnectionStops() {
|
||||||
System.out.println("Affichage des couples (stop, next du stop):");
|
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
|
* Add all the description to the current one
|
||||||
*
|
*
|
||||||
* @param desctipt
|
* @param ldescription
|
||||||
*/
|
*/
|
||||||
public void addDescriptions(List<TraceDescription> desctipt) {
|
public void addDescriptions(List<TraceDescription> ldescription) {
|
||||||
descriptions.addAll(desctipt);
|
descriptions.addAll(ldescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ public final class UnidentifiedStopEntry extends StopEntry {
|
||||||
/**
|
/**
|
||||||
* Create the stop
|
* Create the stop
|
||||||
*
|
*
|
||||||
* @param longitude
|
* @param longitude longitude
|
||||||
* @param latitude
|
* @param latitude latitude
|
||||||
*/
|
*/
|
||||||
public UnidentifiedStopEntry(double longitude, double latitude) {
|
public UnidentifiedStopEntry(double longitude, double latitude) {
|
||||||
super("Unidentified", longitude, latitude); //$NON-NLS-1$
|
super("Unidentified", longitude, latitude); //$NON-NLS-1$
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getNextTime(double currentTime) {
|
public double getNextTime(double currentTime) {
|
||||||
if (this.schedules.size() == 0) {
|
if (this.schedules.isEmpty()) {
|
||||||
return currentTime;
|
return currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getCost(double currentTime) {
|
public double getCost(double currentTime) {
|
||||||
if (this.schedules.size() == 0) {
|
if (this.schedules.isEmpty()) {
|
||||||
if (this.lineName.equals("WALK")) {
|
if (this.lineName.equals("WALK")) {
|
||||||
return this.time;
|
return this.time;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ public class Finder {
|
||||||
/**
|
/**
|
||||||
* return a path from startNode to goalNode using A* algorithm
|
* return a path from startNode to goalNode using A* algorithm
|
||||||
*
|
*
|
||||||
* @param startNode
|
* @param startNode start of algorithm
|
||||||
* @param goalNode
|
* @param goalNode end of algorithm
|
||||||
*/
|
*/
|
||||||
public List<Path> findPath(Stop startNode, Stop goalNode, double startTime) {
|
public List<Path> findPath(Stop startNode, Stop goalNode, double startTime) {
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class Finder {
|
||||||
HashMap<Stop, Double> fScore = new HashMap<>();
|
HashMap<Stop, Double> fScore = new HashMap<>();
|
||||||
|
|
||||||
// Initialize scores for all nodes to infinity
|
// Initialize scores for all nodes to infinity
|
||||||
for (Stop node : graph.getNodes()) {
|
for (Stop node : graph.nodes()) {
|
||||||
gScore.put(node, Double.POSITIVE_INFINITY);
|
gScore.put(node, Double.POSITIVE_INFINITY);
|
||||||
fScore.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
|
* Once we found the destination we reconstruct the path
|
||||||
*
|
*
|
||||||
* @param cameFrom
|
* @param cameFrom departure
|
||||||
* @param current
|
* @param current current stop
|
||||||
* @return path
|
* @return path
|
||||||
*/
|
*/
|
||||||
private List<Path> reconstructPath(HashMap<Stop, Path> cameFrom, Stop current) {
|
private List<Path> reconstructPath(HashMap<Stop, Path> cameFrom, Stop current) {
|
||||||
|
@ -111,9 +111,9 @@ public class Finder {
|
||||||
/**
|
/**
|
||||||
* Update the priority queue
|
* Update the priority queue
|
||||||
*
|
*
|
||||||
* @param openSet
|
* @param openSet stop queue
|
||||||
* @param node
|
* @param node stop
|
||||||
* @param newF
|
* @param newF new stop
|
||||||
*/
|
*/
|
||||||
public void updatePriority(PriorityQueue<Stop> openSet, Stop node, double newF) {
|
public void updatePriority(PriorityQueue<Stop> openSet, Stop node, double newF) {
|
||||||
openSet.remove(node);
|
openSet.remove(node);
|
||||||
|
|
|
@ -3,26 +3,9 @@ package fr.u_paris.gla.project.itinerary;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class Graph {
|
public record Graph(Set<Stop> nodes, Map<Stop, Set<Connection>> connections) {
|
||||||
|
|
||||||
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 Set<Connection> getConnections(Stop node) {
|
public Set<Connection> getConnections(Stop node) {
|
||||||
return connections.get(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 line the current line we want to parse
|
||||||
* @param nodes the graph of stops
|
* @param nodes the graph of stops
|
||||||
* @param tmp list of the created stops
|
* @param tmp list of the created stops
|
||||||
* @param connections
|
* @param connections set of connections
|
||||||
*/
|
*/
|
||||||
private static void addLine(String[] line, HashSet<Stop> nodes,
|
private static void addLine(String[] line, HashSet<Stop> nodes,
|
||||||
HashMap<String, ArrayList<Stop>> tmp, HashMap<Stop, Set<Connection>> connections) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stop next_stop = null;
|
Stop next_stop = null;
|
||||||
if (directions.size() > 1) {
|
if (directions.size() > 1) {
|
||||||
int bifurcation = bifurcations.size() == 0 ? 0 : bifurcations.get(0);
|
int bifurcation = bifurcations.isEmpty() ? 0 : bifurcations.get(0);
|
||||||
if (bifurcations.size() > 0) {
|
if (!bifurcations.isEmpty()) {
|
||||||
bifurcations.remove(0);
|
bifurcations.remove(0);
|
||||||
}
|
}
|
||||||
for (Connection d : directions) {
|
for (Connection d : directions) {
|
||||||
|
@ -184,7 +184,7 @@ public class Parse {
|
||||||
} else {
|
} else {
|
||||||
next_stop = directions.get(0).getStop();
|
next_stop = directions.get(0).getStop();
|
||||||
if (directions.get(0).getBifurcation() != 0) {
|
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);
|
bifurcations.remove(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ public class Path {
|
||||||
private final double travelTime;
|
private final double travelTime;
|
||||||
private final String line;
|
private final String line;
|
||||||
private final Connection connection;
|
private final Connection connection;
|
||||||
private double distance;
|
|
||||||
|
|
||||||
public Path(Stop current, Connection connection, double startTime) {
|
public Path(Stop current, Connection connection, double startTime) {
|
||||||
this.current = current;
|
this.current = current;
|
||||||
|
|
|
@ -92,8 +92,8 @@ public final class CSVTools {
|
||||||
/**
|
/**
|
||||||
* Save our current CSV variable's data into an actual file
|
* Save our current CSV variable's data into an actual file
|
||||||
*
|
*
|
||||||
* @param filename the saved file's name and path
|
* @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
|
* @throws IOException if we can't write the data into the file
|
||||||
*/
|
*/
|
||||||
public static void writeCSVToFile(String filename,
|
public static void writeCSVToFile(String filename,
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class CSVStreamProviderTest {
|
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
|
@Test
|
||||||
public void testHasNext() {
|
public void testHasNext() {
|
||||||
// Scénario sans Trace
|
// Scénario sans Trace
|
||||||
|
|
|
@ -63,7 +63,7 @@ class IDFMNetworkExtractorTest {
|
||||||
|
|
||||||
method.invoke(null, trace, candidate);
|
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.");
|
assertTrue(true, "L'appel de addCandidate s'est déroulé sans erreur.");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@ public class TraceEntryTest {
|
||||||
String terminus1 = "Terminus A";
|
String terminus1 = "Terminus A";
|
||||||
String terminus2 = "Terminus B";
|
String terminus2 = "Terminus B";
|
||||||
|
|
||||||
//Ajouter des arrêt sur la ligne
|
//Ajouter des arrêts sur la ligne
|
||||||
traceEntry.addTerminus(terminus1);
|
traceEntry.addTerminus(terminus1);
|
||||||
traceEntry.addTerminus(terminus2);
|
traceEntry.addTerminus(terminus2);
|
||||||
List<String> terminusList = traceEntry.getTerminus();
|
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
|
@Test
|
||||||
public void testTraceEntryName() {
|
public void testTraceEntryName() {
|
||||||
TraceEntry traceEntry = new TraceEntry("Ligne 1", "IDFM:03434", "Bus", "dummy_url");
|
TraceEntry traceEntry = new TraceEntry("Ligne 1", "IDFM:03434", "Bus", "dummy_url");
|
||||||
|
|
|
@ -77,4 +77,4 @@ class CSVToolsTest {
|
||||||
CSVTools.writeCSVToFile(".", test);
|
CSVTools.writeCSVToFile(".", test);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue