better dictionary visualization in the Android App

This commit is contained in:
kr.angelov
2013-11-27 22:16:05 +00:00
parent eea636966d
commit f5ec987c5d
9 changed files with 1309 additions and 1077 deletions

View File

@@ -212,6 +212,25 @@ Java_org_grammaticalframework_pgf_PGF_getStartCat(JNIEnv* env, jobject self)
return gu2j_string(env, pgf_start_cat(get_ref(env, self)));
}
JNIEXPORT jobject JNICALL
Java_org_grammaticalframework_pgf_PGF_getFunctionType(JNIEnv* env, jobject self, jstring jid)
{
PgfPGF* pgf = get_ref(env, self);
GuPool* tmp_pool = gu_new_pool();
PgfCId id = j2gu_string(env, jid, tmp_pool);
PgfType* tp = pgf_function_type(pgf, id);
gu_pool_free(tmp_pool);
if (tp == NULL)
return NULL;
jclass type_class = (*env)->FindClass(env, "org/grammaticalframework/pgf/Type");
jmethodID constrId = (*env)->GetMethodID(env, type_class, "<init>", "(Lorg/grammaticalframework/pgf/PGF;J)V");
jobject jtype = (*env)->NewObject(env, type_class, constrId, self, p2l(tp));
return jtype;
}
typedef struct {
GuMapItor fn;
JNIEnv *env;
@@ -535,6 +554,13 @@ Java_org_grammaticalframework_pgf_Expr_readExpr(JNIEnv* env, jclass clazz, jstri
return (*env)->NewObject(env, clazz, constrId, jpool, NULL, p2l(gu_variant_to_ptr(e)));
}
JNIEXPORT jstring JNICALL
Java_org_grammaticalframework_pgf_Type_getCategory(JNIEnv* env, jobject self)
{
PgfType* tp = get_ref(env, self);
return gu2j_string(env, tp->cid);
}
JNIEXPORT jobject JNICALL
Java_org_grammaticalframework_pgf_Generator_generateAll(JNIEnv* env, jclass clazz, jobject jpgf, jstring jstartCat)
{

View File

@@ -0,0 +1,7 @@
package org.grammaticalframework.pgf;
public class Hypo {
public native boolean getBindType();
public native String getVariable();
public native Type getType();
}

View File

@@ -1,4 +1,18 @@
package org.grammaticalframework.pgf;
public class Type {
public native String getCategory();
public native Expr[] getExprs();
public native Hypo[] getHypos();
//////////////////////////////////////////////////////////////////
// private stuff
private PGF gr;
private long ref;
private Type(PGF gr, long ref) {
this.gr = gr;
this.ref = ref;
}
}