am 5c2f55fe: Merge "Add getter methods for public member variables."

* commit '5c2f55fe6e5973e15c1e2af9eb57ced6e85740b4':
  Add getter methods for public member variables.
main
Keisuke Kuroyanagi 2014-03-10 04:41:55 -07:00 committed by Android Git Automerger
commit 35b2271072
4 changed files with 14 additions and 10 deletions

View File

@ -36,7 +36,7 @@
#define DUMP_WORD_AND_SCORE(header) \ #define DUMP_WORD_AND_SCORE(header) \
do { char charBuf[50]; char prevWordCharBuf[50]; \ do { char charBuf[50]; char prevWordCharBuf[50]; \
INTS_TO_CHARS(getOutputWordBuf(), getNodeCodePointCount(), charBuf, NELEMS(charBuf)); \ INTS_TO_CHARS(getOutputWordBuf(), getNodeCodePointCount(), charBuf, NELEMS(charBuf)); \
INTS_TO_CHARS(mDicNodeState.mDicNodeStatePrevWord.mPrevWord, \ INTS_TO_CHARS(mDicNodeState.mDicNodeStatePrevWord.getPrevWordBuf(), \
mDicNodeState.mDicNodeStatePrevWord.getPrevWordLength(), prevWordCharBuf, \ mDicNodeState.mDicNodeStatePrevWord.getPrevWordLength(), prevWordCharBuf, \
NELEMS(prevWordCharBuf)); \ NELEMS(prevWordCharBuf)); \
AKLOGI("#%8s, %5f, %5f, %5f, %5f, %s, %s, %d, %5f,", header, \ AKLOGI("#%8s, %5f, %5f, %5f, %5f, %s, %s, %d, %5f,", header, \
@ -313,7 +313,7 @@ class DicNode {
void outputResult(int *dest) const { void outputResult(int *dest) const {
const uint16_t prevWordLength = mDicNodeState.mDicNodeStatePrevWord.getPrevWordLength(); const uint16_t prevWordLength = mDicNodeState.mDicNodeStatePrevWord.getPrevWordLength();
const uint16_t currentDepth = getNodeCodePointCount(); const uint16_t currentDepth = getNodeCodePointCount();
DicNodeUtils::appendTwoWords(mDicNodeState.mDicNodeStatePrevWord.mPrevWord, DicNodeUtils::appendTwoWords(mDicNodeState.mDicNodeStatePrevWord.getPrevWordBuf(),
prevWordLength, getOutputWordBuf(), currentDepth, dest); prevWordLength, getOutputWordBuf(), currentDepth, dest);
DUMP_WORD_AND_SCORE("OUTPUT"); DUMP_WORD_AND_SCORE("OUTPUT");
} }
@ -324,7 +324,7 @@ class DicNode {
// are concatenated together in mPrevWord - which contains a space at the end. // are concatenated together in mPrevWord - which contains a space at the end.
int getTotalNodeSpaceCount() const { int getTotalNodeSpaceCount() const {
if (isFirstWord()) return 0; if (isFirstWord()) return 0;
return CharUtils::getSpaceCount(mDicNodeState.mDicNodeStatePrevWord.mPrevWord, return CharUtils::getSpaceCount(mDicNodeState.mDicNodeStatePrevWord.getPrevWordBuf(),
mDicNodeState.mDicNodeStatePrevWord.getPrevWordLength()); mDicNodeState.mDicNodeStatePrevWord.getPrevWordLength());
} }
@ -376,7 +376,7 @@ class DicNode {
} }
AK_FORCE_INLINE const int *getOutputWordBuf() const { AK_FORCE_INLINE const int *getOutputWordBuf() const {
return mDicNodeState.mDicNodeStateOutput.mCodePointsBuf; return mDicNodeState.mDicNodeStateOutput.getCodePointBuf();
} }
int getPrevCodePointG(int pointerId) const { int getPrevCodePointG(int pointerId) const {

View File

@ -68,9 +68,9 @@ class DicNodeState {
mDicNodeStatePrevWord.init( mDicNodeStatePrevWord.init(
prevWordDicNodeState->mDicNodeStatePrevWord.getPrevWordCount() + 1, prevWordDicNodeState->mDicNodeStatePrevWord.getPrevWordCount() + 1,
prevWordPos, prevWordPos,
prevWordDicNodeState->mDicNodeStatePrevWord.mPrevWord, prevWordDicNodeState->mDicNodeStatePrevWord.getPrevWordBuf(),
prevWordDicNodeState->mDicNodeStatePrevWord.getPrevWordLength(), prevWordDicNodeState->mDicNodeStatePrevWord.getPrevWordLength(),
prevWordDicNodeState->mDicNodeStateOutput.mCodePointsBuf, prevWordDicNodeState->mDicNodeStateOutput.getCodePointBuf(),
prevWordCodePointCount, prevWordCodePointCount,
prevWordDicNodeState->mDicNodeStatePrevWord.getSecondWordFirstInputIndex(), prevWordDicNodeState->mDicNodeStatePrevWord.getSecondWordFirstInputIndex(),
prevWordDicNodeState->mDicNodeStateInput.getInputIndex(0) /* lastInputIndex */); prevWordDicNodeState->mDicNodeStateInput.getInputIndex(0) /* lastInputIndex */);

View File

@ -66,13 +66,15 @@ class DicNodeStateOutput {
return mCodePointsBuf[index]; return mCodePointsBuf[index];
} }
// TODO: Move to private const int *getCodePointBuf() const {
int mCodePointsBuf[MAX_WORD_LENGTH]; return mCodePointsBuf;
}
private: private:
DISALLOW_COPY_AND_ASSIGN(DicNodeStateOutput); DISALLOW_COPY_AND_ASSIGN(DicNodeStateOutput);
uint16_t mOutputtedCodePointCount; uint16_t mOutputtedCodePointCount;
int mCodePointsBuf[MAX_WORD_LENGTH];
}; };
} // namespace latinime } // namespace latinime
#endif // LATINIME_DIC_NODE_STATE_OUTPUT_H #endif // LATINIME_DIC_NODE_STATE_OUTPUT_H

View File

@ -123,8 +123,9 @@ class DicNodeStatePrevWord {
return true; return true;
} }
// TODO: Move to private const int *getPrevWordBuf() const {
int mPrevWord[MAX_WORD_LENGTH]; return mPrevWord;
}
private: private:
DISALLOW_COPY_AND_ASSIGN(DicNodeStatePrevWord); DISALLOW_COPY_AND_ASSIGN(DicNodeStatePrevWord);
@ -134,6 +135,7 @@ class DicNodeStatePrevWord {
int16_t mPrevWordStart; int16_t mPrevWordStart;
int mPrevWordPtNodePos; int mPrevWordPtNodePos;
int mSecondWordFirstInputIndex; int mSecondWordFirstInputIndex;
int mPrevWord[MAX_WORD_LENGTH];
}; };
} // namespace latinime } // namespace latinime
#endif // LATINIME_DIC_NODE_STATE_PREVWORD_H #endif // LATINIME_DIC_NODE_STATE_PREVWORD_H