1
0
forked from GitHub/gf-core

added Expr.equals method in the Java binding

This commit is contained in:
krasimir
2015-11-26 15:38:12 +00:00
parent 451ef1183f
commit 008ca97428
2 changed files with 20 additions and 0 deletions

View File

@@ -1054,6 +1054,24 @@ Java_org_grammaticalframework_pgf_Expr_initApp(JNIEnv* env, jclass clazz, jstrin
return expr;
}
JNIEXPORT jboolean JNICALL
Java_org_grammaticalframework_pgf_Expr_equals(JNIEnv* env, jobject self, jobject other)
{
jclass self_class = (*env)->GetObjectClass(env, self);
jclass other_class = (*env)->GetObjectClass(env, other);
if (!(*env)->IsAssignableFrom(env, other_class, self_class))
return JNI_FALSE;
PgfExpr e_self = gu_variant_from_ptr(l2p(get_ref(env, self)));
PgfExpr e_other = gu_variant_from_ptr(l2p(get_ref(env, other)));
if (pgf_expr_eq(e_self, e_other))
return JNI_TRUE;
else
return JNI_FALSE;
}
JNIEXPORT jstring JNICALL
Java_org_grammaticalframework_pgf_Type_getCategory(JNIEnv* env, jobject self)
{

View File

@@ -37,6 +37,8 @@ public class Expr implements Serializable {
public static native Expr readExpr(String s) throws PGFError;
public native boolean equals(Expr e);
private static native String showExpr(long ref);
private static native long initStringLit(String s, long pool);