Skip to content

Commit e6668eb

Browse files
author
Fabien Zoccola
committed
style: renamed constants to match pascal case, as they should
1 parent 3757dd7 commit e6668eb

File tree

7 files changed

+29
-33
lines changed

7 files changed

+29
-33
lines changed

src/main/java/fr/france/Commune.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,8 @@ public boolean equals(Object obj) {
117117
if (codePostal != other.codePostal)
118118
return false;
119119
if (nom == null) {
120-
if (other.nom != null)
121-
return false;
122-
} else if (!nom.equals(other.nom))
123-
return false;
124-
return true;
120+
return other.nom == null;
121+
} else return nom.equals(other.nom);
125122
}
126123

127124
}

src/main/java/fr/france/Departement.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -478,20 +478,20 @@ public enum Departement {
478478
ILE_DE_CLIPPERTON(989, StatutDepartement.COM, "Île de Clipperton", "Clipperton",
479479
Region.DEPARTEMENT_NON_RATTACHE_A_UNE_REGION);
480480

481-
private int code;
482-
private StatutDepartement statut;
483-
private String nom;
484-
private String villeDePrefecture;
485-
private Region region;
481+
private final int code;
482+
private final StatutDepartement statut;
483+
private final String nom;
484+
private final String villeDePrefecture;
485+
private final Region region;
486486

487487
/**
488-
* @param code
489-
* @param statut
490-
* @param nom
491-
* @param villeDePrefecture
492-
* @param region
488+
* @param code le code du département
489+
* @param statut son statut
490+
* @param nom son nom
491+
* @param villeDePrefecture la ville de sa préfecture
492+
* @param region sa région
493493
*/
494-
private Departement(int code, StatutDepartement statut, String nom, String villeDePrefecture, Region region) {
494+
Departement(int code, StatutDepartement statut, String nom, String villeDePrefecture, Region region) {
495495
this.code = code;
496496
this.statut = statut;
497497
this.nom = nom;

src/main/java/fr/france/Region.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ public enum Region {
104104
DEPARTEMENT_NON_RATTACHE_A_UNE_REGION("Département non rattaché à une région.");
105105

106106
private List<Departement> departements;
107-
private String nom;
107+
private final String nom;
108108

109109
/**
110110
* @param nom Nom de la région
111111
*/
112-
private Region(String nom) {
112+
Region(String nom) {
113113
this.nom = nom;
114114
}
115115

src/main/java/fr/france/RepertoireCommune.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private RepertoireCommune() {
3535
throw new IllegalStateException("Class utilitaire");
3636
}
3737

38-
private static final List<Commune> CommuneS = initCommunes();
38+
private static final List<Commune> COMMUNES = initCommunes();
3939

4040
private static List<Commune> initCommunes() {
4141
List<Commune> result = null;
@@ -56,7 +56,7 @@ private static List<Commune> initCommunes() {
5656
Map<Integer, List<Commune>> codePostaux = new HashMap<>();
5757
Map<String, List<Commune>> noms = new HashMap<>();
5858
Map<String, Commune> nomEtCodePostal = new HashMap<>();
59-
for (Commune Commune : CommuneS) {
59+
for (Commune Commune : COMMUNES) {
6060
if (Commune.getNom() == null)
6161
continue;
6262
nomEtCodePostal.put(OutilsString.formater(Commune.getNom()) + Commune.getCodePostal(), Commune);
@@ -78,7 +78,7 @@ private static List<Commune> initCommunes() {
7878
* @see Commune
7979
*/
8080
public static List<Commune> getCommunes() {
81-
return new ArrayList<>(CommuneS);
81+
return new ArrayList<>(COMMUNES);
8282
}
8383

8484
/**

src/main/java/fr/france/outils/OutilsDepartement.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.util.ArrayList;
44
import java.util.Arrays;
5-
import java.util.Collection;
65
import java.util.EnumMap;
76
import java.util.List;
87
import java.util.Map;
@@ -33,7 +32,7 @@ private OutilsDepartement() {
3332

3433
private static final Map<Integer, Departement> REPERTOIRE_CODE = initialiserRepertoireCode();
3534
private static final RepertoireGenerique<Departement> REPERTOIRE_NOM = new RepertoireGenerique<>(Departement.class);
36-
private static final Map<Departement, List<Commune>> REPERTOIRE_Commune = initialiserRepertoireCommune();
35+
private static final Map<Departement, List<Commune>> REPERTOIRE_COMMUNE = initialiserRepertoireCommune();
3736

3837
public static List<Departement> filtrerDepartementsParRegion(Region region) {
3938
List<Departement> result = new ArrayList<>();
@@ -60,22 +59,22 @@ public static Departement rechercherParCode(int code) {
6059
}
6160

6261
public static List<Commune> getCommunes(Departement departement){
63-
return REPERTOIRE_Commune.getOrDefault(departement, new ArrayList<>());
62+
return REPERTOIRE_COMMUNE.getOrDefault(departement, new ArrayList<>());
6463
}
6564

6665
private static EnumMap<Departement, List<Commune>> initialiserRepertoireCommune() {
6766
EnumMap<Departement, List<Commune>> result = new EnumMap<>(Departement.class);
6867
for (Commune Commune : RepertoireCommune.getCommunes()) {
6968
Departement departement = Commune.getDepartement();
70-
List<Commune> Communes = result.computeIfAbsent(departement, k -> new ArrayList<>());
71-
Communes.add(Commune);
69+
List<Commune> communes = result.computeIfAbsent(departement, k -> new ArrayList<>());
70+
communes.add(Commune);
7271
}
7372
return result;
7473
}
7574

7675
private static Map<Integer, Departement> initialiserRepertoireCode() {
7776
return OutilsRepertoireGenerique.genererMap(
78-
Arrays.asList(Departement.values()).stream().map(Departement::getCode).collect(Collectors.toList()),
77+
Arrays.stream(Departement.values()).map(Departement::getCode).collect(Collectors.toList()),
7978
Departement.class);
8079
}
8180
}

src/main/java/fr/france/outils/OutilsRegion.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@ private OutilsRegion() {
2626
}
2727

2828
private static final RepertoireGenerique<Region> REPERTOIRE_REGION = new RepertoireGenerique<>(Region.class);
29-
private static final Map<Region, List<Commune>> REPERTOIRE_Commune = initialiserRepertoireCommune();
29+
private static final Map<Region, List<Commune>> REPERTOIRE_COMMUNE = initialiserRepertoireCommune();
3030

3131
public static Region rechercherParNom(String nom) {
3232
return REPERTOIRE_REGION.rechercherParNom(nom);
3333
}
3434

3535
public static List<Commune> getCommunes(Region region) {
36-
return REPERTOIRE_Commune.get(region);
36+
return REPERTOIRE_COMMUNE.get(region);
3737
}
3838

3939
private static Map<Region, List<Commune>> initialiserRepertoireCommune() {
4040
EnumMap<Region, List<Commune>> result = new EnumMap<>(Region.class);
4141
for (Region region : Region.values()) {
42-
List<Commune> Communes = new ArrayList<>();
42+
List<Commune> communes = new ArrayList<>();
4343
for (Departement departement : region.getDepartements()) {
44-
Communes.addAll(departement.getCommunes());
44+
communes.addAll(departement.getCommunes());
4545
}
46-
result.put(region, Communes);
46+
result.put(region, communes);
4747
}
4848
return result;
4949
}

src/main/java/fr/france/outils/RepertoireGenerique.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class RepertoireGenerique<T extends Enum<T>> {
99
private final Map<String, T> repertoire;
1010

1111
/**
12-
* @param repertoire
12+
* @param enumType the enum
1313
*/
1414
public RepertoireGenerique(Class<T> enumType) {
1515
Map<String, T> temp = new HashMap<>();

0 commit comments

Comments
 (0)