Преглед на файлове

Ajout méthode pour recup BigInteger

Arthur Brandao преди 6 години
родител
ревизия
0e420c974f
променени са 1 файла, в които са добавени 7 реда и са изтрити 0 реда
  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
 	 *