Subversion Repositories AndroidProjects

Rev

Rev 14 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.gebauz.ZhuyinQuiz;

public class ZhuyinTable
{
        private static final int NUM_COLUMNS = 3;
        static private String[] mPool = {
                "\u3105", "b", "",                      // 0
                "\u3106", "p", "",                      // 1
                "\u3107", "m", "",                      // 2
                "\u3108", "f", "",                      // 3
                "\u3109", "d", "",                      // 4
                "\u310A", "t", "",                      // 5
                "\u310B", "n", "",                      // 6
                "\u310C", "l", "",                      // 7
                "\u310D", "g", "",                      // 8
                "\u310E", "k", "",                      // 9
                "\u310F", "h", "",                      // 10
                "\u3110", "j", "",                      // 11
                "\u3111", "q", "",                      // 12
                "\u3112", "x", "",                      // 13
               
                "\u3113", "zhi", "[zh]",        // 14
                "\u3114", "chi", "[ch]",        // 15
                "\u3115", "shi", "[sh]",        // 16
                "\u3116", "ri", "[r]",          // 17
                "\u3117", "zi", "[z]",          // 18
                "\u3118", "ci", "[c]",          // 19
                "\u3119", "si", "[s]",          // 20

                "\u311A", "a", "",                      // 21
                "\u311B", "o", "",                      // 22
                "\u311C", "e", "",                      // 23
                "\u311D", "ê", "",                      // 24
                "\u311E", "ai", "",                     // 25
                "\u311F", "ei", "",                     // 26
                "\u3120", "ao", "",                     // 27
                "\u3121", "ou", "",                     // 28
                "\u3122", "an", "",                     // 29
                "\u3123", "en", "",                     // 30
                "\u3124", "ang", "",            // 31
                "\u3125", "eng", "",            // 32
                "\u3126", "er", "",                     // 33
               
                "\u3127", "yi", "[i]",                          // 34
                "\u3127 \u3123", "yin", "[in]",         // 35
                "\u3127 \u3125", "ying", "[ing]",       // 36
               
                "\u3128", "wu", "[u]",                          // 37
                "\u3128 \u3123", "wen", "[un]",         // 38
                "\u3128 \u3125", "weng", "[ong]",       // 39
               
                "\u3129", "yu", "[u, ü]",                       // 40
                "\u3129 \u3123", "yun", "[un]",         // 41
                "\u3129 \u3125", "yong", "[iong]",      // 42
        };
       
        private int[] mTable = null;
       
        public ZhuyinTable(int quizCharacters)
        {
                int lowerLimit = Constants.QUIZ_LIMITS[quizCharacters * 2];
                int upperLimit = Constants.QUIZ_LIMITS[quizCharacters * 2 + 1];
                int size = upperLimit - lowerLimit + 1;
               
                int j = 0;
                mTable = new int[size];
                for (int i = lowerLimit; i < (upperLimit + 1); i++)
                {
                        mTable[j] = i;
                        j++;
                }
        }
       
        public String getExtraPronounciation(int index)
        {
                if (index >= getCount())
                        index = getCount() - 1;
               
                return (mPool[mTable[index] * NUM_COLUMNS + 2]);
        }
       
        public String getPinyin(int index)
        {
                if (index >= getCount())
                        index = getCount() - 1;
               
                return (mPool[mTable[index] * NUM_COLUMNS + 1]);
        }
       
        public String getZhuyin(int index)
        {
                if (index >= getCount())
                        index = getCount() - 1;
               
                return (mPool[mTable[index] * NUM_COLUMNS]);
        }
       
        public final int getCount()
        {
                return (mTable.length);
        }
       
}