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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user