PdfCell.java

1
/*
2
 * $Id: PdfCell.java 3671 2009-02-01 14:46:09Z blowagie $
3
 *
4
 * Copyright 1999, 2000, 2001, 2002 Bruno Lowagie
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
50
package com.lowagie.text.pdf;
51
52
import java.util.ArrayList;
53
import java.util.Iterator;
54
55
import com.lowagie.text.Anchor;
56
import com.lowagie.text.Cell;
57
import com.lowagie.text.Chunk;
58
import com.lowagie.text.Element;
59
import com.lowagie.text.Image;
60
import com.lowagie.text.List;
61
import com.lowagie.text.ListItem;
62
import com.lowagie.text.Paragraph;
63
import com.lowagie.text.Phrase;
64
import com.lowagie.text.Rectangle;
65
66
/**
67
 * A <CODE>PdfCell</CODE> is the PDF translation of a <CODE>Cell</CODE>.
68
 * <P>
69
 * A <CODE>PdfCell</CODE> is an <CODE>ArrayList</CODE> of <CODE>PdfLine</CODE>s.
70
 * <P>
71
 * When using variable borders ({@link com.lowagie.text.Rectangle#isUseVariableBorders isUseVariableBorders()} == true),
72
 * the borders are drawn completely inside the cell Rectangle
73
 * so that adjacent cell borders will not overlap.
74
 * Otherwise, the borders are drawn on top of the edges of the
75
 * cell Rectangle and will overlap the borders of adjacent
76
 * cells.
77
 *
78
 * @see        com.lowagie.text.Rectangle
79
 * @see        com.lowagie.text.Cell
80
 * @see        PdfLine
81
 * @see        PdfTable
82
 */
83
84
public class PdfCell extends Rectangle {
85
86
    // membervariables
87
    
88
    /**
89
     * These are the PdfLines in the Cell.
90
     */
91
    private ArrayList lines;
92
93
    /**
94
     * These are the PdfLines in the Cell.
95
     */
96
    private PdfLine line;
97
98
    /**
99
     * These are the Images in the Cell.
100
     */
101
    private ArrayList images;
102
103
    /**
104
     * This is the leading of the lines.
105
     */
106
    private float leading;
107
108
    /**
109
     * This is the number of the row the cell is in.
110
     */
111
    private int rownumber;
112
113
    /**
114
     * This is the rowspan of the cell.
115
     */
116
    private int rowspan;
117
118
    /**
119
     * This is the cellspacing of the cell.
120
     */
121
    private float cellspacing;
122
123
    /**
124
     * This is the cellpadding of the cell.
125
     */
126
    private float cellpadding;
127
128
    /**
129
     * Indicates if this cell belongs to the header of a <CODE>PdfTable</CODE>
130
     */
131
    private boolean header = false;
132
133
    /**
134
     * This is the total height of the content of the cell.  Note that the actual cell
135
     * height may be larger due to another cell on the row *
136
     */
137
    private float contentHeight = 0.0f;
138
139
    /**
140
     * Indicates that the largest ascender height should be used to
141
     * determine the height of the first line. Setting this to true can help
142
     * with vertical alignment problems. */
143
    private boolean useAscender;
144
145
    /**
146
     * Indicates that the largest descender height should be added to the height of
147
     * the last line (so characters like y don't dip into the border). */
148
    private boolean useDescender;
149
150
    /**
151
     * Adjusts the cell contents to compensate for border widths.
152
     */
153
    private boolean useBorderPadding;
154
155
    private int verticalAlignment;
156
157
    private PdfLine firstLine;
158
    private PdfLine lastLine;
159
160
    // constructors
161
    
162
    /**
163
     * Constructs a <CODE>PdfCell</CODE>-object.
164
     *
165
     * @param    cell        the original <CODE>Cell</CODE>
166
     * @param    rownumber    the number of the <CODE>Row</CODE> the <CODE>Cell</CODE> was in.
167
     * @param    left        the left border of the <CODE>PdfCell</CODE>
168
     * @param    right        the right border of the <CODE>PdfCell</CODE>
169
     * @param    top            the top border of the <CODE>PdfCell</CODE>
170
     * @param    cellspacing    the cellspacing of the <CODE>Table</CODE>
171
     * @param    cellpadding    the cellpadding    of the <CODE>Table</CODE>
172
     */
173
174
    public PdfCell(Cell cell, int rownumber, float left, float right, float top, float cellspacing, float cellpadding) {
175
        // constructs a Rectangle (the bottomvalue will be changed afterwards)
176
        super(left, top, right, top);
177
        // copying the other Rectangle attributes from class Cell
178 1 1. : removed call to com/lowagie/text/pdf/PdfCell::cloneNonPositionParameters → NO_COVERAGE
        cloneNonPositionParameters(cell);
179
        this.cellpadding = cellpadding;
180
        this.cellspacing = cellspacing;
181
        this.verticalAlignment = cell.getVerticalAlignment();
182
        this.useAscender = cell.isUseAscender();
183
        this.useDescender = cell.isUseDescender();
184
        this.useBorderPadding = cell.isUseBorderPadding();
185
186
        // initialization of some parameters
187
        PdfChunk chunk;
188
        Element element;
189
        PdfChunk overflow;
190
        lines = new ArrayList();
191
        images = new ArrayList();
192
        leading = cell.getLeading();
193
        int alignment = cell.getHorizontalAlignment();
194 2 1. : Replaced float addition with subtraction → NO_COVERAGE
2. : Replaced float addition with subtraction → NO_COVERAGE
        left += cellspacing + cellpadding;
195 2 1. : Replaced float addition with subtraction → NO_COVERAGE
2. : Replaced float subtraction with addition → NO_COVERAGE
        right -= cellspacing + cellpadding;
196
197 1 1. : Replaced float addition with subtraction → NO_COVERAGE
        left += getBorderWidthInside(LEFT);
198 1 1. : Replaced float subtraction with addition → NO_COVERAGE
        right -= getBorderWidthInside(RIGHT);
199
200
201
        contentHeight = 0;
202
203
        rowspan = cell.getRowspan();
204
205
        ArrayList allActions;
206
        int aCounter;
207
        // we loop over all the elements of the cell
208
        for (Iterator i = cell.getElements(); i.hasNext();) {
209
            element = (Element) i.next();
210
            switch (element.type()) {
211
                case Element.JPEG:
212
                case Element.JPEG2000:
213
                case Element.JBIG2:
214
                case Element.IMGRAW:
215
                case Element.IMGTEMPLATE:
216 1 1. : Replaced float multiplication with division → NO_COVERAGE
                    addImage((Image) element, left, right, 0.4f * leading, alignment); //
217
                    break;
218
                    // if the element is a list
219
                case Element.LIST:
220 3 1. : changed conditional boundary → NO_COVERAGE
2. : negated conditional → NO_COVERAGE
3. : negated conditional → NO_COVERAGE
                    if (line != null && line.size() > 0) {
221 1 1. : removed call to com/lowagie/text/pdf/PdfLine::resetAlignment → NO_COVERAGE
                        line.resetAlignment();
222 1 1. : removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE
                        addLine(line);
223
                    }
224
                    // we loop over all the listitems
225 1 1. : removed call to com/lowagie/text/pdf/PdfCell::addList → NO_COVERAGE
                    addList((List)element, left, right, alignment);
226
                    line = new PdfLine(left, right, alignment, leading);
227
                    break;
228
                    // if the element is something else
229
                default:
230
                    allActions = new ArrayList();
231 1 1. : removed call to com/lowagie/text/pdf/PdfCell::processActions → NO_COVERAGE
                    processActions(element, null, allActions);
232
                    aCounter = 0;
233
234
                    float currentLineLeading = leading;
235
                    float currentLeft = left;
236
                    float currentRight = right;
237 1 1. : negated conditional → NO_COVERAGE
                    if (element instanceof Phrase) {
238
                        currentLineLeading = ((Phrase) element).getLeading();
239
                    }
240 1 1. : negated conditional → NO_COVERAGE
                    if (element instanceof Paragraph) {
241
                        Paragraph p = (Paragraph) element;
242 1 1. : Replaced float addition with subtraction → NO_COVERAGE
                        currentLeft += p.getIndentationLeft();
243 1 1. : Replaced float subtraction with addition → NO_COVERAGE
                        currentRight -= p.getIndentationRight();
244
                    }
245 1 1. : negated conditional → NO_COVERAGE
                    if (line == null) {
246
                        line = new PdfLine(currentLeft, currentRight, alignment, currentLineLeading);
247
                    }
248
                    // we loop over the chunks
249
                    ArrayList chunks = element.getChunks();
250 1 1. : negated conditional → NO_COVERAGE
                    if (chunks.isEmpty()) {
251 1 1. : removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE
                       addLine(line); // add empty line - all cells need some lines even if they are empty
252
                       line = new PdfLine(currentLeft, currentRight, alignment, currentLineLeading);
253
                    }
254
                    else {
255
                        for (Object chunk1 : chunks) {
256
                            Chunk c = (Chunk) chunk1;
257 1 1. : Changed increment from 1 to -1 → NO_COVERAGE
                            chunk = new PdfChunk(c, (PdfAction) (allActions.get(aCounter++)));
258 1 1. : negated conditional → NO_COVERAGE
                            while ((overflow = line.add(chunk)) != null) {
259 1 1. : removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE
                                addLine(line);
260
                                line = new PdfLine(currentLeft, currentRight, alignment, currentLineLeading);
261
                                chunk = overflow;
262
                            }
263
                        }
264
                    }
265
                    // if the element is a paragraph, section or chapter, we reset the alignment and add the line
266
                    switch (element.type()) {
267
                        case Element.PARAGRAPH:
268
                        case Element.SECTION:
269
                        case Element.CHAPTER:
270 1 1. : removed call to com/lowagie/text/pdf/PdfLine::resetAlignment → NO_COVERAGE
                            line.resetAlignment();
271 1 1. : removed call to com/lowagie/text/pdf/PdfCell::flushCurrentLine → NO_COVERAGE
                            flushCurrentLine();
272
                    }
273
            }
274
        }
275 1 1. : removed call to com/lowagie/text/pdf/PdfCell::flushCurrentLine → NO_COVERAGE
        flushCurrentLine();
276 2 1. : changed conditional boundary → NO_COVERAGE
2. : negated conditional → NO_COVERAGE
        if (lines.size() > cell.getMaxLines()) {
277 2 1. : changed conditional boundary → NO_COVERAGE
2. : negated conditional → NO_COVERAGE
            while (lines.size() > cell.getMaxLines()) {
278 1 1. : Replaced integer subtraction with addition → NO_COVERAGE
                removeLine(lines.size() - 1);
279
            }
280 2 1. : changed conditional boundary → NO_COVERAGE
2. : negated conditional → NO_COVERAGE
            if (cell.getMaxLines() > 0) {
281
                String more = cell.getShowTruncation();
282 3 1. : changed conditional boundary → NO_COVERAGE
2. : negated conditional → NO_COVERAGE
3. : negated conditional → NO_COVERAGE
                if (more != null && more.length() > 0) {
283
                    // Denote that the content has been truncated
284 1 1. : Replaced integer subtraction with addition → NO_COVERAGE
                    lastLine = (PdfLine) lines.get(lines.size() - 1);
285 2 1. : changed conditional boundary → NO_COVERAGE
2. : negated conditional → NO_COVERAGE
                    if (lastLine.size() >= 0) {
286 1 1. : Replaced integer subtraction with addition → NO_COVERAGE
                        PdfChunk lastChunk = lastLine.getChunk(lastLine.size() - 1);
287
                        float moreWidth = new PdfChunk(more, lastChunk).width();
288 6 1. : changed conditional boundary → NO_COVERAGE
2. : changed conditional boundary → NO_COVERAGE
3. : Replaced float addition with subtraction → NO_COVERAGE
4. : Replaced float subtraction with addition → NO_COVERAGE
5. : negated conditional → NO_COVERAGE
6. : negated conditional → NO_COVERAGE
                        while (lastChunk.toString().length() > 0 && lastChunk.width() + moreWidth > right - left) {
289
                            // Remove characters to leave room for the 'more' indicator
290 2 1. : Replaced integer subtraction with addition → NO_COVERAGE
2. : removed call to com/lowagie/text/pdf/PdfChunk::setValue → NO_COVERAGE
                            lastChunk.setValue(lastChunk.toString().substring(0, lastChunk.length() - 1));
291
                        }
292 1 1. : removed call to com/lowagie/text/pdf/PdfChunk::setValue → NO_COVERAGE
                        lastChunk.setValue(lastChunk.toString() + more);
293
                    } else {
294
                        lastLine.add(new PdfChunk(new Chunk(more), null));
295
                    }
296
                }
297
            }
298
        }
299
        // we set some additional parameters
300 2 1. : negated conditional → NO_COVERAGE
2. : negated conditional → NO_COVERAGE
        if (useDescender && lastLine != null) {
301 1 1. : Replaced float subtraction with addition → NO_COVERAGE
            contentHeight -= lastLine.getDescender();
302
        }
303
304
        // adjust first line height so that it touches the top
305 1 1. : negated conditional → NO_COVERAGE
        if (!lines.isEmpty()) {
306
            firstLine = (PdfLine) lines.get(0);
307
            float firstLineRealHeight = firstLineRealHeight();
308 1 1. : Replaced float subtraction with addition → NO_COVERAGE
            contentHeight -= firstLine.height();
309
            firstLine.height = firstLineRealHeight;
310 1 1. : Replaced float addition with subtraction → NO_COVERAGE
            contentHeight += firstLineRealHeight;
311
        }
312
313 5 1. : Replaced float subtraction with addition → NO_COVERAGE
2. : Replaced float multiplication with division → NO_COVERAGE
3. : Replaced float subtraction with addition → NO_COVERAGE
4. : Replaced float multiplication with division → NO_COVERAGE
5. : Replaced float subtraction with addition → NO_COVERAGE
        float newBottom = top - contentHeight - (2f * cellpadding()) - (2f * cellspacing());
314 2 1. : Replaced float addition with subtraction → NO_COVERAGE
2. : Replaced float subtraction with addition → NO_COVERAGE
        newBottom -= getBorderWidthInside(TOP) + getBorderWidthInside(BOTTOM);
315 1 1. : removed call to com/lowagie/text/pdf/PdfCell::setBottom → NO_COVERAGE
        setBottom(newBottom);
316
317
        this.rownumber = rownumber;
318
    }
319
320
    private void addList(List list, float left, float right, int alignment) {
321
        PdfChunk chunk;
322
        PdfChunk overflow;
323
        ArrayList allActions = new ArrayList();
324 1 1. addList : removed call to com/lowagie/text/pdf/PdfCell::processActions → NO_COVERAGE
        processActions(list, null, allActions);
325
        int aCounter = 0;
326
        for (Object o1 : list.getItems()) {
327
            Element ele = (Element) o1;
328
            switch (ele.type()) {
329
                case Element.LISTITEM:
330
                    ListItem item = (ListItem) ele;
331 1 1. addList : Replaced float addition with subtraction → NO_COVERAGE
                    line = new PdfLine(left + item.getIndentationLeft(), right, alignment, item.getLeading());
332 1 1. addList : removed call to com/lowagie/text/pdf/PdfLine::setListItem → NO_COVERAGE
                    line.setListItem(item);
333
                    for (Object o : item.getChunks()) {
334 1 1. addList : Changed increment from 1 to -1 → NO_COVERAGE
                        chunk = new PdfChunk((Chunk) o, (PdfAction) (allActions.get(aCounter++)));
335 1 1. addList : negated conditional → NO_COVERAGE
                        while ((overflow = line.add(chunk)) != null) {
336 1 1. addList : removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE
                            addLine(line);
337 1 1. addList : Replaced float addition with subtraction → NO_COVERAGE
                            line = new PdfLine(left + item.getIndentationLeft(), right, alignment, item.getLeading());
338
                            chunk = overflow;
339
                        }
340 1 1. addList : removed call to com/lowagie/text/pdf/PdfLine::resetAlignment → NO_COVERAGE
                        line.resetAlignment();
341 1 1. addList : removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE
                        addLine(line);
342 1 1. addList : Replaced float addition with subtraction → NO_COVERAGE
                        line = new PdfLine(left + item.getIndentationLeft(), right, alignment, leading);
343
                    }
344
                    break;
345
                case Element.LIST:
346
                    List sublist = (List) ele;
347 2 1. addList : Replaced float addition with subtraction → NO_COVERAGE
2. addList : removed call to com/lowagie/text/pdf/PdfCell::addList → NO_COVERAGE
                    addList(sublist, left + sublist.getIndentationLeft(), right, alignment);
348
                    break;
349
            }
350
        }
351
    }
352
353
    // overriding of the Rectangle methods
354
355
356
    /**
357
     * Sets the bottom of the Rectangle and determines the proper {link #verticalOffset}
358
     * to appropriately align the contents vertically.
359
     * @param value
360
     */
361
    public void setBottom(float value) {
362 1 1. setBottom : removed call to com/lowagie/text/Rectangle::setBottom → NO_COVERAGE
        super.setBottom(value);
363
        float firstLineRealHeight = firstLineRealHeight();
364
365 1 1. setBottom : Replaced float subtraction with addition → NO_COVERAGE
        float totalHeight = ury - value; // can't use top (already compensates for cellspacing)
366 3 1. setBottom : Replaced float multiplication with division → NO_COVERAGE
2. setBottom : Replaced float multiplication with division → NO_COVERAGE
3. setBottom : Replaced float addition with subtraction → NO_COVERAGE
        float nonContentHeight = (cellpadding() * 2f) + (cellspacing() * 2f);
367 2 1. setBottom : Replaced float addition with subtraction → NO_COVERAGE
2. setBottom : Replaced float addition with subtraction → NO_COVERAGE
        nonContentHeight += getBorderWidthInside(TOP) + getBorderWidthInside(BOTTOM);
368
369 1 1. setBottom : Replaced float subtraction with addition → NO_COVERAGE
        float interiorHeight = totalHeight - nonContentHeight;
370
        float extraHeight = 0.0f;
371
372
        switch (verticalAlignment) {
373
            case Element.ALIGN_BOTTOM:
374 1 1. setBottom : Replaced float subtraction with addition → NO_COVERAGE
                extraHeight = interiorHeight - contentHeight;
375
                break;
376
            case Element.ALIGN_MIDDLE:
377 2 1. setBottom : Replaced float subtraction with addition → NO_COVERAGE
2. setBottom : Replaced float division with multiplication → NO_COVERAGE
                extraHeight = (interiorHeight - contentHeight) / 2.0f;
378
                break;
379
            default:    // ALIGN_TOP
380
                extraHeight = 0f;
381
        }
382
383 2 1. setBottom : Replaced float addition with subtraction → NO_COVERAGE
2. setBottom : Replaced float addition with subtraction → NO_COVERAGE
        extraHeight += cellpadding() + cellspacing();
384 1 1. setBottom : Replaced float addition with subtraction → NO_COVERAGE
        extraHeight += getBorderWidthInside(TOP);
385 1 1. setBottom : negated conditional → NO_COVERAGE
        if (firstLine != null) {
386 1 1. setBottom : Replaced float addition with subtraction → NO_COVERAGE
            firstLine.height = firstLineRealHeight + extraHeight;
387
        }
388
    }
389
390
    /**
391
     * Returns the lower left x-coordinate.
392
     *
393
     * @return        the lower left x-coordinate
394
     */
395
396
    public float getLeft() {
397 1 1. getLeft : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::getLeft → NO_COVERAGE
        return super.getLeft(cellspacing);
398
    }
399
400
    /**
401
     * Returns the upper right x-coordinate.
402
     *
403
     * @return        the upper right x-coordinate
404
     */
405
406
    public float getRight() {
407 1 1. getRight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::getRight → NO_COVERAGE
        return super.getRight(cellspacing);
408
    }
409
410
    /**
411
     * Returns the upper right y-coordinate.
412
     *
413
     * @return        the upper right y-coordinate
414
     */
415
416
    public float getTop() {
417 1 1. getTop : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::getTop → NO_COVERAGE
        return super.getTop(cellspacing);
418
    }
419
420
    /**
421
     * Returns the lower left y-coordinate.
422
     *
423
     * @return        the lower left y-coordinate
424
     */
425
426
    public float getBottom() {
427 1 1. getBottom : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::getBottom → NO_COVERAGE
        return super.getBottom(cellspacing);
428
    }
429
    
430
    // methods
431
432
    private void addLine(PdfLine line) {
433
        lines.add(line);
434 1 1. addLine : Replaced float addition with subtraction → NO_COVERAGE
        contentHeight += line.height();
435
        lastLine = line;
436
        this.line = null;
437
    }
438
439
    private PdfLine removeLine(int index) {
440
        PdfLine oldLine = (PdfLine) lines.remove(index);
441 1 1. removeLine : Replaced float subtraction with addition → NO_COVERAGE
        contentHeight -= oldLine.height();
442 1 1. removeLine : negated conditional → NO_COVERAGE
        if (index == 0) {
443 1 1. removeLine : negated conditional → NO_COVERAGE
            if (!lines.isEmpty()) {
444
                firstLine = (PdfLine) lines.get(0);
445
                float firstLineRealHeight = firstLineRealHeight();
446 1 1. removeLine : Replaced float subtraction with addition → NO_COVERAGE
                contentHeight -= firstLine.height();
447
                firstLine.height = firstLineRealHeight;
448 1 1. removeLine : Replaced float addition with subtraction → NO_COVERAGE
                contentHeight += firstLineRealHeight;
449
            }
450
        }
451 1 1. removeLine : mutated return of Object value for com/lowagie/text/pdf/PdfCell::removeLine to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return oldLine;
452
    }
453
454
    private void flushCurrentLine() {
455 3 1. flushCurrentLine : changed conditional boundary → NO_COVERAGE
2. flushCurrentLine : negated conditional → NO_COVERAGE
3. flushCurrentLine : negated conditional → NO_COVERAGE
        if (line != null && line.size() > 0) {
456 1 1. flushCurrentLine : removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE
            addLine(line);
457
        }
458
    }
459
460
    /**
461
     * Calculates what the height of the first line should be so that the content will be
462
     * flush with the top.  For text, this is the height of the ascender.  For an image,
463
     * it is the actual height of the image.
464
     * @return the real height of the first line
465
     */
466
    private float firstLineRealHeight() {
467
        float firstLineRealHeight = 0f;
468 1 1. firstLineRealHeight : negated conditional → NO_COVERAGE
        if (firstLine != null) {
469
            PdfChunk chunk = firstLine.getChunk(0);
470 1 1. firstLineRealHeight : negated conditional → NO_COVERAGE
            if (chunk != null) {
471
                Image image = chunk.getImage();
472 1 1. firstLineRealHeight : negated conditional → NO_COVERAGE
                if (image != null) {
473
                    firstLineRealHeight = firstLine.getChunk(0).getImage().getScaledHeight();
474
                } else {
475 1 1. firstLineRealHeight : negated conditional → NO_COVERAGE
                    firstLineRealHeight = useAscender ? firstLine.getAscender() : leading;
476
                }
477
            }
478
        }
479 1 1. firstLineRealHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::firstLineRealHeight → NO_COVERAGE
        return firstLineRealHeight;
480
    }
481
482
    /**
483
     * Gets the amount of the border for the specified side that is inside the Rectangle.
484
     * For non-variable width borders this is only 1/2 the border width on that side.  This
485
     * always returns 0 if {@link #useBorderPadding} is false;
486
     * @param side the side to check.  One of the side constants in {@link com.lowagie.text.Rectangle}
487
     * @return the borderwidth inside the cell
488
     */
489
    private float getBorderWidthInside(int side) {
490
        float width = 0f;
491 1 1. getBorderWidthInside : negated conditional → NO_COVERAGE
        if (useBorderPadding) {
492
            switch (side) {
493
                case Rectangle.LEFT:
494
                    width = getBorderWidthLeft();
495
                    break;
496
497
                case Rectangle.RIGHT:
498
                    width = getBorderWidthRight();
499
                    break;
500
501
                case Rectangle.TOP:
502
                    width = getBorderWidthTop();
503
                    break;
504
505
                default:    // default and BOTTOM
506
                    width = getBorderWidthBottom();
507
                    break;
508
            }
509
            // non-variable (original style) borders overlap the rectangle (only 1/2 counts)
510 1 1. getBorderWidthInside : negated conditional → NO_COVERAGE
            if (!isUseVariableBorders()) {
511 1 1. getBorderWidthInside : Replaced float division with multiplication → NO_COVERAGE
                width = width / 2f;
512
            }
513
        }
514 1 1. getBorderWidthInside : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::getBorderWidthInside → NO_COVERAGE
        return width;
515
    }
516
517
518
    /**
519
     * Adds an image to this Cell.
520
     *
521
     * @param i           the image to add
522
     * @param left        the left border
523
     * @param right       the right border
524
     * @param extraHeight extra height to add above image
525
     * @param alignment   horizontal alignment (constant from Element class)
526
     * @return the height of the image
527
     */
528
529
    private float addImage(Image i, float left, float right, float extraHeight, int alignment) {
530
        Image image = Image.getInstance(i);
531 3 1. addImage : changed conditional boundary → NO_COVERAGE
2. addImage : Replaced float subtraction with addition → NO_COVERAGE
3. addImage : negated conditional → NO_COVERAGE
        if (image.getScaledWidth() > right - left) {
532 2 1. addImage : Replaced float subtraction with addition → NO_COVERAGE
2. addImage : removed call to com/lowagie/text/Image::scaleToFit → NO_COVERAGE
            image.scaleToFit(right - left, Float.MAX_VALUE);
533
        }
534 1 1. addImage : removed call to com/lowagie/text/pdf/PdfCell::flushCurrentLine → NO_COVERAGE
        flushCurrentLine();
535 1 1. addImage : negated conditional → NO_COVERAGE
        if (line == null) {
536
            line = new PdfLine(left, right, alignment, leading);
537
        }
538
        PdfLine imageLine = line;
539
540
        // left and right in chunk is relative to the start of the line
541 1 1. addImage : Replaced float subtraction with addition → NO_COVERAGE
        right = right - left;
542
        left = 0f;
543
544 2 1. addImage : Replaced bitwise AND with OR → NO_COVERAGE
2. addImage : negated conditional → NO_COVERAGE
        if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) {
545 1 1. addImage : Replaced float subtraction with addition → NO_COVERAGE
            left = right - image.getScaledWidth();
546 2 1. addImage : Replaced bitwise AND with OR → NO_COVERAGE
2. addImage : negated conditional → NO_COVERAGE
        } else if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) {
547 4 1. addImage : Replaced float subtraction with addition → NO_COVERAGE
2. addImage : Replaced float subtraction with addition → NO_COVERAGE
3. addImage : Replaced float division with multiplication → NO_COVERAGE
4. addImage : Replaced float addition with subtraction → NO_COVERAGE
            left = left + ((right - left - image.getScaledWidth()) / 2f);
548
        }
549
        Chunk imageChunk = new Chunk(image, left, 0);
550
        imageLine.add(new PdfChunk(imageChunk, null));
551 1 1. addImage : removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE
        addLine(imageLine);
552 1 1. addImage : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::addImage → NO_COVERAGE
        return imageLine.height();
553
    }
554
555
    /**
556
     * Gets the lines of a cell that can be drawn between certain limits.
557
     * <P>
558
     * Remark: all the lines that can be drawn are removed from the object!
559
     *
560
     * @param    top        the top of the part of the table that can be drawn
561
     * @param    bottom    the bottom of the part of the table that can be drawn
562
     * @return    an <CODE>ArrayList</CODE> of <CODE>PdfLine</CODE>s
563
     */
564
565
    public ArrayList getLines(float top, float bottom) {
566
        float lineHeight;
567
        float currentPosition = Math.min(getTop(), top);
568 2 1. getLines : Replaced float addition with subtraction → NO_COVERAGE
2. getLines : removed call to com/lowagie/text/pdf/PdfCell::setTop → NO_COVERAGE
        setTop(currentPosition + cellspacing);
569
        ArrayList result = new ArrayList();
570
571
        // if the bottom of the page is higher than the top of the cell: do nothing
572 2 1. getLines : changed conditional boundary → NO_COVERAGE
2. getLines : negated conditional → NO_COVERAGE
        if (getTop() < bottom) {
573 1 1. getLines : mutated return of Object value for com/lowagie/text/pdf/PdfCell::getLines to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return result;
574
        }
575
        
576
        // we loop over the lines
577
        int size = lines.size();
578
        boolean aboveBottom = true;
579 4 1. getLines : changed conditional boundary → NO_COVERAGE
2. getLines : Changed increment from 1 to -1 → NO_COVERAGE
3. getLines : negated conditional → NO_COVERAGE
4. getLines : negated conditional → NO_COVERAGE
        for (int i = 0; i < size && aboveBottom; i++) {
580
            line = (PdfLine) lines.get(i);
581
            lineHeight = line.height();
582 1 1. getLines : Replaced float subtraction with addition → NO_COVERAGE
            currentPosition -= lineHeight;
583
            // if the currentPosition is higher than the bottom, we add the line to the result
584 4 1. getLines : changed conditional boundary → NO_COVERAGE
2. getLines : Replaced float addition with subtraction → NO_COVERAGE
3. getLines : Replaced float addition with subtraction → NO_COVERAGE
4. getLines : negated conditional → NO_COVERAGE
            if (currentPosition > (bottom + cellpadding + getBorderWidthInside(BOTTOM))) {
585
                result.add(line);
586
            } else {
587
                aboveBottom = false;
588
            }
589
        }
590
        // if the bottom of the cell is higher than the bottom of the page, the cell is written, so we can remove all lines
591
        float difference = 0f;
592 1 1. getLines : negated conditional → NO_COVERAGE
        if (!header) {
593 1 1. getLines : negated conditional → NO_COVERAGE
            if (aboveBottom) {
594
                lines = new ArrayList();
595
                contentHeight = 0f;
596
            } else {
597
                size = result.size();
598 3 1. getLines : changed conditional boundary → NO_COVERAGE
2. getLines : Changed increment from 1 to -1 → NO_COVERAGE
3. getLines : negated conditional → NO_COVERAGE
                for (int i = 0; i < size; i++) {
599
                    line = removeLine(0);
600 1 1. getLines : Replaced float addition with subtraction → NO_COVERAGE
                    difference += line.height();
601
                }
602
            }
603
        }
604 2 1. getLines : changed conditional boundary → NO_COVERAGE
2. getLines : negated conditional → NO_COVERAGE
        if (difference > 0) {
605
            Image image;
606
            for (Object image1 : images) {
607
                image = (Image) image1;
608 3 1. getLines : Replaced float subtraction with addition → NO_COVERAGE
2. getLines : Replaced float subtraction with addition → NO_COVERAGE
3. getLines : removed call to com/lowagie/text/Image::setAbsolutePosition → NO_COVERAGE
                image.setAbsolutePosition(image.getAbsoluteX(), image.getAbsoluteY() - difference - leading);
609
            }
610
        }
611 1 1. getLines : mutated return of Object value for com/lowagie/text/pdf/PdfCell::getLines to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return result;
612
    }
613
614
    /**
615
     * Gets the images of a cell that can be drawn between certain limits.
616
     * <P>
617
     * Remark: all the lines that can be drawn are removed from the object!
618
     *
619
     * @param    top        the top of the part of the table that can be drawn
620
     * @param    bottom    the bottom of the part of the table that can be drawn
621
     * @return    an <CODE>ArrayList</CODE> of <CODE>Image</CODE>s
622
     */
623
624
    public ArrayList getImages(float top, float bottom) {
625
626
        // if the bottom of the page is higher than the top of the cell: do nothing
627 2 1. getImages : changed conditional boundary → NO_COVERAGE
2. getImages : negated conditional → NO_COVERAGE
        if (getTop() < bottom) {
628 1 1. getImages : mutated return of Object value for com/lowagie/text/pdf/PdfCell::getImages to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new ArrayList();
629
        }
630
        top = Math.min(getTop(), top);
631
        // initializations
632
        Image image;
633
        float height;
634
        ArrayList result = new ArrayList();
635
        // we loop over the images
636 2 1. getImages : negated conditional → NO_COVERAGE
2. getImages : negated conditional → NO_COVERAGE
        for (Iterator i = images.iterator(); i.hasNext() && !header;) {
637
            image = (Image) i.next();
638
            height = image.getAbsoluteY();
639
            // if the currentPosition is higher than the bottom, we add the line to the result
640 4 1. getImages : changed conditional boundary → NO_COVERAGE
2. getImages : Replaced float subtraction with addition → NO_COVERAGE
3. getImages : Replaced float addition with subtraction → NO_COVERAGE
4. getImages : negated conditional → NO_COVERAGE
            if (top - height > (bottom + cellpadding)) {
641 2 1. getImages : Replaced float subtraction with addition → NO_COVERAGE
2. getImages : removed call to com/lowagie/text/Image::setAbsolutePosition → NO_COVERAGE
                image.setAbsolutePosition(image.getAbsoluteX(), top - height);
642
                result.add(image);
643 1 1. getImages : removed call to java/util/Iterator::remove → NO_COVERAGE
                i.remove();
644
            }
645
        }
646 1 1. getImages : mutated return of Object value for com/lowagie/text/pdf/PdfCell::getImages to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return result;
647
    }
648
649
    /**
650
     * Checks if this cell belongs to the header of a <CODE>PdfTable</CODE>.
651
     *
652
     * @return    <CODE>void</CODE>
653
     */
654
655
    boolean isHeader() {
656
        return header;
657
    }
658
659
    /**
660
     * Indicates that this cell belongs to the header of a <CODE>PdfTable</CODE>.
661
     */
662
663
    void setHeader() {
664
        header = true;
665
    }
666
667
    /**
668
     * Checks if the cell may be removed.
669
     * <P>
670
     * Headers may always be removed, even if they are drawn only partially:
671
     * they will be repeated on each following page anyway!
672
     *
673
     * @return    <CODE>true</CODE> if all the lines are already drawn; <CODE>false</CODE> otherwise.
674
     */
675
676
    boolean mayBeRemoved() {
677 4 1. mayBeRemoved : negated conditional → NO_COVERAGE
2. mayBeRemoved : negated conditional → NO_COVERAGE
3. mayBeRemoved : negated conditional → NO_COVERAGE
4. mayBeRemoved : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return (header || (lines.isEmpty() && images.isEmpty()));
678
    }
679
680
    /**
681
     * Returns the number of lines in the cell.
682
     *
683
     * @return    a value
684
     */
685
686
    public int size() {
687
        return lines.size();
688
    }
689
690
    /**
691
     * Returns the total height of all the lines in the cell.
692
     *
693
     * @return    a value
694
     */
695
    private float remainingLinesHeight() {
696 2 1. remainingLinesHeight : negated conditional → NO_COVERAGE
2. remainingLinesHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::remainingLinesHeight → NO_COVERAGE
        if (lines.isEmpty()) return 0;
697
        float result = 0;
698
        int size = lines.size();
699
        PdfLine line;
700
        for (Object line1 : lines) {
701
            line = (PdfLine) line1;
702 1 1. remainingLinesHeight : Replaced float addition with subtraction → NO_COVERAGE
            result += line.height();
703
        }
704 1 1. remainingLinesHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::remainingLinesHeight → NO_COVERAGE
        return result;
705
    }
706
707
    /**
708
     * Returns the height needed to draw the remaining text.
709
     *
710
     * @return a height
711
     */
712
713
    public float remainingHeight() {
714
        float result = 0f;
715
        for (Object image1 : images) {
716
            Image image = (Image) image1;
717 1 1. remainingHeight : Replaced float addition with subtraction → NO_COVERAGE
            result += image.getScaledHeight();
718
        }
719 5 1. remainingHeight : Replaced float addition with subtraction → NO_COVERAGE
2. remainingHeight : Replaced float multiplication with division → NO_COVERAGE
3. remainingHeight : Replaced float addition with subtraction → NO_COVERAGE
4. remainingHeight : Replaced float addition with subtraction → NO_COVERAGE
5. remainingHeight : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::remainingHeight → NO_COVERAGE
        return remainingLinesHeight() + cellspacing + 2 * cellpadding + result;
720
    }
721
    
722
    // methods to retrieve membervariables
723
    
724
    /**
725
     * Gets the leading of a cell.
726
     *
727
     * @return    the leading of the lines is the cell.
728
     */
729
730
    public float leading() {
731
        return leading;
732
    }
733
734
    /**
735
     * Gets the number of the row this cell is in..
736
     *
737
     * @return    a number
738
     */
739
740
    public int rownumber() {
741
        return rownumber;
742
    }
743
744
    /**
745
     * Gets the rowspan of a cell.
746
     *
747
     * @return    the rowspan of the cell
748
     */
749
750
    public int rowspan() {
751
        return rowspan;
752
    }
753
754
    /**
755
     * Gets the cellspacing of a cell.
756
     *
757
     * @return    a value
758
     */
759
760
    public float cellspacing() {
761
        return cellspacing;
762
    }
763
764
    /**
765
     * Gets the cellpadding of a cell..
766
     *
767
     * @return    a value
768
     */
769
770
    public float cellpadding() {
771
        return cellpadding;
772
    }
773
774
    /**
775
     * Processes all actions contained in the cell.
776
     * @param element    an element in the cell
777
     * @param action    an action that should be coupled to the cell
778
     * @param allActions
779
     */
780
781
    protected void processActions(Element element, PdfAction action, ArrayList allActions) {
782 1 1. processActions : negated conditional → NO_COVERAGE
        if (element.type() == Element.ANCHOR) {
783
            String url = ((Anchor) element).getReference();
784 1 1. processActions : negated conditional → NO_COVERAGE
            if (url != null) {
785
                action = new PdfAction(url);
786
            }
787
        }
788
        Iterator i;
789
        switch (element.type()) {
790
            case Element.PHRASE:
791
            case Element.SECTION:
792
            case Element.ANCHOR:
793
            case Element.CHAPTER:
794
            case Element.LISTITEM:
795
            case Element.PARAGRAPH:
796 1 1. processActions : negated conditional → NO_COVERAGE
                for (i = ((ArrayList) element).iterator(); i.hasNext();) {
797 1 1. processActions : removed call to com/lowagie/text/pdf/PdfCell::processActions → NO_COVERAGE
                    processActions((Element) i.next(), action, allActions);
798
                }
799
                break;
800
            case Element.CHUNK:
801
                allActions.add(action);
802
                break;
803
            case Element.LIST:
804 1 1. processActions : negated conditional → NO_COVERAGE
                for (i = ((List) element).getItems().iterator(); i.hasNext();) {
805 1 1. processActions : removed call to com/lowagie/text/pdf/PdfCell::processActions → NO_COVERAGE
                    processActions((Element) i.next(), action, allActions);
806
                }
807
                break;
808
            default:
809
                int n = element.getChunks().size();
810 3 1. processActions : changed conditional boundary → NO_COVERAGE
2. processActions : Changed increment from -1 to 1 → NO_COVERAGE
3. processActions : negated conditional → NO_COVERAGE
                while (n-- > 0)
811
                    allActions.add(action);
812
                break;
813
        }
814
    }
815
816
    /**
817
     * This is the number of the group the cell is in.
818
     */
819
    private int groupNumber;
820
821
    /**
822
     * Gets the number of the group this cell is in..
823
     *
824
     * @return    a number
825
     */
826
827
    public int getGroupNumber() {
828
        return groupNumber;
829
    }
830
831
    /**
832
     * Sets the group number.
833
     * @param number
834
     */
835
836
    void setGroupNumber(int number) {
837
        groupNumber = number;
838
    }
839
840
    /**
841
     * Gets a Rectangle that is altered to fit on the page.
842
     *
843
     * @param    top        the top position
844
     * @param    bottom    the bottom position
845
     * @return    a <CODE>Rectangle</CODE>
846
     */
847
848
    public Rectangle rectangle(float top, float bottom) {
849
        Rectangle tmp = new Rectangle(getLeft(), getBottom(), getRight(), getTop());
850 1 1. rectangle : removed call to com/lowagie/text/Rectangle::cloneNonPositionParameters → NO_COVERAGE
        tmp.cloneNonPositionParameters(this);
851 2 1. rectangle : changed conditional boundary → NO_COVERAGE
2. rectangle : negated conditional → NO_COVERAGE
        if (getTop() > top) {
852 1 1. rectangle : removed call to com/lowagie/text/Rectangle::setTop → NO_COVERAGE
            tmp.setTop(top);
853 3 1. rectangle : Replaced bitwise AND with OR → NO_COVERAGE
2. rectangle : Replaced integer subtraction with addition → NO_COVERAGE
3. rectangle : removed call to com/lowagie/text/Rectangle::setBorder → NO_COVERAGE
            tmp.setBorder(border - (border & TOP));
854
        }
855 2 1. rectangle : changed conditional boundary → NO_COVERAGE
2. rectangle : negated conditional → NO_COVERAGE
        if (getBottom() < bottom) {
856 1 1. rectangle : removed call to com/lowagie/text/Rectangle::setBottom → NO_COVERAGE
            tmp.setBottom(bottom);
857 3 1. rectangle : Replaced bitwise AND with OR → NO_COVERAGE
2. rectangle : Replaced integer subtraction with addition → NO_COVERAGE
3. rectangle : removed call to com/lowagie/text/Rectangle::setBorder → NO_COVERAGE
            tmp.setBorder(border - (border & BOTTOM));
858
        }
859 1 1. rectangle : mutated return of Object value for com/lowagie/text/pdf/PdfCell::rectangle to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return tmp;
860
    }
861
862
    /**
863
     * Sets the value of useAscender.
864
     * @param use use ascender height if true
865
     */
866
    public void setUseAscender(boolean use) {
867
        useAscender = use;
868
    }
869
870
    /**
871
     * Gets the value of useAscender
872
     * @return useAscender
873
     */
874
    public boolean isUseAscender() {
875
        return useAscender;
876
    }
877
878
    /**
879
     * Sets the value of useDescender.
880
     * @param use use descender height if true
881
     */
882
    public void setUseDescender(boolean use) {
883
        useDescender = use;
884
    }
885
886
    /**
887
     * gets the value of useDescender
888
     * @return useDescender
889
     */
890
    public boolean isUseDescender() {
891
        return useDescender;
892
    }
893
894
    /**
895
     * Sets the value of useBorderPadding.
896
     * @param use adjust layout for borders if true
897
     */
898
    public void setUseBorderPadding(boolean use) {
899
        useBorderPadding = use;
900
    }
901
902
    /**
903
     * Gets the value of useBorderPadding.
904
     * @return useBorderPadding
905
     */
906
    public boolean isUseBorderPadding() {
907
        return useBorderPadding;
908
    }
909
910
}

Mutations

178

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::cloneNonPositionParameters → NO_COVERAGE

194

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

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

195

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

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

197

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

198

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

216

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

220

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

2.2
Location :
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location :
Killed by : none
negated conditional → NO_COVERAGE

221

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfLine::resetAlignment → NO_COVERAGE

222

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE

225

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::addList → NO_COVERAGE

231

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::processActions → NO_COVERAGE

237

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

240

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

242

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

243

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

245

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

250

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

251

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE

257

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

258

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

259

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE

270

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfLine::resetAlignment → NO_COVERAGE

271

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::flushCurrentLine → NO_COVERAGE

275

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::flushCurrentLine → NO_COVERAGE

276

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

2.2
Location :
Killed by : none
negated conditional → NO_COVERAGE

277

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

2.2
Location :
Killed by : none
negated conditional → NO_COVERAGE

278

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

280

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

2.2
Location :
Killed by : none
negated conditional → NO_COVERAGE

282

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

2.2
Location :
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location :
Killed by : none
negated conditional → NO_COVERAGE

284

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

285

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

2.2
Location :
Killed by : none
negated conditional → NO_COVERAGE

286

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

288

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

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

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

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

5.5
Location :
Killed by : none
negated conditional → NO_COVERAGE

6.6
Location :
Killed by : none
negated conditional → NO_COVERAGE

290

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

2.2
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfChunk::setValue → NO_COVERAGE

292

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfChunk::setValue → NO_COVERAGE

300

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location :
Killed by : none
negated conditional → NO_COVERAGE

301

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

305

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

308

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

310

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

313

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

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

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

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

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

314

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

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

315

1.1
Location :
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::setBottom → NO_COVERAGE

324

1.1
Location : addList
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::processActions → NO_COVERAGE

331

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

332

1.1
Location : addList
Killed by : none
removed call to com/lowagie/text/pdf/PdfLine::setListItem → NO_COVERAGE

334

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

335

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

336

1.1
Location : addList
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE

337

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

340

1.1
Location : addList
Killed by : none
removed call to com/lowagie/text/pdf/PdfLine::resetAlignment → NO_COVERAGE

341

1.1
Location : addList
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE

342

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

347

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

2.2
Location : addList
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::addList → NO_COVERAGE

362

1.1
Location : setBottom
Killed by : none
removed call to com/lowagie/text/Rectangle::setBottom → NO_COVERAGE

365

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

366

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

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

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

367

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

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

369

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

374

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

377

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

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

383

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

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

384

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

385

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

386

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

397

1.1
Location : getLeft
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::getLeft → NO_COVERAGE

407

1.1
Location : getRight
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::getRight → NO_COVERAGE

417

1.1
Location : getTop
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::getTop → NO_COVERAGE

427

1.1
Location : getBottom
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::getBottom → NO_COVERAGE

434

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

441

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

442

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

443

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

446

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

448

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

451

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

455

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

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

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

456

1.1
Location : flushCurrentLine
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE

468

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

470

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

472

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

475

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

479

1.1
Location : firstLineRealHeight
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::firstLineRealHeight → NO_COVERAGE

491

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

510

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

511

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

514

1.1
Location : getBorderWidthInside
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::getBorderWidthInside → NO_COVERAGE

531

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

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

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

532

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

2.2
Location : addImage
Killed by : none
removed call to com/lowagie/text/Image::scaleToFit → NO_COVERAGE

534

1.1
Location : addImage
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::flushCurrentLine → NO_COVERAGE

535

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

541

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

544

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

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

545

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

546

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

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

547

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

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

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

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

551

1.1
Location : addImage
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::addLine → NO_COVERAGE

552

1.1
Location : addImage
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::addImage → NO_COVERAGE

568

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

2.2
Location : getLines
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::setTop → NO_COVERAGE

572

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

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

573

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

579

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

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

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

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

582

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

584

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

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

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

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

592

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

593

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

598

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

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

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

600

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

604

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

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

608

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

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

3.3
Location : getLines
Killed by : none
removed call to com/lowagie/text/Image::setAbsolutePosition → NO_COVERAGE

611

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

627

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

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

628

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

636

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

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

640

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

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

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

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

641

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

2.2
Location : getImages
Killed by : none
removed call to com/lowagie/text/Image::setAbsolutePosition → NO_COVERAGE

643

1.1
Location : getImages
Killed by : none
removed call to java/util/Iterator::remove → NO_COVERAGE

646

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

677

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

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

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

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

696

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

2.2
Location : remainingLinesHeight
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::remainingLinesHeight → NO_COVERAGE

702

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

704

1.1
Location : remainingLinesHeight
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::remainingLinesHeight → NO_COVERAGE

717

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

719

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

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

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

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

5.5
Location : remainingHeight
Killed by : none
replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfCell::remainingHeight → NO_COVERAGE

782

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

784

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

796

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

797

1.1
Location : processActions
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::processActions → NO_COVERAGE

804

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

805

1.1
Location : processActions
Killed by : none
removed call to com/lowagie/text/pdf/PdfCell::processActions → NO_COVERAGE

810

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

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

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

850

1.1
Location : rectangle
Killed by : none
removed call to com/lowagie/text/Rectangle::cloneNonPositionParameters → NO_COVERAGE

851

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

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

852

1.1
Location : rectangle
Killed by : none
removed call to com/lowagie/text/Rectangle::setTop → NO_COVERAGE

853

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

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

3.3
Location : rectangle
Killed by : none
removed call to com/lowagie/text/Rectangle::setBorder → NO_COVERAGE

855

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

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

856

1.1
Location : rectangle
Killed by : none
removed call to com/lowagie/text/Rectangle::setBottom → NO_COVERAGE

857

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

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

3.3
Location : rectangle
Killed by : none
removed call to com/lowagie/text/Rectangle::setBorder → NO_COVERAGE

859

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

Active mutators

Tests examined


Report generated by PIT 1.4.2