projet-genie-logiciel-systeme/runtime-workspace/fr.n7.game.examples/src-gen/Description.java

27 lines
634 B
Java
Raw Normal View History

2022-01-18 18:49:37 +00:00
import java.util.List;
2021-12-09 17:54:08 +00:00
public class Description {
String texte;
Condition condition;
2022-01-18 18:49:37 +00:00
String nom;
2021-12-09 17:54:08 +00:00
public Description(
2022-01-18 18:49:37 +00:00
String nom,
2021-12-09 17:54:08 +00:00
String texte,
Condition condition) {
2022-01-18 18:49:37 +00:00
this.nom = nom;
2021-12-09 17:54:08 +00:00
this.texte = texte;
this.condition = condition;
}
@Override
public String toString() {
return this.texte;
}
2022-01-18 18:49:37 +00:00
public static Description search(List<Description> list, String name) {
return list.stream().filter(o -> o.nom.equals(name)).findFirst()
.orElseThrow(() -> new IllegalArgumentException("No data found"));
}
2021-12-09 17:54:08 +00:00
}