mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
added Expr.equals method in the Java binding
This commit is contained in:
@@ -1054,6 +1054,24 @@ Java_org_grammaticalframework_pgf_Expr_initApp(JNIEnv* env, jclass clazz, jstrin
|
|||||||
return expr;
|
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
|
JNIEXPORT jstring JNICALL
|
||||||
Java_org_grammaticalframework_pgf_Type_getCategory(JNIEnv* env, jobject self)
|
Java_org_grammaticalframework_pgf_Type_getCategory(JNIEnv* env, jobject self)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ public class Expr implements Serializable {
|
|||||||
|
|
||||||
public static native Expr readExpr(String s) throws PGFError;
|
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 String showExpr(long ref);
|
||||||
|
|
||||||
private static native long initStringLit(String s, long pool);
|
private static native long initStringLit(String s, long pool);
|
||||||
|
|||||||
Reference in New Issue
Block a user