1
0
forked from GitHub/gf-core

added the Expr.unMeta method in the Java binding

This commit is contained in:
Krasimir Angelov
2017-07-07 11:21:34 +02:00
parent 1b0a0013ae
commit 47a4218d21
2 changed files with 18 additions and 0 deletions

View File

@@ -1399,6 +1399,19 @@ Java_org_grammaticalframework_pgf_Expr_unApply(JNIEnv* env, jobject self)
return japp;
}
JNIEXPORT jint JNICALL
Java_org_grammaticalframework_pgf_Expr_unMeta(JNIEnv* env, jobject self)
{
PgfExpr expr = gu_variant_from_ptr(get_ref(env, self));
PgfExprMeta* pmeta = pgf_expr_unmeta(expr);
if (pmeta != NULL) {
return pmeta->id;
}
return -1;
}
JNIEXPORT jboolean JNICALL
Java_org_grammaticalframework_pgf_Expr_equals(JNIEnv* env, jobject self, jobject other)
{

View File

@@ -89,6 +89,11 @@ public class Expr implements Serializable {
* an application then the result is null. */
public native ExprApplication unApply();
/** If the method is called on an expression which is
* a meta variable, then it will return the variable's id.
* If this is not a meta variable then the result is -1. */
public native int unMeta();
/** Returns the expression as a string in the GF syntax */
public String toString() {
return showExpr(ref);