92 }
93 }
94
95 // read jgArray[]
96 count=indexes[IX_JG_LIMIT]-indexes[IX_JG_START];
97 jgArray=new byte[count];
98 for(i=0; i<count; ++i) {
99 jgArray[i]=bytes.get();
100 }
101
102 // read jgArray2[]
103 count=indexes[IX_JG_LIMIT2]-indexes[IX_JG_START2];
104 jgArray2=new byte[count];
105 for(i=0; i<count; ++i) {
106 jgArray2[i]=bytes.get();
107 }
108 }
109
110 // implement ICUBinary.Authenticate
111 private static final class IsAcceptable implements ICUBinary.Authenticate {
112 public boolean isDataVersionAcceptable(byte version[]) {
113 return version[0]==2;
114 }
115 }
116
117 // property access functions ------------------------------------------- ***
118
119 public final int getClass(int c) {
120 return getClassFromProps(trie.get(c));
121 }
122
123 private final int getMirror(int c, int props) {
124 int delta=getMirrorDeltaFromProps(props);
125 if(delta!=ESC_MIRROR_DELTA) {
126 return c+delta;
127 } else {
128 /* look for mirror code point in the mirrors[] table */
129 int m;
130 int i, length;
131 int c2;
132
171 if(start<=c && c<limit) {
172 return (int)jgArray2[c-start]&0xff;
173 }
174 return UCharacter.JoiningGroup.NO_JOINING_GROUP;
175 }
176
177 public final int getPairedBracketType(int c) {
178 return (trie.get(c)&BPT_MASK)>>BPT_SHIFT;
179 }
180
181 public final int getPairedBracket(int c) {
182 int props=trie.get(c);
183 if((props&BPT_MASK)==0) {
184 return c;
185 } else {
186 return getMirror(c, props);
187 }
188 }
189
190 // data members -------------------------------------------------------- ***
191 private int indexes[];
192 private int mirrors[];
193 private byte jgArray[];
194 private byte jgArray2[];
195
196 private Trie2_16 trie;
197
198 // data format constants ----------------------------------------------- ***
199 private static final String DATA_FILE_NAME = "/sun/text/resources/ubidi.icu";
200
201 /* format "BiDi" */
202 private static final int FMT=0x42694469;
203
204 /* indexes into indexes[] */
205 private static final int IX_TRIE_SIZE=2;
206 private static final int IX_MIRROR_LENGTH=3;
207
208 private static final int IX_JG_START=4;
209 private static final int IX_JG_LIMIT=5;
210 private static final int IX_JG_START2=6; /* new in format version 2.2, ICU 54 */
211 private static final int IX_JG_LIMIT2=7;
212
213 private static final int IX_TOP=16;
214
|
92 }
93 }
94
95 // read jgArray[]
96 count=indexes[IX_JG_LIMIT]-indexes[IX_JG_START];
97 jgArray=new byte[count];
98 for(i=0; i<count; ++i) {
99 jgArray[i]=bytes.get();
100 }
101
102 // read jgArray2[]
103 count=indexes[IX_JG_LIMIT2]-indexes[IX_JG_START2];
104 jgArray2=new byte[count];
105 for(i=0; i<count; ++i) {
106 jgArray2[i]=bytes.get();
107 }
108 }
109
110 // implement ICUBinary.Authenticate
111 private static final class IsAcceptable implements ICUBinary.Authenticate {
112 public boolean isDataVersionAcceptable(byte[] version) {
113 return version[0]==2;
114 }
115 }
116
117 // property access functions ------------------------------------------- ***
118
119 public final int getClass(int c) {
120 return getClassFromProps(trie.get(c));
121 }
122
123 private final int getMirror(int c, int props) {
124 int delta=getMirrorDeltaFromProps(props);
125 if(delta!=ESC_MIRROR_DELTA) {
126 return c+delta;
127 } else {
128 /* look for mirror code point in the mirrors[] table */
129 int m;
130 int i, length;
131 int c2;
132
171 if(start<=c && c<limit) {
172 return (int)jgArray2[c-start]&0xff;
173 }
174 return UCharacter.JoiningGroup.NO_JOINING_GROUP;
175 }
176
177 public final int getPairedBracketType(int c) {
178 return (trie.get(c)&BPT_MASK)>>BPT_SHIFT;
179 }
180
181 public final int getPairedBracket(int c) {
182 int props=trie.get(c);
183 if((props&BPT_MASK)==0) {
184 return c;
185 } else {
186 return getMirror(c, props);
187 }
188 }
189
190 // data members -------------------------------------------------------- ***
191 private int[] indexes;
192 private int[] mirrors;
193 private byte[] jgArray;
194 private byte[] jgArray2;
195
196 private Trie2_16 trie;
197
198 // data format constants ----------------------------------------------- ***
199 private static final String DATA_FILE_NAME = "/sun/text/resources/ubidi.icu";
200
201 /* format "BiDi" */
202 private static final int FMT=0x42694469;
203
204 /* indexes into indexes[] */
205 private static final int IX_TRIE_SIZE=2;
206 private static final int IX_MIRROR_LENGTH=3;
207
208 private static final int IX_JG_START=4;
209 private static final int IX_JG_LIMIT=5;
210 private static final int IX_JG_START2=6; /* new in format version 2.2, ICU 54 */
211 private static final int IX_JG_LIMIT2=7;
212
213 private static final int IX_TOP=16;
214
|