ArabicLigaturizer.java

1
/*
2
 * Copyright 2003 by Paulo Soares.
3
 *
4
 * The contents of this file are subject to the Mozilla Public License Version 1.1
5
 * (the "License"); you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at http://www.mozilla.org/MPL/
7
 *
8
 * Software distributed under the License is distributed on an "AS IS" basis,
9
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10
 * for the specific language governing rights and limitations under the License.
11
 *
12
 * The Original Code is 'iText, a free JAVA-PDF library'.
13
 *
14
 * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
15
 * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
16
 * All Rights Reserved.
17
 * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
18
 * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
19
 *
20
 * Contributor(s): all the names of the contributors are added in the source code
21
 * where applicable.
22
 *
23
 * Alternatively, the contents of this file may be used under the terms of the
24
 * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
25
 * provisions of LGPL are applicable instead of those above.  If you wish to
26
 * allow use of your version of this file only under the terms of the LGPL
27
 * License and not to allow others to use your version of this file under
28
 * the MPL, indicate your decision by deleting the provisions above and
29
 * replace them with the notice and other provisions required by the LGPL.
30
 * If you do not delete the provisions above, a recipient may use your version
31
 * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
32
 *
33
 * This library is free software; you can redistribute it and/or modify it
34
 * under the terms of the MPL as stated above or under the terms of the GNU
35
 * Library General Public License as published by the Free Software Foundation;
36
 * either version 2 of the License, or any later version.
37
 *
38
 * This library is distributed in the hope that it will be useful, but WITHOUT
39
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
40
 * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
41
 * details.
42
 *
43
 * If you didn't download this code from the following link, you should check if
44
 * you aren't using an obsolete version:
45
 * http://www.lowagie.com/iText/
46
 */
47
package com.lowagie.text.pdf;
48
49
/**
50
 * Shape arabic characters. This code was inspired by an LGPL'ed C library:
51
 * Pango ( see http://www.pango.com/ ). Note that the code of this is the
52
 * original work of Paulo Soares. Hence it is perfectly justifiable to distribute
53
 * it under the MPL.
54
 *
55
 * @author Paulo Soares (psoares@consiste.pt)
56
 */
57
public class ArabicLigaturizer {
58
    
59
    static boolean isVowel(char s) {
60 6 1. isVowel : changed conditional boundary → NO_COVERAGE
2. isVowel : changed conditional boundary → NO_COVERAGE
3. isVowel : negated conditional → NO_COVERAGE
4. isVowel : negated conditional → NO_COVERAGE
5. isVowel : negated conditional → NO_COVERAGE
6. isVowel : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return ((s >= 0x064B) && (s <= 0x0655)) || (s == 0x0670);
61
    }
62
63
    static char charshape(char s, int which)
64
    /* which 0=isolated 1=final 2=initial 3=medial */
65
    {
66
        int l, r, m;
67 4 1. charshape : changed conditional boundary → NO_COVERAGE
2. charshape : changed conditional boundary → NO_COVERAGE
3. charshape : negated conditional → NO_COVERAGE
4. charshape : negated conditional → NO_COVERAGE
        if ((s >= 0x0621) && (s <= 0x06D3)) {
68
            l = 0;
69 1 1. charshape : Replaced integer subtraction with addition → NO_COVERAGE
            r = chartable.length - 1;
70 2 1. charshape : changed conditional boundary → NO_COVERAGE
2. charshape : negated conditional → NO_COVERAGE
            while (l <= r) {
71 2 1. charshape : Replaced integer addition with subtraction → NO_COVERAGE
2. charshape : Replaced integer division with multiplication → NO_COVERAGE
                m = (l + r) / 2;
72 1 1. charshape : negated conditional → NO_COVERAGE
                if (s == chartable[m][0]) {
73 2 1. charshape : Replaced integer addition with subtraction → NO_COVERAGE
2. charshape : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                    return chartable[m][which + 1];
74
                }
75 2 1. charshape : changed conditional boundary → NO_COVERAGE
2. charshape : negated conditional → NO_COVERAGE
                else if (s < chartable[m][0]) {
76 1 1. charshape : Replaced integer subtraction with addition → NO_COVERAGE
                    r = m - 1;
77
                }
78
                else {
79 1 1. charshape : Replaced integer addition with subtraction → NO_COVERAGE
                    l = m + 1;
80
                }
81
            }
82
        }
83 4 1. charshape : changed conditional boundary → NO_COVERAGE
2. charshape : changed conditional boundary → NO_COVERAGE
3. charshape : negated conditional → NO_COVERAGE
4. charshape : negated conditional → NO_COVERAGE
        else if (s >= 0xfef5 && s <= 0xfefb)
84 2 1. charshape : Replaced integer addition with subtraction → NO_COVERAGE
2. charshape : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return (char)(s + which);
85 1 1. charshape : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return s;
86
    }
87
88
    static int shapecount(char s) {
89
        int l, r, m;
90 5 1. shapecount : changed conditional boundary → NO_COVERAGE
2. shapecount : changed conditional boundary → NO_COVERAGE
3. shapecount : negated conditional → NO_COVERAGE
4. shapecount : negated conditional → NO_COVERAGE
5. shapecount : negated conditional → NO_COVERAGE
        if ((s >= 0x0621) && (s <= 0x06D3) && !isVowel(s)) {
91
            l = 0;
92 1 1. shapecount : Replaced integer subtraction with addition → NO_COVERAGE
            r = chartable.length - 1;
93 2 1. shapecount : changed conditional boundary → NO_COVERAGE
2. shapecount : negated conditional → NO_COVERAGE
            while (l <= r) {
94 2 1. shapecount : Replaced integer addition with subtraction → NO_COVERAGE
2. shapecount : Replaced integer division with multiplication → NO_COVERAGE
                m = (l + r) / 2;
95 1 1. shapecount : negated conditional → NO_COVERAGE
                if (s == chartable[m][0]) {
96 2 1. shapecount : Replaced integer subtraction with addition → NO_COVERAGE
2. shapecount : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                    return chartable[m].length - 1;
97
                }
98 2 1. shapecount : changed conditional boundary → NO_COVERAGE
2. shapecount : negated conditional → NO_COVERAGE
                else if (s < chartable[m][0]) {
99 1 1. shapecount : Replaced integer subtraction with addition → NO_COVERAGE
                    r = m - 1;
100
                }
101
                else {
102 1 1. shapecount : Replaced integer addition with subtraction → NO_COVERAGE
                    l = m + 1;
103
                }
104
            }
105
        }
106 1 1. shapecount : negated conditional → NO_COVERAGE
        else if (s == ZWJ) {
107 1 1. shapecount : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return 4;
108
        }
109 1 1. shapecount : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return 1;
110
    }
111
    
112
    static int ligature(char newchar, charstruct oldchar) {
113
    /* 0 == no ligature possible; 1 == vowel; 2 == two chars; 3 == Lam+Alef */
114
        int retval = 0;
115
        
116 1 1. ligature : negated conditional → NO_COVERAGE
        if (oldchar.basechar == 0)
117 1 1. ligature : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return 0;
118 1 1. ligature : negated conditional → NO_COVERAGE
        if (isVowel(newchar)) {
119
            retval = 1;
120 2 1. ligature : negated conditional → NO_COVERAGE
2. ligature : negated conditional → NO_COVERAGE
            if ((oldchar.vowel != 0) && (newchar != SHADDA)) {
121
                retval = 2;           /* we eliminate the old vowel .. */
122
            }
123
            switch (newchar) {
124
                case SHADDA:
125 1 1. ligature : negated conditional → NO_COVERAGE
                    if (oldchar.mark1 == 0) {
126
                        oldchar.mark1 = SHADDA;
127
                    }
128
                    else {
129 1 1. ligature : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                        return 0;         /* no ligature possible */
130
                    }
131
                    break;
132
                case HAMZABELOW:
133
                    switch (oldchar.basechar) {
134
                        case ALEF:
135
                            oldchar.basechar = ALEFHAMZABELOW;
136
                            retval = 2;
137
                            break;
138
                        case LAM_ALEF:
139
                            oldchar.basechar = LAM_ALEFHAMZABELOW;
140
                            retval = 2;
141
                            break;
142
                        default:
143
                            oldchar.mark1 = HAMZABELOW;
144
                            break;
145
                    }
146
                    break;
147
                case HAMZAABOVE:
148
                    switch (oldchar.basechar) {
149
                        case ALEF:
150
                            oldchar.basechar = ALEFHAMZA;
151
                            retval = 2;
152
                            break;
153
                        case LAM_ALEF:
154
                            oldchar.basechar = LAM_ALEFHAMZA;
155
                            retval = 2;
156
                            break;
157
                        case WAW:
158
                            oldchar.basechar = WAWHAMZA;
159
                            retval = 2;
160
                            break;
161
                        case YEH:
162
                        case ALEFMAKSURA:
163
                        case FARSIYEH:
164
                            oldchar.basechar = YEHHAMZA;
165
                            retval = 2;
166
                            break;
167
                        default:           /* whatever sense this may make .. */
168
                            oldchar.mark1 = HAMZAABOVE;
169
                            break;
170
                    }
171
                    break;
172
                case MADDA:
173
                    switch (oldchar.basechar) {
174
                        case ALEF:
175
                            oldchar.basechar = ALEFMADDA;
176
                            retval = 2;
177
                            break;
178
                    }
179
                    break;
180
                default:
181
                    oldchar.vowel = newchar;
182
                    break;
183
            }
184 1 1. ligature : negated conditional → NO_COVERAGE
            if (retval == 1) {
185 1 1. ligature : Replaced integer addition with subtraction → NO_COVERAGE
                oldchar.lignum++;
186
            }
187 1 1. ligature : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return retval;
188
        }
189 1 1. ligature : negated conditional → NO_COVERAGE
        if (oldchar.vowel != 0) {  /* if we already joined a vowel, we can't join a Hamza */
190 1 1. ligature : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return 0;
191
        }
192
        
193
        switch (oldchar.basechar) {
194
            case LAM:
195
                switch (newchar) {
196
                    case ALEF:
197
                        oldchar.basechar = LAM_ALEF;
198
                        oldchar.numshapes = 2;
199
                        retval = 3;
200
                        break;
201
                    case ALEFHAMZA:
202
                        oldchar.basechar = LAM_ALEFHAMZA;
203
                        oldchar.numshapes = 2;
204
                        retval = 3;
205
                        break;
206
                    case ALEFHAMZABELOW:
207
                        oldchar.basechar = LAM_ALEFHAMZABELOW;
208
                        oldchar.numshapes = 2;
209
                        retval = 3;
210
                        break;
211
                    case ALEFMADDA:
212
                        oldchar.basechar = LAM_ALEFMADDA;
213
                        oldchar.numshapes = 2;
214
                        retval = 3;
215
                        break;
216
                }
217
                break;
218
            case 0:
219
                oldchar.basechar = newchar;
220
                oldchar.numshapes = shapecount(newchar);
221
                retval = 1;
222
                break;
223
        }
224 1 1. ligature : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return retval;
225
    }
226
    
227
    static void copycstostring(StringBuffer string, charstruct s, int level) {
228
    /* s is a shaped charstruct; i is the index into the string */
229 1 1. copycstostring : negated conditional → NO_COVERAGE
        if (s.basechar == 0)
230
            return;
231
        
232
        string.append(s.basechar);
233 1 1. copycstostring : Replaced integer subtraction with addition → NO_COVERAGE
        s.lignum--;
234 1 1. copycstostring : negated conditional → NO_COVERAGE
        if (s.mark1 != 0) {
235 2 1. copycstostring : Replaced bitwise AND with OR → NO_COVERAGE
2. copycstostring : negated conditional → NO_COVERAGE
            if ((level & ar_novowel) == 0) {
236
                string.append(s.mark1);
237 1 1. copycstostring : Replaced integer subtraction with addition → NO_COVERAGE
                s.lignum--;
238
            }
239
            else {
240 1 1. copycstostring : Replaced integer subtraction with addition → NO_COVERAGE
                s.lignum--;
241
            }
242
        }
243 1 1. copycstostring : negated conditional → NO_COVERAGE
        if (s.vowel != 0) {
244 2 1. copycstostring : Replaced bitwise AND with OR → NO_COVERAGE
2. copycstostring : negated conditional → NO_COVERAGE
            if ((level & ar_novowel) == 0) {
245
                string.append(s.vowel);
246 1 1. copycstostring : Replaced integer subtraction with addition → NO_COVERAGE
                s.lignum--;
247
            }
248
            else {                       /* vowel elimination */
249 1 1. copycstostring : Replaced integer subtraction with addition → NO_COVERAGE
                s.lignum--;
250
            }
251
        }
252
//        while (s.lignum > 0) {                           /* NULL-insertion for Langbox-font */
253
//            string[i] = 0;
254
//            i++;
255
//            (s.lignum)--;
256
//        }
257
//        return i;
258
    }
259
260
    // return len
261
    static void doublelig(StringBuffer string, int level)
262
    /* Ok. We have presentation ligatures in our font. */
263
    {
264
        int len;
265
        int olen = len = string.length();
266
        int j = 0, si = 1;
267
        char lapresult;
268
        
269 2 1. doublelig : changed conditional boundary → NO_COVERAGE
2. doublelig : negated conditional → NO_COVERAGE
        while (si < olen) {
270
            lapresult = 0;
271 2 1. doublelig : Replaced bitwise AND with OR → NO_COVERAGE
2. doublelig : negated conditional → NO_COVERAGE
            if ((level & ar_composedtashkeel) != 0) {
272
                switch (string.charAt(j)) {
273
                    case SHADDA:
274
                        switch (string.charAt(si)) {
275
                            case KASRA:
276
                                lapresult = 0xFC62;
277
                                break;
278
                            case FATHA:
279
                                lapresult = 0xFC60;
280
                                break;
281
                            case DAMMA:
282
                                lapresult = 0xFC61;
283
                                break;
284
                            case 0x064C:
285
                                lapresult = 0xFC5E;
286
                                break;
287
                            case 0x064D:
288
                                lapresult = 0xFC5F;
289
                                break;
290
                        }
291
                        break;
292
                    case KASRA:
293 1 1. doublelig : negated conditional → NO_COVERAGE
                        if (string.charAt(si) == SHADDA)
294
                            lapresult = 0xFC62;
295
                        break;
296
                    case FATHA:
297 1 1. doublelig : negated conditional → NO_COVERAGE
                        if (string.charAt(si) == SHADDA)
298
                            lapresult = 0xFC60;
299
                        break;
300
                    case DAMMA:
301 1 1. doublelig : negated conditional → NO_COVERAGE
                        if (string.charAt(si) == SHADDA)
302
                            lapresult = 0xFC61;
303
                        break;
304
                }
305
            }
306
            
307 2 1. doublelig : Replaced bitwise AND with OR → NO_COVERAGE
2. doublelig : negated conditional → NO_COVERAGE
            if ((level & ar_lig) != 0) {
308
                switch (string.charAt(j)) {
309
                    case 0xFEDF:       /* LAM initial */
310
                        switch (string.charAt(si)) {
311
                            case 0xFE9E:
312
                                lapresult = 0xFC3F;
313
                                break;        /* JEEM final */
314
                            case 0xFEA0:
315
                                lapresult = 0xFCC9;
316
                                break;        /* JEEM medial */
317
                            case 0xFEA2:
318
                                lapresult = 0xFC40;
319
                                break;        /* HAH final */
320
                            case 0xFEA4:
321
                                lapresult = 0xFCCA;
322
                                break;        /* HAH medial */
323
                            case 0xFEA6:
324
                                lapresult = 0xFC41;
325
                                break;        /* KHAH final */
326
                            case 0xFEA8:
327
                                lapresult = 0xFCCB;
328
                                break;        /* KHAH medial */
329
                            case 0xFEE2:
330
                                lapresult = 0xFC42;
331
                                break;        /* MEEM final */
332
                            case 0xFEE4:
333
                                lapresult = 0xFCCC;
334
                                break;        /* MEEM medial */
335
                        }
336
                        break;
337
                    case 0xFE97:       /* TEH inital */
338
                        switch (string.charAt(si)) {
339
                            case 0xFEA0:
340
                                lapresult = 0xFCA1;
341
                                break;        /* JEEM medial */
342
                            case 0xFEA4:
343
                                lapresult = 0xFCA2;
344
                                break;        /* HAH medial */
345
                            case 0xFEA8:
346
                                lapresult = 0xFCA3;
347
                                break;        /* KHAH medial */
348
                        }
349
                        break;
350
                    case 0xFE91:       /* BEH inital */
351
                        switch (string.charAt(si)) {
352
                            case 0xFEA0:
353
                                lapresult = 0xFC9C;
354
                                break;        /* JEEM medial */
355
                            case 0xFEA4:
356
                                lapresult = 0xFC9D;
357
                                break;        /* HAH medial */
358
                            case 0xFEA8:
359
                                lapresult = 0xFC9E;
360
                                break;        /* KHAH medial */
361
                        }
362
                        break;
363
                    case 0xFEE7:       /* NOON inital */
364
                        switch (string.charAt(si)) {
365
                            case 0xFEA0:
366
                                lapresult = 0xFCD2;
367
                                break;        /* JEEM initial */
368
                            case 0xFEA4:
369
                                lapresult = 0xFCD3;
370
                                break;        /* HAH medial */
371
                            case 0xFEA8:
372
                                lapresult = 0xFCD4;
373
                                break;        /* KHAH medial */
374
                        }
375
                        break;
376
                        
377
                    case 0xFEE8:       /* NOON medial */
378
                        switch (string.charAt(si)) {
379
                            case 0xFEAE:
380
                                lapresult = 0xFC8A;
381
                                break;        /* REH final  */
382
                            case 0xFEB0:
383
                                lapresult = 0xFC8B;
384
                                break;        /* ZAIN final */
385
                        }
386
                        break;
387
                    case 0xFEE3:       /* MEEM initial */
388
                        switch (string.charAt(si)) {
389
                            case 0xFEA0:
390
                                lapresult = 0xFCCE;
391
                                break;        /* JEEM medial */
392
                            case 0xFEA4:
393
                                lapresult = 0xFCCF;
394
                                break;        /* HAH medial */
395
                            case 0xFEA8:
396
                                lapresult = 0xFCD0;
397
                                break;        /* KHAH medial */
398
                            case 0xFEE4:
399
                                lapresult = 0xFCD1;
400
                                break;        /* MEEM medial */
401
                        }
402
                        break;
403
                        
404
                    case 0xFED3:       /* FEH initial */
405
                        switch (string.charAt(si)) {
406
                            case 0xFEF2:
407
                                lapresult = 0xFC32;
408
                                break;        /* YEH final */
409
                        }
410
                        break;
411
                        
412
                    default:
413
                        break;
414
                }                   /* end switch string[si] */
415
            }
416 1 1. doublelig : negated conditional → NO_COVERAGE
            if (lapresult != 0) {
417 1 1. doublelig : removed call to java/lang/StringBuffer::setCharAt → NO_COVERAGE
                string.setCharAt(j, lapresult);
418 1 1. doublelig : Changed increment from -1 to 1 → NO_COVERAGE
                len--;
419 1 1. doublelig : Changed increment from 1 to -1 → NO_COVERAGE
                si++;                 /* jump over one character */
420
                /* we'll have to change this, too. */
421
            }
422
            else {
423 1 1. doublelig : Changed increment from 1 to -1 → NO_COVERAGE
                j++;
424 1 1. doublelig : removed call to java/lang/StringBuffer::setCharAt → NO_COVERAGE
                string.setCharAt(j, string.charAt(si));
425 1 1. doublelig : Changed increment from 1 to -1 → NO_COVERAGE
                si++;
426
            }
427
        }
428 1 1. doublelig : removed call to java/lang/StringBuffer::setLength → NO_COVERAGE
        string.setLength(len);
429
    }
430
431
    static boolean connects_to_left(charstruct a) {
432 3 1. connects_to_left : changed conditional boundary → NO_COVERAGE
2. connects_to_left : negated conditional → NO_COVERAGE
3. connects_to_left : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return a.numshapes > 2;
433
    }
434
    
435
    static void shape(char[] text, StringBuffer string, int level) {
436
  /* string is assumed to be empty and big enough.
437
   * text is the original text.
438
   * This routine does the basic arabic reshaping.
439
   * *len the number of non-null characters.
440
   *
441
   * Note: We have to unshape each character first!
442
   */
443
        int join;
444
        int which;
445
        char nextletter;
446
        
447
        int p = 0;                     /* initialize for output */
448
        charstruct oldchar = new charstruct();
449
        charstruct curchar = new charstruct();
450 2 1. shape : changed conditional boundary → NO_COVERAGE
2. shape : negated conditional → NO_COVERAGE
        while (p < text.length) {
451 1 1. shape : Changed increment from 1 to -1 → NO_COVERAGE
            nextletter = text[p++];
452
            //nextletter = unshape (nextletter);
453
            
454
            join = ligature(nextletter, curchar);
455 1 1. shape : negated conditional → NO_COVERAGE
            if (join == 0) {                       /* shape curchar */
456
                int nc = shapecount(nextletter);
457
                //(*len)++;
458 1 1. shape : negated conditional → NO_COVERAGE
                if (nc == 1) {
459
                    which = 0;        /* final or isolated */
460
                }
461
                else {
462
                    which = 2;        /* medial or initial */
463
                }
464 1 1. shape : negated conditional → NO_COVERAGE
                if (connects_to_left(oldchar)) {
465 1 1. shape : Changed increment from 1 to -1 → NO_COVERAGE
                    which++;
466
                }
467
                
468 1 1. shape : Replaced integer modulus with multiplication → NO_COVERAGE
                which = which % (curchar.numshapes);
469
                curchar.basechar = charshape(curchar.basechar, which);
470
                
471
                /* get rid of oldchar */
472 1 1. shape : removed call to com/lowagie/text/pdf/ArabicLigaturizer::copycstostring → NO_COVERAGE
                copycstostring(string, oldchar, level);
473
                oldchar = curchar;    /* new values in oldchar */
474
                
475
                /* init new curchar */
476
                curchar = new charstruct();
477
                curchar.basechar = nextletter;
478
                curchar.numshapes = nc;
479 1 1. shape : Replaced integer addition with subtraction → NO_COVERAGE
                curchar.lignum++;
480
                //          (*len) += unligature (&curchar, level);
481
            }
482 1 1. shape : negated conditional → NO_COVERAGE
            else if (join == 1) {
483
            }
484
            //      else
485
            //        {
486
            //          (*len) += unligature (&curchar, level);
487
            //        }
488
            //      p = g_utf8_next_char (p);
489
        }
490
        
491
        /* Handle last char */
492 1 1. shape : negated conditional → NO_COVERAGE
        if (connects_to_left(oldchar))
493
            which = 1;
494
        else
495
            which = 0;
496 1 1. shape : Replaced integer modulus with multiplication → NO_COVERAGE
        which = which % (curchar.numshapes);
497
        curchar.basechar = charshape(curchar.basechar, which);
498
        
499
        /* get rid of oldchar */
500 1 1. shape : removed call to com/lowagie/text/pdf/ArabicLigaturizer::copycstostring → NO_COVERAGE
        copycstostring(string, oldchar, level);
501 1 1. shape : removed call to com/lowagie/text/pdf/ArabicLigaturizer::copycstostring → NO_COVERAGE
        copycstostring(string, curchar, level);
502
    }
503
504
    static int arabic_shape(char[] src, int srcoffset, int srclength, char[] dest, int destoffset, int destlength, int level) {
505
        char[] str = new char[srclength];
506 4 1. arabic_shape : changed conditional boundary → NO_COVERAGE
2. arabic_shape : Replaced integer addition with subtraction → NO_COVERAGE
3. arabic_shape : Replaced integer subtraction with addition → NO_COVERAGE
4. arabic_shape : negated conditional → NO_COVERAGE
        if (srclength + srcoffset - srcoffset >= 0)
507 4 1. arabic_shape : Replaced integer subtraction with addition → NO_COVERAGE
2. arabic_shape : Replaced integer addition with subtraction → NO_COVERAGE
3. arabic_shape : Replaced integer subtraction with addition → NO_COVERAGE
4. arabic_shape : removed call to java/lang/System::arraycopy → NO_COVERAGE
            System.arraycopy(src, srcoffset, str, srcoffset - srcoffset, srclength + srcoffset - srcoffset);
508
        StringBuffer string = new StringBuffer(srclength);
509 1 1. arabic_shape : removed call to com/lowagie/text/pdf/ArabicLigaturizer::shape → NO_COVERAGE
        shape(str, string, level);
510 2 1. arabic_shape : Replaced bitwise AND with OR → NO_COVERAGE
2. arabic_shape : negated conditional → NO_COVERAGE
        if ((level & (ar_composedtashkeel | ar_lig)) != 0)
511 1 1. arabic_shape : removed call to com/lowagie/text/pdf/ArabicLigaturizer::doublelig → NO_COVERAGE
            doublelig(string, level);
512
//        string.reverse();
513 1 1. arabic_shape : removed call to java/lang/System::arraycopy → NO_COVERAGE
        System.arraycopy(string.toString().toCharArray(), 0, dest, destoffset, string.length());
514 1 1. arabic_shape : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return string.length();
515
    }
516
517
    static void processNumbers(char[] text, int offset, int length, int options) {
518 1 1. processNumbers : Replaced integer addition with subtraction → NO_COVERAGE
        int limit = offset + length;
519 2 1. processNumbers : Replaced bitwise AND with OR → NO_COVERAGE
2. processNumbers : negated conditional → NO_COVERAGE
        if ((options & DIGITS_MASK) != 0) {
520
            char digitBase = '\u0030'; // European digits
521 1 1. processNumbers : Replaced bitwise AND with OR → NO_COVERAGE
            switch (options & DIGIT_TYPE_MASK) {
522
                case DIGIT_TYPE_AN:
523
                    digitBase = '\u0660';  // Arabic-Indic digits
524
                    break;
525
                    
526
                case DIGIT_TYPE_AN_EXTENDED:
527
                    digitBase = '\u06f0';  // Eastern Arabic-Indic digits (Persian and Urdu)
528
                    break;
529
                    
530
                default:
531
                    break;
532
            }
533
            
534 1 1. processNumbers : Replaced bitwise AND with OR → NO_COVERAGE
            switch (options & DIGITS_MASK) {
535
                case DIGITS_EN2AN: {
536 1 1. processNumbers : Replaced integer subtraction with addition → NO_COVERAGE
                    int digitDelta = digitBase - '\u0030';
537 3 1. processNumbers : changed conditional boundary → NO_COVERAGE
2. processNumbers : Changed increment from 1 to -1 → NO_COVERAGE
3. processNumbers : negated conditional → NO_COVERAGE
                    for (int i = offset; i < limit; ++i) {
538
                        char ch = text[i];
539 4 1. processNumbers : changed conditional boundary → NO_COVERAGE
2. processNumbers : changed conditional boundary → NO_COVERAGE
3. processNumbers : negated conditional → NO_COVERAGE
4. processNumbers : negated conditional → NO_COVERAGE
                        if (ch <= '\u0039' && ch >= '\u0030') {
540 1 1. processNumbers : Replaced integer addition with subtraction → NO_COVERAGE
                            text[i] += digitDelta;
541
                        }
542
                    }
543
                }
544
                break;
545
                
546
                case DIGITS_AN2EN: {
547 1 1. processNumbers : Replaced integer addition with subtraction → NO_COVERAGE
                    char digitTop = (char)(digitBase + 9);
548 1 1. processNumbers : Replaced integer subtraction with addition → NO_COVERAGE
                    int digitDelta = '\u0030' - digitBase;
549 3 1. processNumbers : changed conditional boundary → NO_COVERAGE
2. processNumbers : Changed increment from 1 to -1 → NO_COVERAGE
3. processNumbers : negated conditional → NO_COVERAGE
                    for (int i = offset; i < limit; ++i) {
550
                        char ch = text[i];
551 4 1. processNumbers : changed conditional boundary → NO_COVERAGE
2. processNumbers : changed conditional boundary → NO_COVERAGE
3. processNumbers : negated conditional → NO_COVERAGE
4. processNumbers : negated conditional → NO_COVERAGE
                        if (ch <= digitTop && ch >= digitBase) {
552 1 1. processNumbers : Replaced integer addition with subtraction → NO_COVERAGE
                            text[i] += digitDelta;
553
                        }
554
                    }
555
                }
556
                break;
557
558
                case DIGITS_EN2AN_INIT_LR:
559 1 1. processNumbers : removed call to com/lowagie/text/pdf/ArabicLigaturizer::shapeToArabicDigitsWithContext → NO_COVERAGE
                    shapeToArabicDigitsWithContext(text, 0, length, digitBase, false);
560
                    break;
561
562
                case DIGITS_EN2AN_INIT_AL:
563 1 1. processNumbers : removed call to com/lowagie/text/pdf/ArabicLigaturizer::shapeToArabicDigitsWithContext → NO_COVERAGE
                    shapeToArabicDigitsWithContext(text, 0, length, digitBase, true);
564
                    break;
565
566
                default:
567
                    break;
568
            }
569
        }
570
    }
571
572
    /**
573
     * Given an array of characters, process a section of it, and replace
574
     * European numeral characters (0-9) with Arabic numeral characters
575
     * (depending on the {@code digitBase}) if the characters are preceded by
576
     * Arabic characters.
577
     * 
578
     * @param dest
579
     *            The array of characters to be processed. Must not be
580
     *            {@code null}, and must have a length greater than {@code 0}.
581
     * @param start
582
     *            The start index of the characters to be processed. The value
583
     *            must be greater than, or equal to, {@code 0} and less than the
584
     *            length of the array {@code dest}.
585
     * @param length
586
     *            The number of characters to process. {@code length} +
587
     *            {@code start} must be less than, or equal to, the length of
588
     *            the array {@code dest}.
589
     * @param digitBase
590
     *            The code of the character which represents the numeral 0 into
591
     *            which the European numbers should be converted. For instance,
592
     *            Arabic-Indic digits begin at {@code '\u0660'}, and Eastern
593
     *            Arabic-Indic digits (Persian and Urdu) begin at
594
     *            {@code '\u06f0'}.
595
     * @param lastStrongWasAL
596
     *            A boolean flag indicating whether or not the character
597
     *            preceding the array of characters to be processed was an
598
     *            Arabic character, or not.
599
     */
600
    static void shapeToArabicDigitsWithContext(char[] dest, int start, int length, char digitBase, boolean lastStrongWasAL) {
601 1 1. shapeToArabicDigitsWithContext : Replaced integer subtraction with addition → NO_COVERAGE
        digitBase -= '0'; // move common adjustment out of loop
602
603 1 1. shapeToArabicDigitsWithContext : Replaced integer addition with subtraction → NO_COVERAGE
        int limit = start + length;
604 3 1. shapeToArabicDigitsWithContext : changed conditional boundary → NO_COVERAGE
2. shapeToArabicDigitsWithContext : Changed increment from 1 to -1 → NO_COVERAGE
3. shapeToArabicDigitsWithContext : negated conditional → NO_COVERAGE
        for (int i = start; i < limit; ++i) {
605
            char ch = dest[i];
606
            switch (Character.getDirectionality(ch)) {
607
                case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
608
                case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
609
                    lastStrongWasAL = false;
610
                    break;
611
                case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
612
                    lastStrongWasAL = true;
613
                    break;
614
                case Character.DIRECTIONALITY_EUROPEAN_NUMBER:
615 3 1. shapeToArabicDigitsWithContext : changed conditional boundary → NO_COVERAGE
2. shapeToArabicDigitsWithContext : negated conditional → NO_COVERAGE
3. shapeToArabicDigitsWithContext : negated conditional → NO_COVERAGE
                    if (lastStrongWasAL && ch <= '\u0039') {
616 1 1. shapeToArabicDigitsWithContext : Replaced integer addition with subtraction → NO_COVERAGE
                        dest[i] = (char) (ch + digitBase);
617
                    }
618
                    break;
619
                default:
620
                    break;
621
            }
622
        }
623
    }
624
625
    private static final char ALEF = 0x0627;
626
    private static final char ALEFHAMZA = 0x0623;
627
    private static final char ALEFHAMZABELOW = 0x0625;
628
    private static final char ALEFMADDA = 0x0622;
629
    private static final char LAM = 0x0644;
630
    private static final char HAMZA = 0x0621;
631
    private static final char TATWEEL = 0x0640;
632
    private static final char ZWJ = 0x200D;
633
634
    private static final char HAMZAABOVE = 0x0654;
635
    private static final char HAMZABELOW = 0x0655;
636
637
    private static final char WAWHAMZA = 0x0624;
638
    private static final char YEHHAMZA = 0x0626;
639
    private static final char WAW = 0x0648;
640
    private static final char ALEFMAKSURA = 0x0649;
641
    private static final char YEH = 0x064A;
642
    private static final char FARSIYEH = 0x06CC;
643
644
    private static final char SHADDA = 0x0651;
645
    private static final char KASRA = 0x0650;
646
    private static final char FATHA = 0x064E;
647
    private static final char DAMMA = 0x064F;
648
    private static final char MADDA = 0x0653;
649
650
    private static final char LAM_ALEF = 0xFEFB;
651
    private static final char LAM_ALEFHAMZA = 0xFEF7;
652
    private static final char LAM_ALEFHAMZABELOW = 0xFEF9;
653
    private static final char LAM_ALEFMADDA = 0xFEF5;
654
655
    private static final char[][] chartable = {
656
            {0x0621, 0xFE80}, /* HAMZA */
657
            {0x0622, 0xFE81, 0xFE82}, /* ALEF WITH MADDA ABOVE */
658
            {0x0623, 0xFE83, 0xFE84}, /* ALEF WITH HAMZA ABOVE */
659
            {0x0624, 0xFE85, 0xFE86}, /* WAW WITH HAMZA ABOVE */
660
            {0x0625, 0xFE87, 0xFE88}, /* ALEF WITH HAMZA BELOW */
661
            {0x0626, 0xFE89, 0xFE8A, 0xFE8B, 0xFE8C}, /* YEH WITH HAMZA ABOVE */
662
            {0x0627, 0xFE8D, 0xFE8E}, /* ALEF */
663
            {0x0628, 0xFE8F, 0xFE90, 0xFE91, 0xFE92}, /* BEH */
664
            {0x0629, 0xFE93, 0xFE94}, /* TEH MARBUTA */
665
            {0x062A, 0xFE95, 0xFE96, 0xFE97, 0xFE98}, /* TEH */
666
            {0x062B, 0xFE99, 0xFE9A, 0xFE9B, 0xFE9C}, /* THEH */
667
            {0x062C, 0xFE9D, 0xFE9E, 0xFE9F, 0xFEA0}, /* JEEM */
668
            {0x062D, 0xFEA1, 0xFEA2, 0xFEA3, 0xFEA4}, /* HAH */
669
            {0x062E, 0xFEA5, 0xFEA6, 0xFEA7, 0xFEA8}, /* KHAH */
670
            {0x062F, 0xFEA9, 0xFEAA}, /* DAL */
671
            {0x0630, 0xFEAB, 0xFEAC}, /* THAL */
672
            {0x0631, 0xFEAD, 0xFEAE}, /* REH */
673
            {0x0632, 0xFEAF, 0xFEB0}, /* ZAIN */
674
            {0x0633, 0xFEB1, 0xFEB2, 0xFEB3, 0xFEB4}, /* SEEN */
675
            {0x0634, 0xFEB5, 0xFEB6, 0xFEB7, 0xFEB8}, /* SHEEN */
676
            {0x0635, 0xFEB9, 0xFEBA, 0xFEBB, 0xFEBC}, /* SAD */
677
            {0x0636, 0xFEBD, 0xFEBE, 0xFEBF, 0xFEC0}, /* DAD */
678
            {0x0637, 0xFEC1, 0xFEC2, 0xFEC3, 0xFEC4}, /* TAH */
679
            {0x0638, 0xFEC5, 0xFEC6, 0xFEC7, 0xFEC8}, /* ZAH */
680
            {0x0639, 0xFEC9, 0xFECA, 0xFECB, 0xFECC}, /* AIN */
681
            {0x063A, 0xFECD, 0xFECE, 0xFECF, 0xFED0}, /* GHAIN */
682
            {0x0640, 0x0640, 0x0640, 0x0640, 0x0640}, /* TATWEEL */
683
            {0x0641, 0xFED1, 0xFED2, 0xFED3, 0xFED4}, /* FEH */
684
            {0x0642, 0xFED5, 0xFED6, 0xFED7, 0xFED8}, /* QAF */
685
            {0x0643, 0xFED9, 0xFEDA, 0xFEDB, 0xFEDC}, /* KAF */
686
            {0x0644, 0xFEDD, 0xFEDE, 0xFEDF, 0xFEE0}, /* LAM */
687
            {0x0645, 0xFEE1, 0xFEE2, 0xFEE3, 0xFEE4}, /* MEEM */
688
            {0x0646, 0xFEE5, 0xFEE6, 0xFEE7, 0xFEE8}, /* NOON */
689
            {0x0647, 0xFEE9, 0xFEEA, 0xFEEB, 0xFEEC}, /* HEH */
690
            {0x0648, 0xFEED, 0xFEEE}, /* WAW */
691
            {0x0649, 0xFEEF, 0xFEF0, 0xFBE8, 0xFBE9}, /* ALEF MAKSURA */
692
            {0x064A, 0xFEF1, 0xFEF2, 0xFEF3, 0xFEF4}, /* YEH */
693
            {0x0671, 0xFB50, 0xFB51}, /* ALEF WASLA */
694
            {0x0679, 0xFB66, 0xFB67, 0xFB68, 0xFB69}, /* TTEH */
695
            {0x067A, 0xFB5E, 0xFB5F, 0xFB60, 0xFB61}, /* TTEHEH */
696
            {0x067B, 0xFB52, 0xFB53, 0xFB54, 0xFB55}, /* BEEH */
697
            {0x067E, 0xFB56, 0xFB57, 0xFB58, 0xFB59}, /* PEH */
698
            {0x067F, 0xFB62, 0xFB63, 0xFB64, 0xFB65}, /* TEHEH */
699
            {0x0680, 0xFB5A, 0xFB5B, 0xFB5C, 0xFB5D}, /* BEHEH */
700
            {0x0683, 0xFB76, 0xFB77, 0xFB78, 0xFB79}, /* NYEH */
701
            {0x0684, 0xFB72, 0xFB73, 0xFB74, 0xFB75}, /* DYEH */
702
            {0x0686, 0xFB7A, 0xFB7B, 0xFB7C, 0xFB7D}, /* TCHEH */
703
            {0x0687, 0xFB7E, 0xFB7F, 0xFB80, 0xFB81}, /* TCHEHEH */
704
            {0x0688, 0xFB88, 0xFB89}, /* DDAL */
705
            {0x068C, 0xFB84, 0xFB85}, /* DAHAL */
706
            {0x068D, 0xFB82, 0xFB83}, /* DDAHAL */
707
            {0x068E, 0xFB86, 0xFB87}, /* DUL */
708
            {0x0691, 0xFB8C, 0xFB8D}, /* RREH */
709
            {0x0698, 0xFB8A, 0xFB8B}, /* JEH */
710
            {0x06A4, 0xFB6A, 0xFB6B, 0xFB6C, 0xFB6D}, /* VEH */
711
            {0x06A6, 0xFB6E, 0xFB6F, 0xFB70, 0xFB71}, /* PEHEH */
712
            {0x06A9, 0xFB8E, 0xFB8F, 0xFB90, 0xFB91}, /* KEHEH */
713
            {0x06AD, 0xFBD3, 0xFBD4, 0xFBD5, 0xFBD6}, /* NG */
714
            {0x06AF, 0xFB92, 0xFB93, 0xFB94, 0xFB95}, /* GAF */
715
            {0x06B1, 0xFB9A, 0xFB9B, 0xFB9C, 0xFB9D}, /* NGOEH */
716
            {0x06B3, 0xFB96, 0xFB97, 0xFB98, 0xFB99}, /* GUEH */
717
            {0x06BA, 0xFB9E, 0xFB9F}, /* NOON GHUNNA */
718
            {0x06BB, 0xFBA0, 0xFBA1, 0xFBA2, 0xFBA3}, /* RNOON */
719
            {0x06BE, 0xFBAA, 0xFBAB, 0xFBAC, 0xFBAD}, /* HEH DOACHASHMEE */
720
            {0x06C0, 0xFBA4, 0xFBA5}, /* HEH WITH YEH ABOVE */
721
            {0x06C1, 0xFBA6, 0xFBA7, 0xFBA8, 0xFBA9}, /* HEH GOAL */
722
            {0x06C5, 0xFBE0, 0xFBE1}, /* KIRGHIZ OE */
723
            {0x06C6, 0xFBD9, 0xFBDA}, /* OE */
724
            {0x06C7, 0xFBD7, 0xFBD8}, /* U */
725
            {0x06C8, 0xFBDB, 0xFBDC}, /* YU */
726
            {0x06C9, 0xFBE2, 0xFBE3}, /* KIRGHIZ YU */
727
            {0x06CB, 0xFBDE, 0xFBDF}, /* VE */
728
            {0x06CC, 0xFBFC, 0xFBFD, 0xFBFE, 0xFBFF}, /* FARSI YEH */
729
            {0x06D0, 0xFBE4, 0xFBE5, 0xFBE6, 0xFBE7}, /* E */
730
            {0x06D2, 0xFBAE, 0xFBAF}, /* YEH BARREE */
731
            {0x06D3, 0xFBB0, 0xFBB1} /* YEH BARREE WITH HAMZA ABOVE */
732
    };
733
734
        public static final int ar_nothing  = 0x0;
735
        public static final int ar_novowel = 0x1;
736
        public static final int ar_composedtashkeel = 0x4;
737
        public static final int ar_lig = 0x8;
738
        /**
739
         * Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits.
740
         */
741
        public static final int DIGITS_EN2AN = 0x20;
742
        
743
        /**
744
         * Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039).
745
         */
746
        public static final int DIGITS_AN2EN = 0x40;
747
        
748
        /**
749
         * Digit shaping option:
750
         * Replace European digits (U+0030...U+0039) by Arabic-Indic digits
751
         * if the most recent strongly directional character
752
         * is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
753
         * The initial state at the start of the text is assumed to be not an Arabic,
754
         * letter, so European digits at the start of the text will not change.
755
         * Compare to DIGITS_ALEN2AN_INIT_AL.
756
         */
757
        public static final int DIGITS_EN2AN_INIT_LR = 0x60;
758
        
759
        /**
760
         * Digit shaping option:
761
         * Replace European digits (U+0030...U+0039) by Arabic-Indic digits
762
         * if the most recent strongly directional character
763
         * is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
764
         * The initial state at the start of the text is assumed to be an Arabic,
765
         * letter, so European digits at the start of the text will change.
766
         * Compare to DIGITS_ALEN2AN_INT_LR.
767
         */
768
        public static final int DIGITS_EN2AN_INIT_AL = 0x80;
769
        
770
        /** Not a valid option value. */
771
        private static final int DIGITS_RESERVED = 0xa0;
772
        
773
        /**
774
         * Bit mask for digit shaping options.
775
         */
776
        public static final int DIGITS_MASK = 0xe0;
777
        
778
        /**
779
         * Digit type option: Use Arabic-Indic digits (U+0660...U+0669).
780
         */
781
        public static final int DIGIT_TYPE_AN = 0;
782
        
783
        /**
784
         * Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9).
785
         */
786
        public static final int DIGIT_TYPE_AN_EXTENDED = 0x100;
787
788
        /**
789
         * Bit mask for digit type options.
790
         */
791
        public static final int DIGIT_TYPE_MASK = 0x0100; // 0x3f00?
792
793
        static class charstruct {
794
            char basechar;
795
            char mark1;               /* has to be initialized to zero */
796
            char vowel;
797
            int lignum;           /* is a ligature with lignum aditional characters */
798
            int numshapes = 1;
799
        }
800
801
802
}

Mutations

60

1.1
Location : isVowel
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : isVowel
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : isVowel
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : isVowel
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : isVowel
Killed by : none
negated conditional → NO_COVERAGE

6.6
Location : isVowel
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

67

1.1
Location : charshape
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : charshape
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : charshape
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : charshape
Killed by : none
negated conditional → NO_COVERAGE

69

1.1
Location : charshape
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

70

1.1
Location : charshape
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : charshape
Killed by : none
negated conditional → NO_COVERAGE

71

1.1
Location : charshape
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : charshape
Killed by : none
Replaced integer division with multiplication → NO_COVERAGE

72

1.1
Location : charshape
Killed by : none
negated conditional → NO_COVERAGE

73

1.1
Location : charshape
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : charshape
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

75

1.1
Location : charshape
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : charshape
Killed by : none
negated conditional → NO_COVERAGE

76

1.1
Location : charshape
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

79

1.1
Location : charshape
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

83

1.1
Location : charshape
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : charshape
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : charshape
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : charshape
Killed by : none
negated conditional → NO_COVERAGE

84

1.1
Location : charshape
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : charshape
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

85

1.1
Location : charshape
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

90

1.1
Location : shapecount
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : shapecount
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : shapecount
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : shapecount
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : shapecount
Killed by : none
negated conditional → NO_COVERAGE

92

1.1
Location : shapecount
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

93

1.1
Location : shapecount
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : shapecount
Killed by : none
negated conditional → NO_COVERAGE

94

1.1
Location : shapecount
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : shapecount
Killed by : none
Replaced integer division with multiplication → NO_COVERAGE

95

1.1
Location : shapecount
Killed by : none
negated conditional → NO_COVERAGE

96

1.1
Location : shapecount
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : shapecount
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

98

1.1
Location : shapecount
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : shapecount
Killed by : none
negated conditional → NO_COVERAGE

99

1.1
Location : shapecount
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

102

1.1
Location : shapecount
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

106

1.1
Location : shapecount
Killed by : none
negated conditional → NO_COVERAGE

107

1.1
Location : shapecount
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

109

1.1
Location : shapecount
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

116

1.1
Location : ligature
Killed by : none
negated conditional → NO_COVERAGE

117

1.1
Location : ligature
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

118

1.1
Location : ligature
Killed by : none
negated conditional → NO_COVERAGE

120

1.1
Location : ligature
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : ligature
Killed by : none
negated conditional → NO_COVERAGE

125

1.1
Location : ligature
Killed by : none
negated conditional → NO_COVERAGE

129

1.1
Location : ligature
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

184

1.1
Location : ligature
Killed by : none
negated conditional → NO_COVERAGE

185

1.1
Location : ligature
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

187

1.1
Location : ligature
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

189

1.1
Location : ligature
Killed by : none
negated conditional → NO_COVERAGE

190

1.1
Location : ligature
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

224

1.1
Location : ligature
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

229

1.1
Location : copycstostring
Killed by : none
negated conditional → NO_COVERAGE

233

1.1
Location : copycstostring
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

234

1.1
Location : copycstostring
Killed by : none
negated conditional → NO_COVERAGE

235

1.1
Location : copycstostring
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : copycstostring
Killed by : none
negated conditional → NO_COVERAGE

237

1.1
Location : copycstostring
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

240

1.1
Location : copycstostring
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

243

1.1
Location : copycstostring
Killed by : none
negated conditional → NO_COVERAGE

244

1.1
Location : copycstostring
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : copycstostring
Killed by : none
negated conditional → NO_COVERAGE

246

1.1
Location : copycstostring
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

249

1.1
Location : copycstostring
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

269

1.1
Location : doublelig
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : doublelig
Killed by : none
negated conditional → NO_COVERAGE

271

1.1
Location : doublelig
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : doublelig
Killed by : none
negated conditional → NO_COVERAGE

293

1.1
Location : doublelig
Killed by : none
negated conditional → NO_COVERAGE

297

1.1
Location : doublelig
Killed by : none
negated conditional → NO_COVERAGE

301

1.1
Location : doublelig
Killed by : none
negated conditional → NO_COVERAGE

307

1.1
Location : doublelig
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : doublelig
Killed by : none
negated conditional → NO_COVERAGE

416

1.1
Location : doublelig
Killed by : none
negated conditional → NO_COVERAGE

417

1.1
Location : doublelig
Killed by : none
removed call to java/lang/StringBuffer::setCharAt → NO_COVERAGE

418

1.1
Location : doublelig
Killed by : none
Changed increment from -1 to 1 → NO_COVERAGE

419

1.1
Location : doublelig
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

423

1.1
Location : doublelig
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

424

1.1
Location : doublelig
Killed by : none
removed call to java/lang/StringBuffer::setCharAt → NO_COVERAGE

425

1.1
Location : doublelig
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

428

1.1
Location : doublelig
Killed by : none
removed call to java/lang/StringBuffer::setLength → NO_COVERAGE

432

1.1
Location : connects_to_left
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : connects_to_left
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : connects_to_left
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

450

1.1
Location : shape
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : shape
Killed by : none
negated conditional → NO_COVERAGE

451

1.1
Location : shape
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

455

1.1
Location : shape
Killed by : none
negated conditional → NO_COVERAGE

458

1.1
Location : shape
Killed by : none
negated conditional → NO_COVERAGE

464

1.1
Location : shape
Killed by : none
negated conditional → NO_COVERAGE

465

1.1
Location : shape
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

468

1.1
Location : shape
Killed by : none
Replaced integer modulus with multiplication → NO_COVERAGE

472

1.1
Location : shape
Killed by : none
removed call to com/lowagie/text/pdf/ArabicLigaturizer::copycstostring → NO_COVERAGE

479

1.1
Location : shape
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

482

1.1
Location : shape
Killed by : none
negated conditional → NO_COVERAGE

492

1.1
Location : shape
Killed by : none
negated conditional → NO_COVERAGE

496

1.1
Location : shape
Killed by : none
Replaced integer modulus with multiplication → NO_COVERAGE

500

1.1
Location : shape
Killed by : none
removed call to com/lowagie/text/pdf/ArabicLigaturizer::copycstostring → NO_COVERAGE

501

1.1
Location : shape
Killed by : none
removed call to com/lowagie/text/pdf/ArabicLigaturizer::copycstostring → NO_COVERAGE

506

1.1
Location : arabic_shape
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : arabic_shape
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : arabic_shape
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

4.4
Location : arabic_shape
Killed by : none
negated conditional → NO_COVERAGE

507

1.1
Location : arabic_shape
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : arabic_shape
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : arabic_shape
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

4.4
Location : arabic_shape
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

509

1.1
Location : arabic_shape
Killed by : none
removed call to com/lowagie/text/pdf/ArabicLigaturizer::shape → NO_COVERAGE

510

1.1
Location : arabic_shape
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : arabic_shape
Killed by : none
negated conditional → NO_COVERAGE

511

1.1
Location : arabic_shape
Killed by : none
removed call to com/lowagie/text/pdf/ArabicLigaturizer::doublelig → NO_COVERAGE

513

1.1
Location : arabic_shape
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

514

1.1
Location : arabic_shape
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

518

1.1
Location : processNumbers
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

519

1.1
Location : processNumbers
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : processNumbers
Killed by : none
negated conditional → NO_COVERAGE

521

1.1
Location : processNumbers
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

534

1.1
Location : processNumbers
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

536

1.1
Location : processNumbers
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

537

1.1
Location : processNumbers
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : processNumbers
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : processNumbers
Killed by : none
negated conditional → NO_COVERAGE

539

1.1
Location : processNumbers
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : processNumbers
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : processNumbers
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : processNumbers
Killed by : none
negated conditional → NO_COVERAGE

540

1.1
Location : processNumbers
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

547

1.1
Location : processNumbers
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

548

1.1
Location : processNumbers
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

549

1.1
Location : processNumbers
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : processNumbers
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : processNumbers
Killed by : none
negated conditional → NO_COVERAGE

551

1.1
Location : processNumbers
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : processNumbers
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : processNumbers
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : processNumbers
Killed by : none
negated conditional → NO_COVERAGE

552

1.1
Location : processNumbers
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

559

1.1
Location : processNumbers
Killed by : none
removed call to com/lowagie/text/pdf/ArabicLigaturizer::shapeToArabicDigitsWithContext → NO_COVERAGE

563

1.1
Location : processNumbers
Killed by : none
removed call to com/lowagie/text/pdf/ArabicLigaturizer::shapeToArabicDigitsWithContext → NO_COVERAGE

601

1.1
Location : shapeToArabicDigitsWithContext
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

603

1.1
Location : shapeToArabicDigitsWithContext
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

604

1.1
Location : shapeToArabicDigitsWithContext
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : shapeToArabicDigitsWithContext
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : shapeToArabicDigitsWithContext
Killed by : none
negated conditional → NO_COVERAGE

615

1.1
Location : shapeToArabicDigitsWithContext
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : shapeToArabicDigitsWithContext
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : shapeToArabicDigitsWithContext
Killed by : none
negated conditional → NO_COVERAGE

616

1.1
Location : shapeToArabicDigitsWithContext
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.4.2