-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLigne.java
More file actions
68 lines (56 loc) · 1.76 KB
/
Copy pathLigne.java
File metadata and controls
68 lines (56 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// --- Ligne.java ---
import java.util.Arrays;
/**
* La classe Ligne représente une ligne de transport.
* Elle contient un identifiant, un nom, un mode de transport et la liste des stations desservies.
*/
public class Ligne {
private int identifiant;
private String nom;
private String modeTransport;
private String[] stationsDesservies;
/**
* Constructeur de Ligne.
*
* @param identifiant L'identifiant de la ligne.
* @param nom Le nom de la ligne.
* @param modeTransport Le mode de transport (Metro, Bus, Tram, etc.).
* @param stationsDesservies Le tableau des noms de stations desservies.
*/
public Ligne(int identifiant,
String nom,
String modeTransport,
String[] stationsDesservies) {
this.identifiant = identifiant;
this.nom = nom;
this.modeTransport = modeTransport;
this.stationsDesservies = stationsDesservies;
}
// --- Getters (accesseurs) ---
public int getIdentifiant() {
return identifiant;
}
public String getNom() {
return nom;
}
public String getModeTransport() {
return modeTransport;
}
public String getStationsDesservies() {
return Arrays.toString(stationsDesservies);
}
public String[] getListeStationsDesservies() {
return stationsDesservies;
}
public String toString() {
return identifiant + ") " + nom;
}
/**
* Retourne une description détaillée de la ligne.
*/
public String informationsDetaillees() {
return "Nom : " + nom + "\n"
+ "Mode de transport : " + this.getModeTransport() + "\n"
+ "Stations desservies : " + this.getStationsDesservies() + "\n";
}
}