[docs] Some comments, code cleanup et README update
This commit is contained in:
parent
6ecff939ef
commit
f764a80882
9 changed files with 37 additions and 61 deletions
21
README.md
21
README.md
|
@ -18,31 +18,28 @@ Afin de compiler et lancer les tests, exécutez simplement
|
|||
mvn verify
|
||||
```
|
||||
|
||||
Afin de vérifier les tests via JaCoCo.
|
||||
Les résultats du test sont dans `target/site/jacoco/index.html`.
|
||||
|
||||
```bash
|
||||
mvn clean jacoco:prepare-agent install jacoco:report
|
||||
```
|
||||
|
||||
Par la suite, `mvn jacoco:report` suffit.
|
||||
|
||||
Dans sa version initiale, le programme fournit est un simple code qui se lance en terminal ou en 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:
|
||||
|
||||
```
|
||||
java -jar target/project-2024.1.0.0-SNAPSHOT.jar --info
|
||||
java -jar target/project-2024.1.0.0-SNAPSHOT.jar
|
||||
```
|
||||
|
||||
L'option de lancement `--info` causera l'affichage dans la console d'informations de l'application.
|
||||
|
||||
L'option de lancement `--gui` causera l'ouverture d'une fenêtre affichant le logo de l'Université de Paris.
|
||||
|
||||
Sans option, le programme Pathfinder sera lancé.
|
||||
|
||||
## Tests JaCoCo
|
||||
|
||||
```
|
||||
Afin de vérifier la couverture des tests via JaCoCo:
|
||||
|
||||
```bash
|
||||
mvn clean jacoco:prepare-agent install jacoco:report
|
||||
```
|
||||
|
||||
Puis ouvrir le fichier `./target/site/jacoco/index.html`.
|
||||
Les résultats seront stockés dans `target/site/jacoco/index.html`.
|
||||
|
||||
Par la suite, ```mvn jacoco:report``` suffit.
|
||||
|
|
|
@ -64,7 +64,6 @@ public class App {
|
|||
}
|
||||
}
|
||||
else {
|
||||
// testRelease();
|
||||
run();
|
||||
}
|
||||
}
|
||||
|
@ -83,26 +82,6 @@ public class App {
|
|||
SwingUtilities.invokeLater(() -> new View(graph, finder, s));
|
||||
}
|
||||
|
||||
public static void testRelease(){
|
||||
Parse parse = new Parse();
|
||||
parse.parseFiles();
|
||||
Stop source = parse.getTmp().get("Porte d'Ivry").get(0);
|
||||
Stop destination = parse.getTmp().get("Châtelet").get(0);
|
||||
System.out.println("Itinéraire de Porte d'Ivry à Châtelet");
|
||||
List<Path> result = parse.getItinerary(source, destination, 43200);
|
||||
for(Path element : result){
|
||||
System.out.println(element.getCurrentStop());
|
||||
}
|
||||
System.out.println("°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°");
|
||||
System.out.println("Itinéraire de Porte d'Ivry à Châtelet");
|
||||
source = parse.getTmp().get("Saint-Jacques").get(0);
|
||||
destination = parse.getTmp().get("Porte d'Ivry").get(0);
|
||||
result = parse.getItinerary(source, destination, 43200);
|
||||
for(Path element : result){
|
||||
System.out.println(element.getCurrentStop());
|
||||
}
|
||||
|
||||
}
|
||||
/** @param out the output stream */
|
||||
public static void printAppInfos(PrintStream out) {
|
||||
Properties props = readApplicationProperties();
|
||||
|
|
|
@ -60,6 +60,12 @@ public final class CSVImageProvider {
|
|||
return Arrays.copyOf(this.line, this.line.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns a list of ImagePair, which represents the name of the line and the link to the
|
||||
* image of the line details.
|
||||
* The list is created once and then store in a static variable.
|
||||
* @return an ArrayList of ImagePair
|
||||
*/
|
||||
public static ArrayList<ImagePair> getLineImageMap() {
|
||||
if (lineImageMap != null)
|
||||
return lineImageMap;
|
||||
|
@ -72,10 +78,6 @@ public final class CSVImageProvider {
|
|||
String detail = line[ImageFormat.LINE_DETAIL_INDEX];
|
||||
String imageUrl = line[ImageFormat.IMAGE_URL_INDEX];
|
||||
|
||||
int index = (int) lineImageMap.stream()
|
||||
.filter(pair -> pair.getLine().equals(label))
|
||||
.count();
|
||||
|
||||
lineImageMap.add(new ImagePair(label, detail, imageUrl));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class CSVSchedulesProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* Move to the the nextDescription of a Transport line
|
||||
* Move to the nextDescription of a Transport line
|
||||
*/
|
||||
private void skipToNextDescription() {
|
||||
if (this.currentDescription.hasNext()) {
|
||||
|
|
|
@ -202,7 +202,7 @@ public final class CSVStreamProvider {
|
|||
} while (currentSegmentStart == null);
|
||||
}
|
||||
|
||||
/** Store current trace' data as a String array
|
||||
/** Store current trace data as a String array
|
||||
* @return The newly generated line of text
|
||||
*/
|
||||
public String[] next() {
|
||||
|
|
|
@ -5,8 +5,19 @@ package fr.u_paris.gla.project.idfm;
|
|||
* These getters ables a ComboBox to show the label returned by toString, and get a specific value when the object is returned
|
||||
*/
|
||||
public class ImagePair {
|
||||
/**
|
||||
* The name of the line
|
||||
*/
|
||||
private final String line;
|
||||
|
||||
/**
|
||||
* The label that will be shown in the ComboBox
|
||||
*/
|
||||
private final String label;
|
||||
|
||||
/**
|
||||
* The link of the line details
|
||||
*/
|
||||
private final String value;
|
||||
|
||||
public ImagePair(String label, String label_detail, String value){
|
||||
|
|
|
@ -3,11 +3,6 @@
|
|||
*/
|
||||
package fr.u_paris.gla.project.io;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.ResolverStyle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A tool class for the Image format.
|
||||
*/
|
||||
|
|
|
@ -17,9 +17,17 @@ public class ApiUtils {
|
|||
private static final Logger LOGGER = Logger
|
||||
.getLogger(IDFMNetworkExtractor.class.getName());
|
||||
|
||||
// OpenStreetMap API URL
|
||||
/**
|
||||
* OpenStreetMap API URL
|
||||
*/
|
||||
private static final String OSM_URL = "https://nominatim.openstreetmap.org/search";
|
||||
|
||||
/**
|
||||
* This function returns the GPS location of a string, using OSM API.
|
||||
* The string can be anything, and adress, a street, a place.
|
||||
* @param term the term to search
|
||||
* @return the GPS location, (0,0) if not result
|
||||
*/
|
||||
public static double[] getGPSLocation(String term) {
|
||||
try {
|
||||
String urlString = String.format("%s?q=%s&format=json", OSM_URL, URLEncoder.encode(term, StandardCharsets.UTF_8));
|
||||
|
|
|
@ -87,20 +87,4 @@ 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
|
||||
// * @throws IOException if we can't write the data into the file
|
||||
// */
|
||||
// public static void writeCSVToFile(String filename,
|
||||
// Stream<String[][]> contentLinesConsumer) throws IOException {
|
||||
// try (FileWriter writer = new FileWriter(filename, StandardCharsets.UTF_8)) {
|
||||
// CSVWriterBuilder wBuilder = new CSVWriterBuilder(writer).withSeparator(';');
|
||||
// try (ICSVWriter csv = wBuilder.build()) {
|
||||
// contentLinesConsumer.forEachOrdered(line -> Arrays.stream(line).forEach(csv::writeNext));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue