Gwendal in main : add test on futur constraints and enhance input symbol method (#1)

Co-authored-by: ROGER <gwendal.roger@etu.univ-lyon1.fr>
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2025-01-04 15:56:23 +00:00
parent 0c03f07345
commit 22e88a899f
9 changed files with 366 additions and 147 deletions

View File

@@ -20,6 +20,19 @@ public class Symbole {
return new Symbole(String.valueOf(c));
}
public boolean isInt() {
try {
Integer.parseInt(valeur);
return true;
} catch (NumberFormatException e) {
return false;
}
}
public boolean isLetter() {
return valeur.length() == 1 && Character.isLetter(valeur.charAt(0));
}
@Override
public String toString() {
return valeur;
@@ -27,8 +40,11 @@ public class Symbole {
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
Symbole symbole = (Symbole) obj;
return valeur.equals(symbole.valeur);
}