summaryrefslogtreecommitdiff
path: root/src/runtime/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/java/org')
-rw-r--r--src/runtime/java/org/grammaticalframework/pgf/Expr.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/runtime/java/org/grammaticalframework/pgf/Expr.java b/src/runtime/java/org/grammaticalframework/pgf/Expr.java
index 6541db140..2c6882203 100644
--- a/src/runtime/java/org/grammaticalframework/pgf/Expr.java
+++ b/src/runtime/java/org/grammaticalframework/pgf/Expr.java
@@ -31,6 +31,20 @@ public class Expr implements Serializable {
this.ref = initStringLit(s, pool.ref);
}
+ /** Constructs an expression which represents an integer literal */
+ public Expr(int d) {
+ this.pool = new Pool();
+ this.master = null;
+ this.ref = initIntLit(d, pool.ref);
+ }
+
+ /** Constructs an expression which represents a floating point literal */
+ public Expr(double f) {
+ this.pool = new Pool();
+ this.master = null;
+ this.ref = initFloatLit(f, pool.ref);
+ }
+
/** Constructs an expression which is a function application
* @param fun The name of the top-level function.
* @param args the arguments for the function.
@@ -85,6 +99,8 @@ public class Expr implements Serializable {
private static native String showExpr(long ref);
private static native long initStringLit(String s, long pool);
+ private static native long initIntLit(int d, long pool);
+ private static native long initFloatLit(double f, long pool);
private static native long initApp(Expr fun, Expr[] args, long pool);
private static native long initApp(String fun, Expr[] args, long pool);