BarcodeInter25.java

1
/*
2
 * $Id: BarcodeInter25.java 4065 2009-09-16 23:09:11Z psoares33 $
3
 *
4
 * Copyright 2002-2006 by Paulo Soares.
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * (the "License"); you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the License.
13
 *
14
 * The Original Code is 'iText, a free JAVA-PDF library'.
15
 *
16
 * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
17
 * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
18
 * All Rights Reserved.
19
 * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
20
 * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
21
 *
22
 * Contributor(s): all the names of the contributors are added in the source code
23
 * where applicable.
24
 *
25
 * Alternatively, the contents of this file may be used under the terms of the
26
 * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
27
 * provisions of LGPL are applicable instead of those above.  If you wish to
28
 * allow use of your version of this file only under the terms of the LGPL
29
 * License and not to allow others to use your version of this file under
30
 * the MPL, indicate your decision by deleting the provisions above and
31
 * replace them with the notice and other provisions required by the LGPL.
32
 * If you do not delete the provisions above, a recipient may use your version
33
 * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
34
 *
35
 * This library is free software; you can redistribute it and/or modify it
36
 * under the terms of the MPL as stated above or under the terms of the GNU
37
 * Library General Public License as published by the Free Software Foundation;
38
 * either version 2 of the License, or any later version.
39
 *
40
 * This library is distributed in the hope that it will be useful, but WITHOUT
41
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
42
 * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
43
 * details.
44
 *
45
 * If you didn't download this code from the following link, you should check if
46
 * you aren't using an obsolete version:
47
 * http://www.lowagie.com/iText/
48
 */
49
package com.lowagie.text.pdf;
50
51
import java.awt.Canvas;
52
import java.awt.Color;
53
import java.awt.Image;
54
import java.awt.image.MemoryImageSource;
55
import com.lowagie.text.error_messages.MessageLocalization;
56
57
import com.lowagie.text.Element;
58
59
import com.lowagie.text.Rectangle;
60
import com.lowagie.text.ExceptionConverter;
61
62
/** Implements the code interleaved 2 of 5. The text can include
63
 * non numeric characters that are printed but do not generate bars.
64
 * The default parameters are:
65
 * <pre>
66
 *x = 0.8f;
67
 *n = 2;
68
 *font = BaseFont.createFont("Helvetica", "winansi", false);
69
 *size = 8;
70
 *baseline = size;
71
 *barHeight = size * 3;
72
 *textAlignment = Element.ALIGN_CENTER;
73
 *generateChecksum = false;
74
 *checksumText = false;
75
 * </pre>
76
 *
77
 * @author Paulo Soares (psoares@consiste.pt)
78
 */
79
public class BarcodeInter25 extends Barcode{
80
81
    /**
82
     * The bars to generate the code.
83
     */
84
    private static final byte[][] BARS =
85
            {
86
                    {0, 0, 1, 1, 0},
87
                    {1, 0, 0, 0, 1},
88
                    {0, 1, 0, 0, 1},
89
                    {1, 1, 0, 0, 0},
90
                    {0, 0, 1, 0, 1},
91
                    {1, 0, 1, 0, 0},
92
                    {0, 1, 1, 0, 0},
93
                    {0, 0, 0, 1, 1},
94
                    {1, 0, 0, 1, 0},
95
                    {0, 1, 0, 1, 0}
96
            };
97
98
    /** Creates new BarcodeInter25 */
99
    public BarcodeInter25() {
100
        try {
101
            x = 0.8f;
102
            n = 2;
103
            font = BaseFont.createFont("Helvetica", "winansi", false);
104
            size = 8;
105
            baseline = size;
106 1 1. : Replaced float multiplication with division → NO_COVERAGE
            barHeight = size * 3;
107
            textAlignment = Element.ALIGN_CENTER;
108
            generateChecksum = false;
109
            checksumText = false;
110
        }
111
        catch (Exception e) {
112
            throw new ExceptionConverter(e);
113
        }
114
    }
115
    
116
    /** Deletes all the non numeric characters from <CODE>text</CODE>.
117
     * @param text the text
118
     * @return a <CODE>String</CODE> with only numeric characters
119
     */    
120
    public static String keepNumbers(String text) {
121
        StringBuilder sb = new StringBuilder();
122 3 1. keepNumbers : changed conditional boundary → NO_COVERAGE
2. keepNumbers : Changed increment from 1 to -1 → NO_COVERAGE
3. keepNumbers : negated conditional → NO_COVERAGE
        for (int k = 0; k < text.length(); ++k) {
123
            char c = text.charAt(k);
124 4 1. keepNumbers : changed conditional boundary → NO_COVERAGE
2. keepNumbers : changed conditional boundary → NO_COVERAGE
3. keepNumbers : negated conditional → NO_COVERAGE
4. keepNumbers : negated conditional → NO_COVERAGE
            if (c >= '0' && c <= '9')
125
                sb.append(c);
126
        }
127 1 1. keepNumbers : mutated return of Object value for com/lowagie/text/pdf/BarcodeInter25::keepNumbers to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return sb.toString();
128
    }
129
    
130
    /** Calculates the checksum.
131
     * @param text the numeric text
132
     * @return the checksum
133
     */    
134
    public static char getChecksum(String text) {
135
        int mul = 3;
136
        int total = 0;
137 4 1. getChecksum : changed conditional boundary → NO_COVERAGE
2. getChecksum : Changed increment from -1 to 1 → NO_COVERAGE
3. getChecksum : Replaced integer subtraction with addition → NO_COVERAGE
4. getChecksum : negated conditional → NO_COVERAGE
        for (int k = text.length() - 1; k >= 0; --k) {
138 1 1. getChecksum : Replaced integer subtraction with addition → NO_COVERAGE
            int n = text.charAt(k) - '0';
139 2 1. getChecksum : Replaced integer multiplication with division → NO_COVERAGE
2. getChecksum : Replaced integer addition with subtraction → NO_COVERAGE
            total += mul * n;
140 1 1. getChecksum : Replaced XOR with AND → NO_COVERAGE
            mul ^= 2;
141
        }
142 5 1. getChecksum : Replaced integer modulus with multiplication → NO_COVERAGE
2. getChecksum : Replaced integer subtraction with addition → NO_COVERAGE
3. getChecksum : Replaced integer modulus with multiplication → NO_COVERAGE
4. getChecksum : Replaced integer addition with subtraction → NO_COVERAGE
5. getChecksum : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return (char)(((10 - (total % 10)) % 10) + '0');
143
    }
144
145
    /** Creates the bars for the barcode.
146
     * @param text the text. It can contain non numeric characters
147
     * @return the barcode
148
     */    
149
    public static byte[] getBarsInter25(String text) {
150
        text = keepNumbers(text);
151 2 1. getBarsInter25 : Replaced bitwise AND with OR → NO_COVERAGE
2. getBarsInter25 : negated conditional → NO_COVERAGE
        if ((text.length() & 1) != 0)
152
            throw new IllegalArgumentException(MessageLocalization.getComposedMessage("the.text.length.must.be.even"));
153 2 1. getBarsInter25 : Replaced integer multiplication with division → NO_COVERAGE
2. getBarsInter25 : Replaced integer addition with subtraction → NO_COVERAGE
        byte[] bars = new byte[text.length() * 5 + 7];
154
        int pb = 0;
155 1 1. getBarsInter25 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 0;
156 1 1. getBarsInter25 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 0;
157 1 1. getBarsInter25 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 0;
158 1 1. getBarsInter25 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 0;
159 1 1. getBarsInter25 : Replaced integer division with multiplication → NO_COVERAGE
        int len = text.length() / 2;
160 3 1. getBarsInter25 : changed conditional boundary → NO_COVERAGE
2. getBarsInter25 : Changed increment from 1 to -1 → NO_COVERAGE
3. getBarsInter25 : negated conditional → NO_COVERAGE
        for (int k = 0; k < len; ++k) {
161 2 1. getBarsInter25 : Replaced integer multiplication with division → NO_COVERAGE
2. getBarsInter25 : Replaced integer subtraction with addition → NO_COVERAGE
            int c1 = text.charAt(k * 2) - '0';
162 3 1. getBarsInter25 : Replaced integer multiplication with division → NO_COVERAGE
2. getBarsInter25 : Replaced integer addition with subtraction → NO_COVERAGE
3. getBarsInter25 : Replaced integer subtraction with addition → NO_COVERAGE
            int c2 = text.charAt(k * 2 + 1) - '0';
163
            byte[] b1 = BARS[c1];
164
            byte[] b2 = BARS[c2];
165 3 1. getBarsInter25 : changed conditional boundary → NO_COVERAGE
2. getBarsInter25 : Changed increment from 1 to -1 → NO_COVERAGE
3. getBarsInter25 : negated conditional → NO_COVERAGE
            for (int j = 0; j < 5; ++j) {
166 1 1. getBarsInter25 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = b1[j];
167 1 1. getBarsInter25 : Changed increment from 1 to -1 → NO_COVERAGE
                bars[pb++] = b2[j];
168
            }
169
        }
170 1 1. getBarsInter25 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 1;
171 1 1. getBarsInter25 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 0;
172 1 1. getBarsInter25 : Changed increment from 1 to -1 → NO_COVERAGE
        bars[pb++] = 0;
173 1 1. getBarsInter25 : mutated return of Object value for com/lowagie/text/pdf/BarcodeInter25::getBarsInter25 to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return bars;
174
    }
175
176
    /** Gets the maximum area that the barcode and the text, if
177
     * any, will occupy. The lower left corner is always (0, 0).
178
     * @return the size the barcode occupies.
179
     */    
180
    public Rectangle getBarcodeSize() {
181
        float fontX = 0;
182
        float fontY = 0;
183 1 1. getBarcodeSize : negated conditional → NO_COVERAGE
        if (font != null) {
184 2 1. getBarcodeSize : changed conditional boundary → NO_COVERAGE
2. getBarcodeSize : negated conditional → NO_COVERAGE
            if (baseline > 0)
185 1 1. getBarcodeSize : Replaced float subtraction with addition → NO_COVERAGE
                fontY = baseline - font.getFontDescriptor(BaseFont.DESCENT, size);
186
            else
187 2 1. getBarcodeSize : removed negation → NO_COVERAGE
2. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
                fontY = -baseline + size;
188
            String fullCode = code;
189 2 1. getBarcodeSize : negated conditional → NO_COVERAGE
2. getBarcodeSize : negated conditional → NO_COVERAGE
            if (generateChecksum && checksumText)
190
                fullCode += getChecksum(fullCode);
191 1 1. getBarcodeSize : negated conditional → NO_COVERAGE
            fontX = font.getWidthPoint(altText != null ? altText : fullCode, size);
192
        }
193
        String fullCode = keepNumbers(code);
194
        int len = fullCode.length();
195 1 1. getBarcodeSize : negated conditional → NO_COVERAGE
        if (generateChecksum)
196 1 1. getBarcodeSize : Changed increment from 1 to -1 → NO_COVERAGE
            ++len;
197 8 1. getBarcodeSize : Replaced float multiplication with division → NO_COVERAGE
2. getBarcodeSize : Replaced float multiplication with division → NO_COVERAGE
3. getBarcodeSize : Replaced float multiplication with division → NO_COVERAGE
4. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
5. getBarcodeSize : Replaced float multiplication with division → NO_COVERAGE
6. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
7. getBarcodeSize : Replaced float multiplication with division → NO_COVERAGE
8. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
        float fullWidth = len * (3 * x + 2 * x * n) + (6 + n ) * x;
198
        fullWidth = Math.max(fullWidth, fontX);
199 1 1. getBarcodeSize : Replaced float addition with subtraction → NO_COVERAGE
        float fullHeight = barHeight + fontY;
200 1 1. getBarcodeSize : mutated return of Object value for com/lowagie/text/pdf/BarcodeInter25::getBarcodeSize to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return new Rectangle(fullWidth, fullHeight);
201
    }
202
    
203
    /** Places the barcode in a <CODE>PdfContentByte</CODE>. The
204
     * barcode is always placed at coordinates (0, 0). Use the
205
     * translation matrix to move it elsewhere.<p>
206
     * The bars and text are written in the following colors:<p>
207
     * <P><TABLE BORDER=1>
208
     * <TR>
209
     *    <TH><P><CODE>barColor</CODE></TH>
210
     *    <TH><P><CODE>textColor</CODE></TH>
211
     *    <TH><P>Result</TH>
212
     *    </TR>
213
     * <TR>
214
     *    <TD><P><CODE>null</CODE></TD>
215
     *    <TD><P><CODE>null</CODE></TD>
216
     *    <TD><P>bars and text painted with current fill color</TD>
217
     *    </TR>
218
     * <TR>
219
     *    <TD><P><CODE>barColor</CODE></TD>
220
     *    <TD><P><CODE>null</CODE></TD>
221
     *    <TD><P>bars and text painted with <CODE>barColor</CODE></TD>
222
     *    </TR>
223
     * <TR>
224
     *    <TD><P><CODE>null</CODE></TD>
225
     *    <TD><P><CODE>textColor</CODE></TD>
226
     *    <TD><P>bars painted with current color<br>text painted with <CODE>textColor</CODE></TD>
227
     *    </TR>
228
     * <TR>
229
     *    <TD><P><CODE>barColor</CODE></TD>
230
     *    <TD><P><CODE>textColor</CODE></TD>
231
     *    <TD><P>bars painted with <CODE>barColor</CODE><br>text painted with <CODE>textColor</CODE></TD>
232
     *    </TR>
233
     * </TABLE>
234
     * @param cb the <CODE>PdfContentByte</CODE> where the barcode will be placed
235
     * @param barColor the color of the bars. It can be <CODE>null</CODE>
236
     * @param textColor the color of the text. It can be <CODE>null</CODE>
237
     * @return the dimensions the barcode occupies
238
     */    
239
    public Rectangle placeBarcode(PdfContentByte cb, Color barColor, Color textColor) {
240
        String fullCode = code;
241
        float fontX = 0;
242 1 1. placeBarcode : negated conditional → NO_COVERAGE
        if (font != null) {
243 2 1. placeBarcode : negated conditional → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
            if (generateChecksum && checksumText)
244
                fullCode += getChecksum(fullCode);
245 1 1. placeBarcode : negated conditional → NO_COVERAGE
            fontX = font.getWidthPoint(fullCode = altText != null ? altText : fullCode, size);
246
        }
247
        String bCode = keepNumbers(code);
248 1 1. placeBarcode : negated conditional → NO_COVERAGE
        if (generateChecksum)
249
            bCode += getChecksum(bCode);
250
        int len = bCode.length();
251 8 1. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
2. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
3. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
4. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
5. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
6. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
7. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
8. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
        float fullWidth = len * (3 * x + 2 * x * n) + (6 + n ) * x;
252
        float barStartX = 0;
253
        float textStartX = 0;
254
        switch (textAlignment) {
255
            case Element.ALIGN_LEFT:
256
                break;
257
            case Element.ALIGN_RIGHT:
258 2 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
                if (fontX > fullWidth)
259 1 1. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
                    barStartX = fontX - fullWidth;
260
                else
261 1 1. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
                    textStartX = fullWidth - fontX;
262
                break;
263
            default:
264 2 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
                if (fontX > fullWidth)
265 2 1. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
2. placeBarcode : Replaced float division with multiplication → NO_COVERAGE
                    barStartX = (fontX - fullWidth) / 2;
266
                else
267 2 1. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
2. placeBarcode : Replaced float division with multiplication → NO_COVERAGE
                    textStartX = (fullWidth - fontX) / 2;
268
                break;
269
        }
270
        float barStartY = 0;
271
        float textStartY = 0;
272 1 1. placeBarcode : negated conditional → NO_COVERAGE
        if (font != null) {
273 2 1. placeBarcode : changed conditional boundary → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
            if (baseline <= 0)
274 1 1. placeBarcode : Replaced float subtraction with addition → NO_COVERAGE
                textStartY = barHeight - baseline;
275
            else {
276 1 1. placeBarcode : removed negation → NO_COVERAGE
                textStartY = -font.getFontDescriptor(BaseFont.DESCENT, size);
277 1 1. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
                barStartY = textStartY + baseline;
278
            }
279
        }
280
        byte[] bars = getBarsInter25(bCode);
281
        boolean print = true;
282 1 1. placeBarcode : negated conditional → NO_COVERAGE
        if (barColor != null)
283 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE
            cb.setColorFill(barColor);
284
        for (byte bar : bars) {
285 2 1. placeBarcode : Replaced float multiplication with division → NO_COVERAGE
2. placeBarcode : negated conditional → NO_COVERAGE
            float w = (bar == 0 ? x : x * n);
286 1 1. placeBarcode : negated conditional → NO_COVERAGE
            if (print)
287 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);
288 1 1. placeBarcode : negated conditional → NO_COVERAGE
            print = !print;
289 1 1. placeBarcode : Replaced float addition with subtraction → NO_COVERAGE
            barStartX += w;
290
        }
291 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE
        cb.fill();
292 1 1. placeBarcode : negated conditional → NO_COVERAGE
        if (font != null) {
293 1 1. placeBarcode : negated conditional → NO_COVERAGE
            if (textColor != null)
294 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE
                cb.setColorFill(textColor);
295 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::beginText → NO_COVERAGE
            cb.beginText();
296 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setFontAndSize → NO_COVERAGE
            cb.setFontAndSize(font, size);
297 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::setTextMatrix → NO_COVERAGE
            cb.setTextMatrix(textStartX, textStartY);
298 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::showText → NO_COVERAGE
            cb.showText(fullCode);
299 1 1. placeBarcode : removed call to com/lowagie/text/pdf/PdfContentByte::endText → NO_COVERAGE
            cb.endText();
300
        }
301 1 1. placeBarcode : mutated return of Object value for com/lowagie/text/pdf/BarcodeInter25::placeBarcode to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getBarcodeSize();
302
    }   
303
    
304
    /** Creates a <CODE>java.awt.Image</CODE>. This image only
305
     * contains the bars without any text.
306
     * @param foreground the color of the bars
307
     * @param background the color of the background
308
     * @return the image
309
     */    
310
    public java.awt.Image createAwtImage(Color foreground, Color background) {
311
        int f = foreground.getRGB();
312
        int g = background.getRGB();
313
        Canvas canvas = new Canvas();
314
315
        String bCode = keepNumbers(code);
316 1 1. createAwtImage : negated conditional → NO_COVERAGE
        if (generateChecksum)
317
            bCode += getChecksum(bCode);
318
        int len = bCode.length();
319
        int nn = (int)n;
320 5 1. createAwtImage : Replaced integer multiplication with division → NO_COVERAGE
2. createAwtImage : Replaced integer addition with subtraction → NO_COVERAGE
3. createAwtImage : Replaced integer multiplication with division → NO_COVERAGE
4. createAwtImage : Replaced integer addition with subtraction → NO_COVERAGE
5. createAwtImage : Replaced integer addition with subtraction → NO_COVERAGE
        int fullWidth = len * (3 + 2 * nn) + (6 + nn );
321
        byte[] bars = getBarsInter25(bCode);
322
        boolean print = true;
323
        int ptr = 0;
324
        int height = (int)barHeight;
325 1 1. createAwtImage : Replaced integer multiplication with division → NO_COVERAGE
        int[] pix = new int[fullWidth * height];
326
        for (byte bar : bars) {
327 1 1. createAwtImage : negated conditional → NO_COVERAGE
            int w = (bar == 0 ? 1 : nn);
328
            int c = g;
329 1 1. createAwtImage : negated conditional → NO_COVERAGE
            if (print)
330
                c = f;
331 1 1. createAwtImage : negated conditional → NO_COVERAGE
            print = !print;
332 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)
333 1 1. createAwtImage : Changed increment from 1 to -1 → NO_COVERAGE
                pix[ptr++] = c;
334
        }
335 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 = fullWidth; k < pix.length; k += fullWidth) {
336 1 1. createAwtImage : removed call to java/lang/System::arraycopy → NO_COVERAGE
            System.arraycopy(pix, 0, pix, k, fullWidth); 
337
        }
338
        Image img = canvas.createImage(new MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
339
        
340 1 1. createAwtImage : mutated return of Object value for com/lowagie/text/pdf/BarcodeInter25::createAwtImage to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return img;
341
    }    
342
}

Mutations

106

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

122

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

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

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

124

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

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

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

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

127

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

137

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

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

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

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

138

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

139

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

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

140

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

142

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

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

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

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

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

151

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

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

153

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

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

155

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

156

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

157

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

158

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

159

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

160

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

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

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

161

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

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

162

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

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

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

165

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

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

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

166

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

167

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

170

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

171

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

172

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

173

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

183

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

184

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

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

185

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

187

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

189

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

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

191

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

195

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

196

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

197

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

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

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

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

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

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

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

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

199

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

200

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

242

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

243

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

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

245

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

248

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

251

1.1
Location : placeBarcode
Killed by : none
Replaced float multiplication with division → 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 multiplication with division → NO_COVERAGE

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

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

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

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

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

258

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

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

259

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

261

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

264

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

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

265

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

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

267

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

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

272

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

273

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

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

274

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

276

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

277

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

282

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

283

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

285

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

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

286

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

287

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

288

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

289

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

291

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

292

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

293

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

294

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

295

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

296

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

297

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

298

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

299

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

301

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

316

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

320

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

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

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

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

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

325

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

327

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

329

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

331

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

332

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

333

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

335

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

336

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

340

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

Active mutators

Tests examined


Report generated by PIT 1.4.2