forked from GitHub/gf-core
added the Expr.unMeta method in the Java binding
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user