Rev 14 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 9 | chris | 1 | package com.gebauz.ZhuyinQuiz; |
| 2 | |||
| 3 | public class ZhuyinTable |
||
| 4 | { |
||
| 5 | private static final int NUM_COLUMNS = 3; |
||
| 17 | chris | 6 | static private String[] mPool = { |
| 7 | "\u3105", "b", "", // 0 |
||
| 8 | "\u3106", "p", "", // 1 |
||
| 9 | "\u3107", "m", "", // 2 |
||
| 10 | "\u3108", "f", "", // 3 |
||
| 11 | "\u3109", "d", "", // 4 |
||
| 12 | "\u310A", "t", "", // 5 |
||
| 13 | "\u310B", "n", "", // 6 |
||
| 14 | "\u310C", "l", "", // 7 |
||
| 15 | "\u310D", "g", "", // 8 |
||
| 16 | "\u310E", "k", "", // 9 |
||
| 17 | "\u310F", "h", "", // 10 |
||
| 18 | "\u3110", "j", "", // 11 |
||
| 19 | "\u3111", "q", "", // 12 |
||
| 20 | "\u3112", "x", "", // 13 |
||
| 9 | chris | 21 | |
| 17 | chris | 22 | "\u3113", "zhi", "[zh]", // 14 |
| 23 | "\u3114", "chi", "[ch]", // 15 |
||
| 24 | "\u3115", "shi", "[sh]", // 16 |
||
| 25 | "\u3116", "ri", "[r]", // 17 |
||
| 26 | "\u3117", "zi", "[z]", // 18 |
||
| 27 | "\u3118", "ci", "[c]", // 19 |
||
| 28 | "\u3119", "si", "[s]", // 20 |
||
| 9 | chris | 29 | |
| 17 | chris | 30 | "\u311A", "a", "", // 21 |
| 31 | "\u311B", "o", "", // 22 |
||
| 32 | "\u311C", "e", "", // 23 |
||
| 33 | "\u311D", "ê", "", // 24 |
||
| 34 | "\u311E", "ai", "", // 25 |
||
| 35 | "\u311F", "ei", "", // 26 |
||
| 36 | "\u3120", "ao", "", // 27 |
||
| 37 | "\u3121", "ou", "", // 28 |
||
| 38 | "\u3122", "an", "", // 29 |
||
| 39 | "\u3123", "en", "", // 30 |
||
| 40 | "\u3124", "ang", "", // 31 |
||
| 41 | "\u3125", "eng", "", // 32 |
||
| 42 | "\u3126", "er", "", // 33 |
||
| 9 | chris | 43 | |
| 17 | chris | 44 | "\u3127", "yi", "[i]", // 34 |
| 45 | "\u3127 \u3123", "yin", "[in]", // 35 |
||
| 46 | "\u3127 \u3125", "ying", "[ing]", // 36 |
||
| 9 | chris | 47 | |
| 17 | chris | 48 | "\u3128", "wu", "[u]", // 37 |
| 49 | "\u3128 \u3123", "wen", "[un]", // 38 |
||
| 50 | "\u3128 \u3125", "weng", "[ong]", // 39 |
||
| 9 | chris | 51 | |
| 17 | chris | 52 | "\u3129", "yu", "[u, ü]", // 40 |
| 53 | "\u3129 \u3123", "yun", "[un]", // 41 |
||
| 54 | "\u3129 \u3125", "yong", "[iong]", // 42 |
||
| 9 | chris | 55 | }; |
| 56 | |||
| 17 | chris | 57 | private int[] mTable = null; |
| 58 | |||
| 59 | public ZhuyinTable(int quizCharacters) |
||
| 9 | chris | 60 | { |
| 17 | chris | 61 | int lowerLimit = Constants.QUIZ_LIMITS[quizCharacters * 2]; |
| 62 | int upperLimit = Constants.QUIZ_LIMITS[quizCharacters * 2 + 1]; |
||
| 63 | int size = upperLimit - lowerLimit + 1; |
||
| 64 | |||
| 65 | int j = 0; |
||
| 66 | mTable = new int[size]; |
||
| 67 | for (int i = lowerLimit; i < (upperLimit + 1); i++) |
||
| 68 | { |
||
| 69 | mTable[j] = i; |
||
| 70 | j++; |
||
| 71 | } |
||
| 9 | chris | 72 | } |
| 73 | |||
| 74 | public String getExtraPronounciation(int index) |
||
| 75 | { |
||
| 76 | if (index >= getCount()) |
||
| 77 | index = getCount() - 1; |
||
| 78 | |||
| 17 | chris | 79 | return (mPool[mTable[index] * NUM_COLUMNS + 2]); |
| 9 | chris | 80 | } |
| 81 | |||
| 82 | public String getPinyin(int index) |
||
| 83 | { |
||
| 84 | if (index >= getCount()) |
||
| 85 | index = getCount() - 1; |
||
| 86 | |||
| 17 | chris | 87 | return (mPool[mTable[index] * NUM_COLUMNS + 1]); |
| 9 | chris | 88 | } |
| 89 | |||
| 90 | public String getZhuyin(int index) |
||
| 91 | { |
||
| 92 | if (index >= getCount()) |
||
| 93 | index = getCount() - 1; |
||
| 94 | |||
| 17 | chris | 95 | return (mPool[mTable[index] * NUM_COLUMNS]); |
| 9 | chris | 96 | } |
| 97 | |||
| 98 | public final int getCount() |
||
| 99 | { |
||
| 17 | chris | 100 | return (mTable.length); |
| 9 | chris | 101 | } |
| 102 | |||
| 103 | } |
||
| 104 |