am d6fdd58c: Cleanup DicTraverseSession.
* commit 'd6fdd58cc0dcdd1e1b1018de10a30e423494a8fd': Cleanup DicTraverseSession.main
commit
5932f02013
|
@ -190,7 +190,9 @@ static void latinime_BinaryDictionary_getSuggestions(JNIEnv *env, jclass clazz,
|
||||||
ProximityInfo *pInfo = reinterpret_cast<ProximityInfo *>(proximityInfo);
|
ProximityInfo *pInfo = reinterpret_cast<ProximityInfo *>(proximityInfo);
|
||||||
DicTraverseSession *traverseSession =
|
DicTraverseSession *traverseSession =
|
||||||
reinterpret_cast<DicTraverseSession *>(dicTraverseSession);
|
reinterpret_cast<DicTraverseSession *>(dicTraverseSession);
|
||||||
|
if (!traverseSession) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Input values
|
// Input values
|
||||||
int xCoordinates[inputSize];
|
int xCoordinates[inputSize];
|
||||||
int yCoordinates[inputSize];
|
int yCoordinates[inputSize];
|
||||||
|
|
|
@ -34,16 +34,17 @@ static jlong latinime_setDicTraverseSession(JNIEnv *env, jclass clazz, jstring l
|
||||||
static void latinime_initDicTraverseSession(JNIEnv *env, jclass clazz, jlong traverseSession,
|
static void latinime_initDicTraverseSession(JNIEnv *env, jclass clazz, jlong traverseSession,
|
||||||
jlong dictionary, jintArray previousWord, jint previousWordLength) {
|
jlong dictionary, jintArray previousWord, jint previousWordLength) {
|
||||||
DicTraverseSession *ts = reinterpret_cast<DicTraverseSession *>(traverseSession);
|
DicTraverseSession *ts = reinterpret_cast<DicTraverseSession *>(traverseSession);
|
||||||
|
if (!ts) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Dictionary *dict = reinterpret_cast<Dictionary *>(dictionary);
|
Dictionary *dict = reinterpret_cast<Dictionary *>(dictionary);
|
||||||
if (!previousWord) {
|
if (!previousWord) {
|
||||||
DicTraverseSession::initSessionInstance(
|
ts->init(dict, 0 /* prevWord */, 0 /* prevWordLength*/, 0 /* suggestOptions */);
|
||||||
ts, dict, 0 /* prevWord */, 0 /* prevWordLength*/, 0 /* suggestOptions */);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int prevWord[previousWordLength];
|
int prevWord[previousWordLength];
|
||||||
env->GetIntArrayRegion(previousWord, 0, previousWordLength, prevWord);
|
env->GetIntArrayRegion(previousWord, 0, previousWordLength, prevWord);
|
||||||
DicTraverseSession::initSessionInstance(
|
ts->init(dict, prevWord, previousWordLength, 0 /* suggestOptions */);
|
||||||
ts, dict, prevWord, previousWordLength, 0 /* suggestOptions */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void latinime_releaseDicTraverseSession(JNIEnv *env, jclass clazz, jlong traverseSession) {
|
static void latinime_releaseDicTraverseSession(JNIEnv *env, jclass clazz, jlong traverseSession) {
|
||||||
|
|
|
@ -48,8 +48,7 @@ void Dictionary::getSuggestions(ProximityInfo *proximityInfo, DicTraverseSession
|
||||||
const SuggestOptions *const suggestOptions, const float languageWeight,
|
const SuggestOptions *const suggestOptions, const float languageWeight,
|
||||||
SuggestionResults *const outSuggestionResults) const {
|
SuggestionResults *const outSuggestionResults) const {
|
||||||
TimeKeeper::setCurrentTime();
|
TimeKeeper::setCurrentTime();
|
||||||
DicTraverseSession::initSessionInstance(
|
traverseSession->init(this, prevWordCodePoints, prevWordLength, suggestOptions);
|
||||||
traverseSession, this, prevWordCodePoints, prevWordLength, suggestOptions);
|
|
||||||
const auto &suggest = suggestOptions->isGesture() ? mGestureSuggest : mTypingSuggest;
|
const auto &suggest = suggestOptions->isGesture() ? mGestureSuggest : mTypingSuggest;
|
||||||
suggest->getSuggestions(proximityInfo, traverseSession, xcoordinates,
|
suggest->getSuggestions(proximityInfo, traverseSession, xcoordinates,
|
||||||
ycoordinates, times, pointerIds, inputCodePoints, inputSize,
|
ycoordinates, times, pointerIds, inputCodePoints, inputSize,
|
||||||
|
|
|
@ -44,15 +44,6 @@ class DicTraverseSession {
|
||||||
dictSize >= DICTIONARY_SIZE_THRESHOLD_TO_USE_LARGE_CACHE_FOR_SUGGESTION);
|
dictSize >= DICTIONARY_SIZE_THRESHOLD_TO_USE_LARGE_CACHE_FOR_SUGGESTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static AK_FORCE_INLINE void initSessionInstance(DicTraverseSession *traverseSession,
|
|
||||||
const Dictionary *const dictionary, const int *prevWord, const int prevWordLength,
|
|
||||||
const SuggestOptions *const suggestOptions) {
|
|
||||||
if (traverseSession) {
|
|
||||||
DicTraverseSession *tSession = static_cast<DicTraverseSession *>(traverseSession);
|
|
||||||
tSession->init(dictionary, prevWord, prevWordLength, suggestOptions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static AK_FORCE_INLINE void releaseSessionInstance(DicTraverseSession *traverseSession) {
|
static AK_FORCE_INLINE void releaseSessionInstance(DicTraverseSession *traverseSession) {
|
||||||
delete traverseSession;
|
delete traverseSession;
|
||||||
}
|
}
|
||||||
|
@ -86,8 +77,6 @@ class DicTraverseSession {
|
||||||
const ProximityInfo *getProximityInfo() const { return mProximityInfo; }
|
const ProximityInfo *getProximityInfo() const { return mProximityInfo; }
|
||||||
const SuggestOptions *getSuggestOptions() const { return mSuggestOptions; }
|
const SuggestOptions *getSuggestOptions() const { return mSuggestOptions; }
|
||||||
int getPrevWordPtNodePos() const { return mPrevWordPtNodePos; }
|
int getPrevWordPtNodePos() const { return mPrevWordPtNodePos; }
|
||||||
// TODO: REMOVE
|
|
||||||
void setPrevWordPtNodePos(const int ptNodePos) { mPrevWordPtNodePos = ptNodePos; }
|
|
||||||
DicNodesCache *getDicTraverseCache() { return &mDicNodesCache; }
|
DicNodesCache *getDicTraverseCache() { return &mDicNodesCache; }
|
||||||
MultiBigramMap *getMultiBigramMap() { return &mMultiBigramMap; }
|
MultiBigramMap *getMultiBigramMap() { return &mMultiBigramMap; }
|
||||||
const ProximityInfoState *getProximityInfoState(int id) const {
|
const ProximityInfoState *getProximityInfoState(int id) const {
|
||||||
|
|
Loading…
Reference in New Issue