projet-genie-logiciel-systeme/enigme.java/Connaissance.java
2021-12-02 14:23:06 +01:00

27 lines
621 B
Java

import java.util.List;
public class Connaissance {
String nom;
Condition visible;
List<Description> descriptions;
public Connaissance(
String nom,
Condition visible,
List<Description> descriptions) {
this.nom = nom;
this.visible = visible;
this.descriptions = descriptions;
}
@Override
public String toString() {
for (Description d : this.descriptions) {
if (d.condition.evaluer()) {
return "(" + this.nom + " : " + d + ")";
}
}
return "(" + this.nom + ")";
}
}