Add skeleton classes for gesture

Change-Id: I6ada110a934b0dafc57d0dcd87723275fa733548
diff --git a/native/jni/src/dictionary.cpp b/native/jni/src/dictionary.cpp
index 83bb267..e0b7f87 100644
--- a/native/jni/src/dictionary.cpp
+++ b/native/jni/src/dictionary.cpp
@@ -43,6 +43,8 @@
     mUnigramDictionary = new UnigramDictionary(mDict + headerSize, typedLetterMultiplier,
             fullWordMultiplier, maxWordLength, maxWords, options);
     mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength);
+    mGestureDecoder = new GestureDecoder(maxWordLength, maxWords);
+    mGestureDecoder->setDict(mUnigramDictionary, mBigramDictionary);
 }
 
 Dictionary::~Dictionary() {
diff --git a/native/jni/src/dictionary.h b/native/jni/src/dictionary.h
index 76b25e5..708cb09 100644
--- a/native/jni/src/dictionary.h
+++ b/native/jni/src/dictionary.h
@@ -22,6 +22,7 @@
 #include "bigram_dictionary.h"
 #include "char_utils.h"
 #include "defines.h"
+#include "gesture/gesture_decoder.h"
 #include "proximity_info.h"
 #include "unigram_dictionary.h"
 #include "words_priority_queue_pool.h"
@@ -39,13 +40,20 @@
             bool useFullEditDistance, unsigned short *outWords,
             int *frequencies, int *spaceIndices) {
         int result = 0;
-        std::map<int, int> bigramMap;
-        uint8_t bigramFilter[BIGRAM_FILTER_BYTE_SIZE];
-        mBigramDictionary->fillBigramAddressToFrequencyMapAndFilter(prevWordChars,
-                prevWordLength, &bigramMap, bigramFilter);
-        result = mUnigramDictionary->getSuggestions(proximityInfo, xcoordinates,
-                ycoordinates, codes, codesSize, &bigramMap, bigramFilter,
-                useFullEditDistance, outWords, frequencies);
+        if (isGesture) {
+            mGestureDecoder->setPrevWord(prevWordChars, prevWordLength);
+            result = mGestureDecoder->getSuggestions(proximityInfo, xcoordinates, ycoordinates,
+                    times, pointerIds, codes, codesSize, commitPoint, dicTypeId == 1 /* main */,
+                    outWords, frequencies, spaceIndices);
+        } else {
+            std::map<int, int> bigramMap;
+            uint8_t bigramFilter[BIGRAM_FILTER_BYTE_SIZE];
+            mBigramDictionary->fillBigramAddressToFrequencyMapAndFilter(prevWordChars,
+                    prevWordLength, &bigramMap, bigramFilter);
+            result = mUnigramDictionary->getSuggestions(proximityInfo, xcoordinates,
+                    ycoordinates, codes, codesSize, &bigramMap, bigramFilter,
+                    useFullEditDistance, outWords, frequencies);
+        }
         return result;
     }
 
@@ -79,6 +87,7 @@
 
     const UnigramDictionary *mUnigramDictionary;
     const BigramDictionary *mBigramDictionary;
+    GestureDecoder *mGestureDecoder;
 };
 
 // public static utility methods
diff --git a/native/jni/src/gesture/build_check.cpp b/native/jni/src/gesture/build_check.cpp
new file mode 100644
index 0000000..8ec94f5
--- /dev/null
+++ b/native/jni/src/gesture/build_check.cpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "gesture_decoder.h"
+
+namespace latinime {
+};
+// namespace latinime
diff --git a/native/jni/src/gesture/gesture_decoder.h b/native/jni/src/gesture/gesture_decoder.h
new file mode 100644
index 0000000..8e79555
--- /dev/null
+++ b/native/jni/src/gesture/gesture_decoder.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LATINIME_GESTURE_DECODER_H
+#define LATINIME_GESTURE_DECODER_H
+
+#include "defines.h"
+#include "gesture_decoder_impl.h"
+
+namespace latinime {
+
+class GestureDecoder : public GestureDecoderImpl {
+
+ public:
+    GestureDecoder(int maxWordLength, int maxWords) :
+            GestureDecoderImpl(maxWordLength, maxWords) {
+    }
+
+ private:
+    DISALLOW_IMPLICIT_CONSTRUCTORS(GestureDecoder);
+};
+} // namespace latinime
+
+#endif // LATINIME_INCREMENTAL_DECODER_H
diff --git a/native/jni/src/gesture/gesture_decoder_impl.h b/native/jni/src/gesture/gesture_decoder_impl.h
new file mode 100644
index 0000000..be4e8b3
--- /dev/null
+++ b/native/jni/src/gesture/gesture_decoder_impl.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LATINIME_GESTURE_DECODER_IMPL_H
+#define LATINIME_GESTURE_DECODER_IMPL_H
+
+#include "defines.h"
+#include "incremental_decoder.h"
+
+namespace latinime {
+
+class GestureDecoderImpl : public IncrementalDecoder {
+
+ public:
+    GestureDecoderImpl(int maxWordLength, int maxWords) :
+            IncrementalDecoder(maxWordLength, maxWords) {
+    }
+
+    int getSuggestions(ProximityInfo *pInfo, int *inputXs, int *inputYs, int *times,
+            int *pointerIds, int *codes, int inputSize, int commitPoint, bool isMainDict,
+            unsigned short *outWords, int *frequencies, int *outputIndices) {
+        return 0;
+    }
+
+ private:
+    DISALLOW_IMPLICIT_CONSTRUCTORS(GestureDecoderImpl);
+};
+} // namespace latinime
+
+#endif // LATINIME_GESTURE_DECODER_IMPL_H
diff --git a/native/jni/src/gesture/incremental_decoder.h b/native/jni/src/gesture/incremental_decoder.h
new file mode 100644
index 0000000..fe93552
--- /dev/null
+++ b/native/jni/src/gesture/incremental_decoder.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LATINIME_INCREMENTAL_DECODER_H
+#define LATINIME_INCREMENTAL_DECODER_H
+
+#include "defines.h"
+#include "incremental_decoder_impl.h"
+
+namespace latinime {
+
+class IncrementalDecoder : public IncrementalDecoderImpl {
+
+ public:
+     IncrementalDecoder(int maxWordLength, int maxWords) :
+             IncrementalDecoderImpl(maxWordLength, maxWords) {
+     }
+
+ private:
+     DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalDecoder);
+};
+} // namespace latinime
+
+#endif // LATINIME_INCREMENTAL_DECODER_H
diff --git a/native/jni/src/gesture/incremental_decoder_impl.h b/native/jni/src/gesture/incremental_decoder_impl.h
new file mode 100644
index 0000000..5731ad8
--- /dev/null
+++ b/native/jni/src/gesture/incremental_decoder_impl.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LATINIME_INCREMENTAL_DECODER_IMPL_H
+#define LATINIME_INCREMENTAL_DECODER_IMPL_H
+
+#include "bigram_dictionary.h"
+#include "defines.h"
+#include "incremental_decoder_interface.h"
+#include "unigram_dictionary.h"
+
+namespace latinime {
+
+class IncrementalDecoderImpl : IncrementalDecoderInterface {
+
+ public:
+     IncrementalDecoderImpl(int maxWordLength, int maxWords) { };
+     void setDict(const UnigramDictionary *dict, const BigramDictionary *bigram) { };
+     void setPrevWord(const int32_t *prevWord, int prevWordLength) { };
+     void reset() { };
+
+ private:
+     DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalDecoderImpl);
+};
+} // namespace latinime
+
+#endif // LATINIME_INCREMENTAL_DECODER_IMPL_H
diff --git a/native/jni/src/gesture/incremental_decoder_interface.h b/native/jni/src/gesture/incremental_decoder_interface.h
new file mode 100644
index 0000000..d34b0da
--- /dev/null
+++ b/native/jni/src/gesture/incremental_decoder_interface.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LATINIME_INCREMENTAL_DECODER_INTERFACE_H
+#define LATINIME_INCREMENTAL_DECODER_INTERFACE_H
+
+#include "bigram_dictionary.h"
+#include "defines.h"
+#include "proximity_info.h"
+#include "unigram_dictionary.h"
+
+namespace latinime {
+
+class IncrementalDecoderInterface {
+
+ public:
+    virtual int getSuggestions(ProximityInfo *pInfo, int *inputXs, int *inputYs, int *times,
+            int *pointerIds, int *codes, int inputSize, int commitPoint, bool isMainDict,
+            unsigned short *outWords, int *frequencies, int *outputIndices) = 0;
+    virtual void reset() = 0;
+    virtual void setDict(const UnigramDictionary *dict, const BigramDictionary *bigram) = 0;
+    virtual void setPrevWord(const int32_t *prevWord, int prevWordLength) = 0;
+    virtual ~IncrementalDecoderInterface() { };
+};
+} // namespace latinime
+
+#endif // LATINIME_INCREMENTAL_DECODER_INTERFACE_H