projet-genie-logiciel-systeme/enigme.java/Connaissance.java

27 lines
621 B
Java
Raw Normal View History

2021-12-01 19:55:46 +00:00
import java.util.List;
2021-11-30 19:49:01 +00:00
public class Connaissance {
String nom;
Condition visible;
2021-12-01 19:55:46 +00:00
List<Description> descriptions;
2021-11-30 19:49:01 +00:00
2021-12-01 19:55:46 +00:00
public Connaissance(
2021-11-30 19:49:01 +00:00
String nom,
2021-12-01 07:58:07 +00:00
Condition visible,
2021-12-01 19:55:46 +00:00
List<Description> descriptions) {
2021-11-30 19:49:01 +00:00
this.nom = nom;
2021-12-01 07:58:07 +00:00
this.visible = visible;
2021-12-01 19:55:46 +00:00
this.descriptions = descriptions;
}
@Override
public String toString() {
for (Description d : this.descriptions) {
if (d.condition.evaluer()) {
2021-12-02 13:23:06 +00:00
return "(" + this.nom + " : " + d + ")";
2021-12-01 19:55:46 +00:00
}
}
2021-12-02 13:23:06 +00:00
return "(" + this.nom + ")";
2021-11-30 19:49:01 +00:00
}
}