Skip to content

Commit 22e45c2

Browse files
committed
🔨 Validation test EmploiDuTempsProxy
1 parent 97b3366 commit 22e45c2

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

src/main/java/fr/umontp/edt/EmploiDuTempsProxy.java

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @author emerick-biron
1717
* @author MathieuSoysal
18-
* @version 1.3.0
18+
* @version 1.4.0
1919
* @see EmploiDuTemps
2020
* @see InterfaceEmploiDuTemps
2121
*/
@@ -26,6 +26,7 @@ public final class EmploiDuTempsProxy implements InterfaceEmploiDuTemps {
2626
private EnumMap<Groupe, Planning> cacheGroupe;
2727
private IdentityHashMap<Professeur, Planning> cacheProfesseur;
2828
private HashMap<LocalDate, Planning> cacheDate;
29+
private HashMap<PlanningFiltreur, Planning> cachePlanningFiltreur;
2930
private HashMap<MultiKey<LocalDate, Groupe>, Planning> cacheDateGroupe;
3031

3132
@SuppressWarnings("deprecation")
@@ -34,6 +35,20 @@ private EmploiDuTempsProxy() {
3435
actualiser();
3536
}
3637

38+
/**
39+
* Permet d'actualiser l'emploi du temps avec celui de l'ent.
40+
*/
41+
@SuppressWarnings("deprecation")
42+
@Override
43+
public void actualiser() {
44+
cacheDate = new HashMap<>();
45+
cacheProfesseur = new IdentityHashMap<>();
46+
cacheGroupe = new EnumMap<>(Groupe.class);
47+
cacheDateGroupe = new HashMap<>();
48+
cachePlanningFiltreur = new HashMap<>();
49+
emploiDuTemps.actualiser();
50+
}
51+
3752
/**
3853
* @return l'instance de {@link EmploiDuTempsProxy}.
3954
*
@@ -124,16 +139,20 @@ public Planning getPlanningOf(Professeur... professeurs) {
124139
}
125140

126141
/**
127-
* Permet d'actualiser l'emploi du temps avec celui de l'ent.
142+
* Permet d'obtenir le planning correspondant au {@link PlanningFiltreur}
143+
*
144+
* @param planningFiltreur filtrant le planning
145+
* @return planning correspondant au filtre
146+
* @since 1.4.0
147+
*
148+
* @see PlanningFiltreur
149+
* @see Planning
128150
*/
129151
@SuppressWarnings("deprecation")
130152
@Override
131-
public void actualiser() {
132-
cacheDate = new HashMap<>();
133-
cacheProfesseur = new IdentityHashMap<>();
134-
cacheGroupe = new EnumMap<>(Groupe.class);
135-
cacheDateGroupe = new HashMap<>();
136-
emploiDuTemps.actualiser();
153+
public Planning getPlanningOf(PlanningFiltreur planningFiltreur) {
154+
return cachePlanningFiltreur.computeIfAbsent(planningFiltreur,
155+
k -> emploiDuTemps.getPlanningOf(planningFiltreur));
137156
}
138157

139158
/**

0 commit comments

Comments
 (0)