Selaa lähdekoodia

Ajout méthode pour recup BigInteger

Arthur Brandao 6 vuotta sitten
vanhempi
sitoutus
0e420c974f
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  1. 7 0
      src/migl/lisp/LispElement.java

+ 7 - 0
src/migl/lisp/LispElement.java

@@ -31,6 +31,13 @@ public class LispElement<E> {
 		cache.put(val, this);
 	}
 	
+	public BigInteger getInt() {
+		if(this.value.getClass() == BigInteger.class) {
+			return (BigInteger) this.value;
+		}
+		throw new IllegalStateException("Value is not an integer");
+	}
+	
 	/**
 	 * Retourne la valeur d'un element sous forme de nombre
 	 *