BarcodeEAN.java

1
/*
2
 * Copyright 2002 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
import java.awt.Canvas;
50
import java.awt.Color;
51
import java.awt.Image;
52
import java.awt.image.MemoryImageSource;
53
import java.util.Arrays;
54
import com.lowagie.text.error_messages.MessageLocalization;
55
56
57
import com.lowagie.text.Rectangle;
58
import com.lowagie.text.ExceptionConverter;
59
60
/** Generates barcodes in several formats: EAN13, EAN8, UPCA, UPCE,
61
 * supplemental 2 and 5. The default parameters are:
62
 * <pre>
63
 *x = 0.8f;
64
 *font = BaseFont.createFont("Helvetica", "winansi", false);
65
 *size = 8;
66
 *baseline = size;
67
 *barHeight = size * 3;
68
 *guardBars = true;
69
 *codeType = EAN13;
70
 *code = "";
71
 * </pre>
72
 *
73
 * @author Paulo Soares (psoares@consiste.pt)
74
 */
75
public class BarcodeEAN extends Barcode{
76
77
    /**
78
     * The bar positions that are guard bars.
79
     */
80
    private static final int[] GUARD_EMPTY = {};
81
    /**
82
     * The bar positions that are guard bars.
83
     */
84
    private static final int[] GUARD_UPCA = {0, 2, 4, 6, 28, 30, 52, 54, 56, 58};
85
    /**
86
     * The bar positions that are guard bars.
87
     */
88
    private static final int[] GUARD_EAN13 = {0, 2, 28, 30, 56, 58};
89
    /**
90
     * The bar positions that are guard bars.
91
     */
92
    private static final int[] GUARD_EAN8 = {0, 2, 20, 22, 40, 42};
93
    /**
94
     * The bar positions that are guard bars.
95
     */
96
    private static final int[] GUARD_UPCE = {0, 2, 28, 30, 32};
97
    /**
98
     * The x coordinates to place the text.
99
     */
100
    private static final float[] TEXTPOS_EAN13 = {6.5f, 13.5f, 20.5f, 27.5f, 34.5f, 41.5f, 53.5f, 60.5f, 67.5f, 74.5f, 81.5f, 88.5f};
101
    /**
102
     * The x coordinates to place the text.
103
     */
104
    private static final float[] TEXTPOS_EAN8 = {6.5f, 13.5f, 20.5f, 27.5f, 39.5f, 46.5f, 53.5f, 60.5f};
105
    /**
106
     * The basic bar widths.
107
     */
108
    private static final byte[][] BARS =
109
            {
110
                    {3, 2, 1, 1}, // 0
111
                    {2, 2, 2, 1}, // 1
112
                    {2, 1, 2, 2}, // 2
113
                    {1, 4, 1, 1}, // 3
114
                    {1, 1, 3, 2}, // 4
115
                    {1, 2, 3, 1}, // 5
116
                    {1, 1, 1, 4}, // 6
117
                    {1, 3, 1, 2}, // 7
118
                    {1, 2, 1, 3}, // 8
119
                    {3, 1, 1, 2}  // 9
120
            };
121
    
122
    /** The total number of bars for EAN13.*/
123
    private static final int TOTALBARS_EAN13 = 11 + 12 * 4;
124
    /** The total number of bars for EAN8.*/
125
    private static final int TOTALBARS_EAN8 = 11 + 8 * 4;
126
    /** The total number of bars for UPCE.*/
127
    private static final int TOTALBARS_UPCE = 9 + 6 * 4;
128
    /** The total number of bars for supplemental 2.*/
129
    private static final int TOTALBARS_SUPP2 = 13;
130
    /** The total number of bars for supplemental 5.*/
131
    private static final int TOTALBARS_SUPP5 = 31;
132
    /** Marker for odd parity.*/
133
    private static final int ODD = 0;
134
    /** Marker for even parity.*/
135
    private static final int EVEN = 1;
136
137
    /**
138
     * Sequence of parities to be used with EAN13.
139
     */
140
    private static final byte[][] PARITY13 =
141
            {
142
                    {ODD, ODD, ODD, ODD, ODD, ODD},  // 0
143
                    {ODD, ODD, EVEN, ODD, EVEN, EVEN}, // 1
144
                    {ODD, ODD, EVEN, EVEN, ODD, EVEN}, // 2
145
                    {ODD, ODD, EVEN, EVEN, EVEN, ODD},  // 3
146
                    {ODD, EVEN, ODD, ODD, EVEN, EVEN}, // 4
147
                    {ODD, EVEN, EVEN, ODD, ODD, EVEN}, // 5
148
                    {ODD, EVEN, EVEN, EVEN, ODD, ODD},  // 6
149
                    {ODD, EVEN, ODD, EVEN, ODD, EVEN}, // 7
150
                    {ODD, EVEN, ODD, EVEN, EVEN, ODD},  // 8
151
                    {ODD, EVEN, EVEN, ODD, EVEN, ODD}   // 9
152
            };
153
154
    /**
155
     * Sequence of parities to be used with supplemental 2.
156
     */
157
    private static final byte[][] PARITY2 =
158
            {
159
                    {ODD, ODD},   // 0
160
                    {ODD, EVEN},  // 1
161
                    {EVEN, ODD},   // 2
162
                    {EVEN, EVEN}   // 3
163
            };
164
165
    /**
166
     * Sequence of parities to be used with supplemental 2.
167
     */
168
    private static final byte[][] PARITY5 =
169
            {
170
                    {EVEN, EVEN, ODD, ODD, ODD},  // 0
171
                    {EVEN, ODD, EVEN, ODD, ODD},  // 1
172
                    {EVEN, ODD, ODD, EVEN, ODD},  // 2
173
                    {EVEN, ODD, ODD, ODD, EVEN}, // 3
174
                    {ODD, EVEN, EVEN, ODD, ODD},  // 4
175
                    {ODD, ODD, EVEN, EVEN, ODD},  // 5
176
                    {ODD, ODD, ODD, EVEN, EVEN}, // 6
177
                    {ODD, EVEN, ODD, EVEN, ODD},  // 7
178
                    {ODD, EVEN, ODD, ODD, EVEN}, // 8
179
                    {ODD, ODD, EVEN, ODD, EVEN}  // 9
180
            };
181
182
    /**
183
     * Sequence of parities to be used with UPCE.
184
     */
185
    private static final byte[][] PARITYE =
186
            {
187
                    {EVEN, EVEN, EVEN, ODD, ODD, ODD},  // 0
188
                    {EVEN, EVEN, ODD, EVEN, ODD, ODD},  // 1
189
                    {EVEN, EVEN, ODD, ODD, EVEN, ODD},  // 2
190
                    {EVEN, EVEN, ODD, ODD, ODD, EVEN}, // 3
191
                    {EVEN, ODD, EVEN, EVEN, ODD, ODD},  // 4
192
                    {EVEN, ODD, ODD, EVEN, EVEN, ODD},  // 5
193
                    {EVEN, ODD, ODD, ODD, EVEN, EVEN}, // 6
194
                    {EVEN, ODD, EVEN, ODD, EVEN, ODD},  // 7
195
                    {EVEN, ODD, EVEN, ODD, ODD, EVEN}, // 8
196
                    {EVEN, ODD, ODD, EVEN, ODD, EVEN}  // 9
197
            };
198
    
199
    /** Creates new BarcodeEAN */
200
    public BarcodeEAN() {
201
        try {
202
            x = 0.8f;
203
            font = BaseFont.createFont("Helvetica", "winansi", false);
204
            size = 8;
205
            baseline = size;
206 1 1. : Replaced float multiplication with division → NO_COVERAGE
            barHeight = size * 3;
207
            guardBars = true;
208
            codeType = EAN13;
209
            code = "";
210
        }
211
        catch (Exception e) {
212
            throw new ExceptionConverter(e);
213
        }
214
    }
215
    
216
    /** Calculates the EAN parity character.
217
     * @param code the code
218
     * @return the parity character
219
     */    
220
    public static int calculateEANParity(String code) {
221
        int mul = 3;
222
        int total = 0;
223 4 1. calculateEANParity : changed conditional boundary → NO_COVERAGE
2. calculateEANParity : Changed increment from -1 to 1 → NO_COVERAGE
3. calculateEANParity : Replaced integer subtraction with addition → NO_COVERAGE
4. calculateEANParity : negated conditional → NO_COVERAGE
        for (int k = code.length() - 1; k >= 0; --k) {
224 1 1. calculateEANParity : Replaced integer subtraction with addition → NO_COVERAGE
            int n = code.charAt(k) - '0';
225 2 1. calculateEANParity : Replaced integer multiplication with division → NO_COVERAGE
2. calculateEANParity : Replaced integer addition with subtraction → NO_COVERAGE
            total += mul * n;
226 1 1. calculateEANParity : Replaced XOR with AND → NO_COVERAGE
            mul ^= 2;
227
        }
228 4 1. calculateEANParity : Replaced integer modulus with multiplication → NO_COVERAGE
2. calculateEANParity : Replaced integer subtraction with addition → NO_COVERAGE
3. calculateEANParity : Replaced integer modulus with multiplication → NO_COVERAGE
4. calculateEANParity : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return (10 - (total % 10)) % 10;
229
    }
230
    
231
    /** Converts an UPCA code into an UPCE code. If the code can not
232
     * be converted a <CODE>null</CODE> is returned.
233
     * @param text the code to convert. It must have 12 numeric characters
234
     * @return the 8 converted digits or <CODE>null</CODE> if the
235
     * code could not be converted
236
     */    
237
    static public String convertUPCAtoUPCE(String text) {
238 3 1. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
2. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
3. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
        if (text.length() != 12 || !(text.startsWith("0") || text.startsWith("1")))
239 1 1. convertUPCAtoUPCE : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return null;
240 2 1. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
2. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
        if (text.substring(3, 6).equals("000") || text.substring(3, 6).equals("100")
241 1 1. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
            || text.substring(3, 6).equals("200")) {
242 1 1. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
                if (text.substring(6, 8).equals("00"))
243 1 1. convertUPCAtoUPCE : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                    return text.substring(0, 1) + text.substring(1, 3) + text.substring(8, 11) + text.substring(3, 4) + text.substring(11);
244
        }
245 1 1. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
        else if (text.substring(4, 6).equals("00")) {
246 1 1. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
            if (text.substring(6, 9).equals("000"))
247 1 1. convertUPCAtoUPCE : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return text.substring(0, 1) + text.substring(1, 4) + text.substring(9, 11) + "3" + text.substring(11);
248
        }
249 1 1. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
        else if (text.substring(5, 6).equals("0")) {
250 1 1. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
            if (text.substring(6, 10).equals("0000"))
251 1 1. convertUPCAtoUPCE : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return text.substring(0, 1) + text.substring(1, 5) + text.substring(10, 11) + "4" + text.substring(11);
252
        }
253 2 1. convertUPCAtoUPCE : changed conditional boundary → NO_COVERAGE
2. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
        else if (text.charAt(10) >= '5') {
254 1 1. convertUPCAtoUPCE : negated conditional → NO_COVERAGE
            if (text.substring(6, 10).equals("0000"))
255 1 1. convertUPCAtoUPCE : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return text.substring(0, 1) + text.substring(1, 6) + text.substring(10, 11) + text.substring(11);
256
        }
257 1 1. convertUPCAtoUPCE : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return null;
258
    }
259
    
260
    /** Creates the bars for the barcode EAN13 and UPCA.
261
     * @param _code the text with 13 digits
262
     * @return the barcode
263
     */    
264
    public static byte[] getBarsEAN13(String _code) {
265
        int[] code = new int[_code.length()];
266 2 1. getBarsEAN13 : changed conditional boundary → NO_COVERAGE
2. getBarsEAN13 : negated conditional → NO_COVERAGE
        for (int k = 0; k < code.length; ++k)
267 1 1. getBarsEAN13 : Replaced integer subtraction with addition → NO_COVERAGE
            code[k] = _code.charAt(k) - '0';
268
        byte[] bars = new byte[TOTALBARS_EAN13];
269
        int pb = 0;
270 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
271 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
272 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
273
        byte[] sequence = PARITY13[code[0]];
274 3 1. getBarsEAN13 : changed conditional boundary → NO_COVERAGE
2. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
3. getBarsEAN13 : negated conditional → NO_COVERAGE
        for (int k = 0; k < sequence.length; ++k) {
275 1 1. getBarsEAN13 : Replaced integer addition with subtraction → NO_COVERAGE
            int c = code[k + 1];
276
            byte[] stripes = BARS[c];
277 1 1. getBarsEAN13 : negated conditional → NO_COVERAGE
            if (sequence[k] == ODD) {
278 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[0];
279 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[1];
280 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[2];
281 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[3];
282
            }
283
            else {
284 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[3];
285 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[2];
286 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[1];
287 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[0];
288
            }
289
        }
290 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
291 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
292 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
293 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
294 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
295 3 1. getBarsEAN13 : changed conditional boundary → NO_COVERAGE
2. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
3. getBarsEAN13 : negated conditional → NO_COVERAGE
        for (int k = 7; k < 13; ++k) {
296
            int c = code[k];
297
            byte[] stripes = BARS[c];
298 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[0];
299 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[1];
300 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[2];
301 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[3];
302
        }
303 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
304 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
305 1 1. getBarsEAN13 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
306 1 1. getBarsEAN13 : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarsEAN13 to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return bars;
307
    }
308
    
309
    /** Creates the bars for the barcode EAN8.
310
     * @param _code the text with 8 digits
311
     * @return the barcode
312
     */    
313
    public static byte[] getBarsEAN8(String _code) {
314
        int[] code = new int[_code.length()];
315 2 1. getBarsEAN8 : changed conditional boundary → NO_COVERAGE
2. getBarsEAN8 : negated conditional → NO_COVERAGE
        for (int k = 0; k < code.length; ++k)
316 1 1. getBarsEAN8 : Replaced integer subtraction with addition → NO_COVERAGE
            code[k] = _code.charAt(k) - '0';
317
        byte[] bars = new byte[TOTALBARS_EAN8];
318
        int pb = 0;
319 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
320 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
321 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
322 3 1. getBarsEAN8 : changed conditional boundary → NO_COVERAGE
2. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
3. getBarsEAN8 : negated conditional → NO_COVERAGE
        for (int k = 0; k < 4; ++k) {
323
            int c = code[k];
324
            byte[] stripes = BARS[c];
325 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[0];
326 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[1];
327 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[2];
328 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[3];
329
        }
330 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
331 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
332 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
333 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
334 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
335 3 1. getBarsEAN8 : changed conditional boundary → NO_COVERAGE
2. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
3. getBarsEAN8 : negated conditional → NO_COVERAGE
        for (int k = 4; k < 8; ++k) {
336
            int c = code[k];
337
            byte[] stripes = BARS[c];
338 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[0];
339 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[1];
340 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[2];
341 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
            bars[pb++] = stripes[3];
342
        }
343 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
344 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
345 1 1. getBarsEAN8 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
346 1 1. getBarsEAN8 : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarsEAN8 to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return bars;
347
    }
348
    
349
    /** Creates the bars for the barcode UPCE.
350
     * @param _code the text with 8 digits
351
     * @return the barcode
352
     */    
353
    public static byte[] getBarsUPCE(String _code) {
354
        int[] code = new int[_code.length()];
355 2 1. getBarsUPCE : changed conditional boundary → NO_COVERAGE
2. getBarsUPCE : negated conditional → NO_COVERAGE
        for (int k = 0; k < code.length; ++k)
356 1 1. getBarsUPCE : Replaced integer subtraction with addition → NO_COVERAGE
            code[k] = _code.charAt(k) - '0';
357
        byte[] bars = new byte[TOTALBARS_UPCE];
358 1 1. getBarsUPCE : negated conditional → NO_COVERAGE
        boolean flip = (code[0] != 0);
359
        int pb = 0;
360 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
361 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
362 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
363 1 1. getBarsUPCE : Replaced integer subtraction with addition → NO_COVERAGE
        byte[] sequence = PARITYE[code[code.length - 1]];
364 4 1. getBarsUPCE : changed conditional boundary → NO_COVERAGE
2. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
3. getBarsUPCE : Replaced integer subtraction with addition → NO_COVERAGE
4. getBarsUPCE : negated conditional → NO_COVERAGE
        for (int k = 1; k < code.length - 1; ++k) {
365
            int c = code[k];
366
            byte[] stripes = BARS[c];
367 3 1. getBarsUPCE : Replaced integer subtraction with addition → NO_COVERAGE
2. getBarsUPCE : negated conditional → NO_COVERAGE
3. getBarsUPCE : negated conditional → NO_COVERAGE
            if (sequence[k - 1] == (flip ? EVEN : ODD)) {
368 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[0];
369 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[1];
370 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[2];
371 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[3];
372
            }
373
            else {
374 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[3];
375 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[2];
376 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[1];
377 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[0];
378
            }
379
        }
380 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
381 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
382 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
383 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
384 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
385 1 1. getBarsUPCE : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
386 1 1. getBarsUPCE : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarsUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return bars;
387
    }
388
389
    /** Creates the bars for the barcode supplemental 2.
390
     * @param _code the text with 2 digits
391
     * @return the barcode
392
     */    
393
    public static byte[] getBarsSupplemental2(String _code) {
394
        int[] code = new int[2];
395 2 1. getBarsSupplemental2 : changed conditional boundary → NO_COVERAGE
2. getBarsSupplemental2 : negated conditional → NO_COVERAGE
        for (int k = 0; k < code.length; ++k)
396 1 1. getBarsSupplemental2 : Replaced integer subtraction with addition → NO_COVERAGE
            code[k] = _code.charAt(k) - '0';
397
        byte[] bars = new byte[TOTALBARS_SUPP2];
398
        int pb = 0;
399 3 1. getBarsSupplemental2 : Replaced integer multiplication with division → NO_COVERAGE
2. getBarsSupplemental2 : Replaced integer addition with subtraction → NO_COVERAGE
3. getBarsSupplemental2 : Replaced integer modulus with multiplication → NO_COVERAGE
        int parity = (code[0] * 10 + code[1]) % 4;
400 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
401 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
402 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 2;
403
        byte[] sequence = PARITY2[parity];
404 3 1. getBarsSupplemental2 : changed conditional boundary → NO_COVERAGE
2. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
3. getBarsSupplemental2 : negated conditional → NO_COVERAGE
        for (int k = 0; k < sequence.length; ++k) {
405 1 1. getBarsSupplemental2 : negated conditional → NO_COVERAGE
            if (k == 1) {
406 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = 1;
407 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = 1;
408
            }
409
            int c = code[k];
410
            byte[] stripes = BARS[c];
411 1 1. getBarsSupplemental2 : negated conditional → NO_COVERAGE
            if (sequence[k] == ODD) {
412 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[0];
413 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[1];
414 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[2];
415 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[3];
416
            }
417
            else {
418 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[3];
419 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[2];
420 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[1];
421 1 1. getBarsSupplemental2 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[0];
422
            }
423
        }
424 1 1. getBarsSupplemental2 : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarsSupplemental2 to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return bars;
425
    }   
426
427
    /** Creates the bars for the barcode supplemental 5.
428
     * @param _code the text with 5 digits
429
     * @return the barcode
430
     */    
431
    public static byte[] getBarsSupplemental5(String _code) {
432
        int[] code = new int[5];
433 2 1. getBarsSupplemental5 : changed conditional boundary → NO_COVERAGE
2. getBarsSupplemental5 : negated conditional → NO_COVERAGE
        for (int k = 0; k < code.length; ++k)
434 1 1. getBarsSupplemental5 : Replaced integer subtraction with addition → NO_COVERAGE
            code[k] = _code.charAt(k) - '0';
435
        byte[] bars = new byte[TOTALBARS_SUPP5];
436
        int pb = 0;
437 7 1. getBarsSupplemental5 : Replaced integer addition with subtraction → NO_COVERAGE
2. getBarsSupplemental5 : Replaced integer addition with subtraction → NO_COVERAGE
3. getBarsSupplemental5 : Replaced integer multiplication with division → NO_COVERAGE
4. getBarsSupplemental5 : Replaced integer addition with subtraction → NO_COVERAGE
5. getBarsSupplemental5 : Replaced integer multiplication with division → NO_COVERAGE
6. getBarsSupplemental5 : Replaced integer addition with subtraction → NO_COVERAGE
7. getBarsSupplemental5 : Replaced integer modulus with multiplication → NO_COVERAGE
        int parity = (((code[0] + code[2] + code[4]) * 3) + ((code[1] + code[3]) * 9)) % 10;
438 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
439 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
440 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 2;
441
        byte[] sequence = PARITY5[parity];
442 3 1. getBarsSupplemental5 : changed conditional boundary → NO_COVERAGE
2. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
3. getBarsSupplemental5 : negated conditional → NO_COVERAGE
        for (int k = 0; k < sequence.length; ++k) {
443 1 1. getBarsSupplemental5 : negated conditional → NO_COVERAGE
            if (k != 0) {
444 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = 1;
445 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = 1;
446
            }
447
            int c = code[k];
448
            byte[] stripes = BARS[c];
449 1 1. getBarsSupplemental5 : negated conditional → NO_COVERAGE
            if (sequence[k] == ODD) {
450 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[0];
451 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[1];
452 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[2];
453 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[3];
454
            }
455
            else {
456 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[3];
457 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[2];
458 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[1];
459 1 1. getBarsSupplemental5 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = stripes[0];
460
            }
461
        }
462 1 1. getBarsSupplemental5 : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarsSupplemental5 to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return bars;
463
    }   
464
    
465
    /** Gets the maximum area that the barcode and the text, if
466
     * any, will occupy. The lower left corner is always (0, 0).
467
     * @return the size the barcode occupies.
468
     */    
469
    public Rectangle getBarcodeSize() {
470
        float width = 0;
471
        float height = barHeight;
472 1 1. getBarcodeSize : negated conditional → NO_COVERAGE
        if (font != null) {
473 2 1. getBarcodeSize : changed conditional boundary → NO_COVERAGE
2. getBarcodeSize : negated conditional → NO_COVERAGE
            if (baseline <= 0)
474 3 1. getBarcodeSize : removed negation → NO_COVERAGE
2. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
3. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
                height += -baseline + size;
475
            else
476 2 1. getBarcodeSize : Replaced float subtraction with addition → NO_COVERAGE
2. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
                height += baseline - font.getFontDescriptor(BaseFont.DESCENT, size);
477
        }
478
        switch (codeType) {
479
            case EAN13:
480 1 1. getBarcodeSize : Replaced float multiplication with division → NO_COVERAGE
                width = x * (11 + 12 * 7);
481 1 1. getBarcodeSize : negated conditional → NO_COVERAGE
                if (font != null) {
482 1 1. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
                    width += font.getWidthPoint(code.charAt(0), size);
483
                }
484
                break;
485
            case EAN8:
486 1 1. getBarcodeSize : Replaced float multiplication with division → NO_COVERAGE
                width = x * (11 + 8 * 7);
487
                break;
488
            case UPCA:
489 1 1. getBarcodeSize : Replaced float multiplication with division → NO_COVERAGE
                width = x * (11 + 12 * 7);
490 1 1. getBarcodeSize : negated conditional → NO_COVERAGE
                if (font != null) {
491 2 1. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
2. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
                    width += font.getWidthPoint(code.charAt(0), size) + font.getWidthPoint(code.charAt(11), size);
492
                }
493
                break;
494
            case UPCE:
495 1 1. getBarcodeSize : Replaced float multiplication with division → NO_COVERAGE
                width = x * (9 + 6 * 7);
496 1 1. getBarcodeSize : negated conditional → NO_COVERAGE
                if (font != null) {
497 2 1. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
2. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
                    width += font.getWidthPoint(code.charAt(0), size) + font.getWidthPoint(code.charAt(7), size);
498
                }
499
                break;
500
            case SUPP2:
501 1 1. getBarcodeSize : Replaced float multiplication with division → NO_COVERAGE
                width = x * (6 + 2 * 7);
502
                break;
503
            case SUPP5:
504 1 1. getBarcodeSize : Replaced float multiplication with division → NO_COVERAGE
                width = x * (4 + 5 * 7 + 4 * 2);
505
                break;
506
            default:
507
                throw new RuntimeException(MessageLocalization.getComposedMessage("invalid.code.type"));
508
        }
509 1 1. getBarcodeSize : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarcodeSize to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return new Rectangle(width, height);
510
    }
511
    
512
    /** Places the barcode in a <CODE>PdfContentByte</CODE>. The
513
     * barcode is always placed at coordinates (0, 0). Use the
514
     * translation matrix to move it elsewhere.<p>
515
     * The bars and text are written in the following colors:<p>
516
     * <P><TABLE BORDER=1>
517
     * <TR>
518
     *    <TH><P><CODE>barColor</CODE></TH>
519
     *    <TH><P><CODE>textColor</CODE></TH>
520
     *    <TH><P>Result</TH>
521
     *    </TR>
522
     * <TR>
523
     *    <TD><P><CODE>null</CODE></TD>
524
     *    <TD><P><CODE>null</CODE></TD>
525
     *    <TD><P>bars and text painted with current fill color</TD>
526
     *    </TR>
527
     * <TR>
528
     *    <TD><P><CODE>barColor</CODE></TD>
529
     *    <TD><P><CODE>null</CODE></TD>
530
     *    <TD><P>bars and text painted with <CODE>barColor</CODE></TD>
531
     *    </TR>
532
     * <TR>
533
     *    <TD><P><CODE>null</CODE></TD>
534
     *    <TD><P><CODE>textColor</CODE></TD>
535
     *    <TD><P>bars painted with current color<br>text painted with <CODE>textColor</CODE></TD>
536
     *    </TR>
537
     * <TR>
538
     *    <TD><P><CODE>barColor</CODE></TD>
539
     *    <TD><P><CODE>textColor</CODE></TD>
540
     *    <TD><P>bars painted with <CODE>barColor</CODE><br>text painted with <CODE>textColor</CODE></TD>
541
     *    </TR>
542
     * </TABLE>
543
     * @param cb the <CODE>PdfContentByte</CODE> where the barcode will be placed
544
     * @param barColor the color of the bars. It can be <CODE>null</CODE>
545
     * @param textColor the color of the text. It can be <CODE>null</CODE>
546
     * @return the dimensions the barcode occupies
547
     */    
548
    public Rectangle placeBarcode(PdfContentByte cb, Color barColor, Color textColor) {
549
        Rectangle rect = getBarcodeSize();
550
        float barStartX = 0;
551
        float barStartY = 0;
552
        float textStartY = 0;
553 1 1. placeBarcode : negated conditional → NO_COVERAGE
        if (font != null) {
554 2 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
            if (baseline <= 0)
555 1 1. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
                textStartY = barHeight - baseline;
556
            else {
557 1 1. placeBarcode : removed negation → NO_COVERAGE
                textStartY = -font.getFontDescriptor(BaseFont.DESCENT, size);
558 1 1. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
                barStartY = textStartY + baseline;
559
            }
560
        }
561
        switch (codeType) {
562
            case EAN13:
563
            case UPCA:
564
            case UPCE:
565 1 1. placeBarcode : negated conditional → NO_COVERAGE
                if (font != null)
566 1 1. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
                    barStartX += font.getWidthPoint(code.charAt(0), size);
567
                break;
568
        }
569
        byte[] bars = null;
570
        int[] guard = GUARD_EMPTY;
571
        switch (codeType) {
572
            case EAN13:
573
                bars = getBarsEAN13(code);
574
                guard = GUARD_EAN13;
575
                break;
576
            case EAN8:
577
                bars = getBarsEAN8(code);
578
                guard = GUARD_EAN8;
579
                break;
580
            case UPCA:
581
                bars = getBarsEAN13("0" + code);
582
                guard = GUARD_UPCA;
583
                break;
584
            case UPCE:
585
                bars = getBarsUPCE(code);
586
                guard = GUARD_UPCE;
587
                break;
588
            case SUPP2:
589
                bars = getBarsSupplemental2(code);
590
                break;
591
            case SUPP5:
592
                bars = getBarsSupplemental5(code);
593
                break;
594
        }
595
        float keepBarX = barStartX;
596
        boolean print = true;
597
        float gd = 0;
598 4 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
3. placeBarcode : negated conditional → NO_COVERAGE
4. placeBarcode : negated conditional → NO_COVERAGE
        if (font != null && baseline > 0 && guardBars) {
599 1 1. placeBarcode : Replaced float division with multiplication → NO_COVERAGE
            gd = baseline / 2;
600
        }
601 1 1. placeBarcode : negated conditional → NO_COVERAGE
        if (barColor != null)
602 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE
            cb.setColorFill(barColor);
603 3 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : Changed increment from 1 to -1 → NO_COVERAGE
3. placeBarcode : negated conditional → NO_COVERAGE
        for (int k = 0; k < bars.length; ++k) {
604 1 1. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
            float w = bars[k] * x;
605 1 1. placeBarcode : negated conditional → NO_COVERAGE
            if (print) {
606 2 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
                if (Arrays.binarySearch(guard, k) >= 0)
607 4 1. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
2. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
3. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
4. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE
                    cb.rectangle(barStartX, barStartY - gd, w - inkSpreading, barHeight + gd);
608
                else
609 2 1. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
2. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE
                    cb.rectangle(barStartX, barStartY, w - inkSpreading, barHeight);
610
            }
611 1 1. placeBarcode : negated conditional → NO_COVERAGE
            print = !print;
612 1 1. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
            barStartX += w;
613
        }
614 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE
        cb.fill();
615 1 1. placeBarcode : negated conditional → NO_COVERAGE
        if (font != null) {
616 1 1. placeBarcode : negated conditional → NO_COVERAGE
            if (textColor != null)
617 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE
                cb.setColorFill(textColor);
618 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::beginText → NO_COVERAGE
            cb.beginText();
619 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setFontAndSize → NO_COVERAGE
            cb.setFontAndSize(font, size);
620
            switch (codeType) {
621
                case EAN13:
622 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE
                    cb.setTextMatrix(0, textStartY);
623 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE
                    cb.showText(code.substring(0, 1));
624 2 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
                    for (int k = 1; k < 13; ++k) {
625 1 1. placeBarcode : Replaced integer addition with subtraction → NO_COVERAGE
                        String c = code.substring(k, k + 1);
626
                        float len = font.getWidthPoint(c, size);
627 5 1. placeBarcode : Replaced integer subtraction with addition → NO_COVERAGE
2. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
3. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
4. placeBarcode : Replaced float division with multiplication → NO_COVERAGE
5. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
                        float pX = keepBarX + TEXTPOS_EAN13[k - 1] * x - len / 2;
628 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE
                        cb.setTextMatrix(pX, textStartY);
629 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE
                        cb.showText(c);
630
                    }
631
                    break;
632
                case EAN8:
633 2 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
                    for (int k = 0; k < 8; ++k) {
634 1 1. placeBarcode : Replaced integer addition with subtraction → NO_COVERAGE
                        String c = code.substring(k, k + 1);
635
                        float len = font.getWidthPoint(c, size);
636 3 1. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
2. placeBarcode : Replaced float division with multiplication → NO_COVERAGE
3. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
                        float pX = TEXTPOS_EAN8[k] * x - len / 2;
637 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE
                        cb.setTextMatrix(pX, textStartY);
638 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE
                        cb.showText(c);
639
                    }
640
                    break;
641
                case UPCA:
642 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE
                    cb.setTextMatrix(0, textStartY);
643 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE
                    cb.showText(code.substring(0, 1));
644 2 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
                    for (int k = 1; k < 11; ++k) {
645 1 1. placeBarcode : Replaced integer addition with subtraction → NO_COVERAGE
                        String c = code.substring(k, k + 1);
646
                        float len = font.getWidthPoint(c, size);
647 4 1. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
2. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
3. placeBarcode : Replaced float division with multiplication → NO_COVERAGE
4. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
                        float pX = keepBarX + TEXTPOS_EAN13[k] * x - len / 2;
648 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE
                        cb.setTextMatrix(pX, textStartY);
649 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE
                        cb.showText(c);
650
                    }
651 3 1. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
2. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
3. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE
                    cb.setTextMatrix(keepBarX + x * (11 + 12 * 7), textStartY);
652 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE
                    cb.showText(code.substring(11, 12));
653
                    break;
654
                case UPCE:
655 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE
                    cb.setTextMatrix(0, textStartY);
656 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE
                    cb.showText(code.substring(0, 1));
657 2 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
                    for (int k = 1; k < 7; ++k) {
658 1 1. placeBarcode : Replaced integer addition with subtraction → NO_COVERAGE
                        String c = code.substring(k, k + 1);
659
                        float len = font.getWidthPoint(c, size);
660 5 1. placeBarcode : Replaced integer subtraction with addition → NO_COVERAGE
2. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
3. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
4. placeBarcode : Replaced float division with multiplication → NO_COVERAGE
5. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
                        float pX = keepBarX + TEXTPOS_EAN13[k - 1] * x - len / 2;
661 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE
                        cb.setTextMatrix(pX, textStartY);
662 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE
                        cb.showText(c);
663
                    }
664 3 1. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
2. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
3. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE
                    cb.setTextMatrix(keepBarX + x * (9 + 6 * 7), textStartY);
665 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE
                    cb.showText(code.substring(7, 8));
666
                    break;
667
                case SUPP2:
668
                case SUPP5:
669 2 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
                    for (int k = 0; k < code.length(); ++k) {
670 1 1. placeBarcode : Replaced integer addition with subtraction → NO_COVERAGE
                        String c = code.substring(k, k + 1);
671
                        float len = font.getWidthPoint(c, size);
672 5 1. placeBarcode : Replaced integer multiplication with division → NO_COVERAGE
2. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
3. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
4. placeBarcode : Replaced float division with multiplication → NO_COVERAGE
5. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
                        float pX = (7.5f + (9 * k)) * x - len / 2;
673 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE
                        cb.setTextMatrix(pX, textStartY);
674 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE
                        cb.showText(c);
675
                    }
676
                    break;
677
            }
678 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::endText → NO_COVERAGE
            cb.endText();
679
        }
680 1 1. placeBarcode : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::placeBarcode to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return rect;
681
    }
682
    
683
    /** Creates a <CODE>java.awt.Image</CODE>. This image only
684
     * contains the bars without any text.
685
     * @param foreground the color of the bars
686
     * @param background the color of the background
687
     * @return the image
688
     */    
689
    public java.awt.Image createAwtImage(Color foreground, Color background) {
690
        int f = foreground.getRGB();
691
        int g = background.getRGB();
692
        Canvas canvas = new Canvas();
693
694
        int width = 0;
695
        byte[] bars = null;
696
        switch (codeType) {
697
            case EAN13:
698
                bars = getBarsEAN13(code);
699
                width = 11 + 12 * 7;
700
                break;
701
            case EAN8:
702
                bars = getBarsEAN8(code);
703
                width = 11 + 8 * 7;
704
                break;
705
            case UPCA:
706
                bars = getBarsEAN13("0" + code);
707
                width = 11 + 12 * 7;
708
                break;
709
            case UPCE:
710
                bars = getBarsUPCE(code);
711
                width = 9 + 6 * 7;
712
                break;
713
            case SUPP2:
714
                bars = getBarsSupplemental2(code);
715
                width = 6 + 2 * 7;
716
                break;
717
            case SUPP5:
718
                bars = getBarsSupplemental5(code);
719
                width = 4 + 5 * 7 + 4 * 2;
720
                break;
721
            default:
722
                throw new RuntimeException(MessageLocalization.getComposedMessage("invalid.code.type"));
723
        }
724
725
        boolean print = true;
726
        int ptr = 0;
727
        int height = (int)barHeight;
728 1 1. createAwtImage : Replaced integer multiplication with division → NO_COVERAGE
        int[] pix = new int[width * height];
729
        for (int w : bars) {
730
            int c = g;
731 1 1. createAwtImage : negated conditional → NO_COVERAGE
            if (print)
732
                c = f;
733 1 1. createAwtImage : negated conditional → NO_COVERAGE
            print = !print;
734 3 1. createAwtImage : changed conditional boundary → NO_COVERAGE
2. createAwtImage : Changed increment from 1 to -1 → NO_COVERAGE
3. createAwtImage : negated conditional → NO_COVERAGE
            for (int j = 0; j < w; ++j)
735 1 1. createAwtImage : Changed increment from 1 to -1 → NO_COVERAGE
                pix[ptr++] = c;
736
        }
737 3 1. createAwtImage : changed conditional boundary → NO_COVERAGE
2. createAwtImage : Replaced integer addition with subtraction → NO_COVERAGE
3. createAwtImage : negated conditional → NO_COVERAGE
        for (int k = width; k < pix.length; k += width) {
738 1 1. createAwtImage : removed call to java/lang/System::arraycopy → NO_COVERAGE
            System.arraycopy(pix, 0, pix, k, width); 
739
        }
740
        Image img = canvas.createImage(new MemoryImageSource(width, height, pix, 0, width));
741
        
742 1 1. createAwtImage : mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::createAwtImage to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return img;
743
    }    
744
}

Mutations

206

1.1
Location :
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

223

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

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

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

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

224

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

225

1.1
Location : calculateEANParity
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

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

226

1.1
Location : calculateEANParity
Killed by : none
Replaced XOR with AND → NO_COVERAGE

228

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

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

3.3
Location : calculateEANParity
Killed by : none
Replaced integer modulus with multiplication → NO_COVERAGE

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

238

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

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

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

239

1.1
Location : convertUPCAtoUPCE
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

240

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

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

241

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

242

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

243

1.1
Location : convertUPCAtoUPCE
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

245

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

246

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

247

1.1
Location : convertUPCAtoUPCE
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

249

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

250

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

251

1.1
Location : convertUPCAtoUPCE
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

253

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

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

254

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

255

1.1
Location : convertUPCAtoUPCE
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

257

1.1
Location : convertUPCAtoUPCE
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::convertUPCAtoUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

266

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

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

267

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

270

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

271

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

272

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

274

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

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

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

275

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

277

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

278

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

279

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

280

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

281

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

284

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

285

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

286

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

287

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

290

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

291

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

292

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

293

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

294

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

295

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

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

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

298

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

299

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

300

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

301

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

303

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

304

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

305

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

306

1.1
Location : getBarsEAN13
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarsEAN13 to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

315

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

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

316

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

319

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

320

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

321

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

322

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

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

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

325

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

326

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

327

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

328

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

330

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

331

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

332

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

333

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

334

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

335

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

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

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

338

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

339

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

340

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

341

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

343

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

344

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

345

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

346

1.1
Location : getBarsEAN8
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarsEAN8 to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

355

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

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

356

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

358

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

360

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

361

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

362

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

363

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

364

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

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

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

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

367

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

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

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

368

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

369

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

370

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

371

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

374

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

375

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

376

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

377

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

380

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

381

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

382

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

383

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

384

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

385

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

386

1.1
Location : getBarsUPCE
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarsUPCE to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

395

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

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

396

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

399

1.1
Location : getBarsSupplemental2
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

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

3.3
Location : getBarsSupplemental2
Killed by : none
Replaced integer modulus with multiplication → NO_COVERAGE

400

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

401

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

402

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

404

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

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

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

405

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

406

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

407

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

411

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

412

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

413

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

414

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

415

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

418

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

419

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

420

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

421

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

424

1.1
Location : getBarsSupplemental2
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarsSupplemental2 to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

433

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

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

434

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

437

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

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

3.3
Location : getBarsSupplemental5
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

4.4
Location : getBarsSupplemental5
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

5.5
Location : getBarsSupplemental5
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

6.6
Location : getBarsSupplemental5
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

7.7
Location : getBarsSupplemental5
Killed by : none
Replaced integer modulus with multiplication → NO_COVERAGE

438

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

439

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

440

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

442

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

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

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

443

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

444

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

445

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

449

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

450

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

451

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

452

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

453

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

456

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

457

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

458

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

459

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

462

1.1
Location : getBarsSupplemental5
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarsSupplemental5 to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

472

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

473

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

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

474

1.1
Location : getBarcodeSize
Killed by : none
removed negation → NO_COVERAGE

2.2
Location : getBarcodeSize
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

3.3
Location : getBarcodeSize
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

476

1.1
Location : getBarcodeSize
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

2.2
Location : getBarcodeSize
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

480

1.1
Location : getBarcodeSize
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

481

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

482

1.1
Location : getBarcodeSize
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

486

1.1
Location : getBarcodeSize
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

489

1.1
Location : getBarcodeSize
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

490

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

491

1.1
Location : getBarcodeSize
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

2.2
Location : getBarcodeSize
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

495

1.1
Location : getBarcodeSize
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

496

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

497

1.1
Location : getBarcodeSize
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

2.2
Location : getBarcodeSize
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

501

1.1
Location : getBarcodeSize
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

504

1.1
Location : getBarcodeSize
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

509

1.1
Location : getBarcodeSize
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::getBarcodeSize to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

553

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

554

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

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

555

1.1
Location : placeBarcode
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

557

1.1
Location : placeBarcode
Killed by : none
removed negation → NO_COVERAGE

558

1.1
Location : placeBarcode
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

565

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

566

1.1
Location : placeBarcode
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

598

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

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

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

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

599

1.1
Location : placeBarcode
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

601

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

602

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE

603

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

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

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

604

1.1
Location : placeBarcode
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

605

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

606

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

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

607

1.1
Location : placeBarcode
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

2.2
Location : placeBarcode
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

3.3
Location : placeBarcode
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

4.4
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE

609

1.1
Location : placeBarcode
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

2.2
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE

611

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

612

1.1
Location : placeBarcode
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

614

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE

615

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

616

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

617

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE

618

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::beginText → NO_COVERAGE

619

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setFontAndSize → NO_COVERAGE

622

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE

623

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE

624

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

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

625

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

627

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

2.2
Location : placeBarcode
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

3.3
Location : placeBarcode
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

4.4
Location : placeBarcode
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

5.5
Location : placeBarcode
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

628

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE

629

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE

633

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

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

634

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

636

1.1
Location : placeBarcode
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

2.2
Location : placeBarcode
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

3.3
Location : placeBarcode
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

637

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE

638

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE

642

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE

643

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE

644

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

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

645

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

647

1.1
Location : placeBarcode
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

2.2
Location : placeBarcode
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

3.3
Location : placeBarcode
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

4.4
Location : placeBarcode
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

648

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE

649

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE

651

1.1
Location : placeBarcode
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

2.2
Location : placeBarcode
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

3.3
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE

652

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE

655

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE

656

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE

657

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

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

658

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

660

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

2.2
Location : placeBarcode
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

3.3
Location : placeBarcode
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

4.4
Location : placeBarcode
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

5.5
Location : placeBarcode
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

661

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE

662

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE

664

1.1
Location : placeBarcode
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

2.2
Location : placeBarcode
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

3.3
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE

665

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE

669

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

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

670

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

672

1.1
Location : placeBarcode
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

2.2
Location : placeBarcode
Killed by : none
Replaced float addition with subtraction → NO_COVERAGE

3.3
Location : placeBarcode
Killed by : none
Replaced float multiplication with division → NO_COVERAGE

4.4
Location : placeBarcode
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

5.5
Location : placeBarcode
Killed by : none
Replaced float subtraction with addition → NO_COVERAGE

673

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE

674

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE

678

1.1
Location : placeBarcode
Killed by : none
removed call to com/lowagie/text/pdf/PdfContentByte::endText → NO_COVERAGE

680

1.1
Location : placeBarcode
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::placeBarcode to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

728

1.1
Location : createAwtImage
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

731

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

733

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

734

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

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

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

735

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

737

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

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

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

738

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

742

1.1
Location : createAwtImage
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/BarcodeEAN::createAwtImage to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.4.2