mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
add dict_iter_getCounts()
This commit is contained in:
parent
21330af568
commit
b86330c71f
2 changed files with 22 additions and 0 deletions
|
@ -1400,6 +1400,26 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1wordCount
|
|||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jintArray JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getCounts
|
||||
(JNIEnv* env, jclass C, jint closure )
|
||||
{
|
||||
jintArray result = NULL;
|
||||
DictIterData* data = (DictIterData*)closure;
|
||||
if ( NULL != data ) {
|
||||
DictIter iter;
|
||||
dict_initIter( &iter, data->dict, 0, MAX_COLS_DICT );
|
||||
|
||||
LengthsArray lens;
|
||||
if ( 0 < dict_countWords( &iter, &lens ) ) {
|
||||
XP_ASSERT( sizeof(jint) == sizeof(lens.lens[0]) );
|
||||
result = makeIntArray( env, VSIZE(lens.lens), (jint*)&lens.lens );
|
||||
(*env)->DeleteLocalRef( env, result );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getPrefixes
|
||||
( JNIEnv* env, jclass C, jint closure )
|
||||
|
|
|
@ -237,12 +237,14 @@ public class XwJNI {
|
|||
public static native int dict_getTileValue( int dictPtr, int tile );
|
||||
|
||||
// Dict iterator
|
||||
public final static int MAX_COLS_DICT = 15; // from dictiter.h
|
||||
public static native int dict_iter_init( byte[] dict, String path,
|
||||
JNIUtils jniu );
|
||||
public static native void dict_iter_setMinMax( int closure,
|
||||
int min, int max );
|
||||
public static native void dict_iter_destroy( int closure );
|
||||
public static native int dict_iter_wordCount( int closure );
|
||||
public static native int[] dict_iter_getCounts( int closure );
|
||||
public static native String dict_iter_nthWord( int closure, int nn );
|
||||
public static native String[] dict_iter_getPrefixes( int closure );
|
||||
public static native int[] dict_iter_getIndices( int closure );
|
||||
|
|
Loading…
Reference in a new issue