Skip to content

Package: PrinterUtility

PrinterUtility

nameinstructionbranchcomplexitylinemethod
PrinterUtility()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
writeLineBreaks(StringBuffer, int, Integer)
M: 0 C: 17
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
writeSpaces(StringBuffer, int, Integer)
M: 0 C: 17
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 5
100%
M: 0 C: 1
100%

Coverage

1: /**
2: *
3: */
4: package printer;
5:
6: /**
7: * UtilityClass for extracted Printer-Functions.
8: *
9: * @author Phil
10: *
11: */
12: public class PrinterUtility {
13:         /**
14:          * Checks if spaces are needed and prints it into the writer.
15:          *
16:          *
17:          * @param col
18:          * the actual col in the row.
19:          * @param colPosition
20:          * the col where we have to print.
21:          * @param stringBuffer
22:          * the given stringBuffer to print in.
23:          * @return the number of written lines.
24:          */
25:         public int writeSpaces(final StringBuffer stringBuffer, final int col,
26:                         final Integer colPosition) {
27:                 int writtenSpaces = 0;
28:•                for (int i = col; i < colPosition; i++) {
29:                         stringBuffer.append(basic.PrinterConstants.SPACE);
30:                         writtenSpaces++;
31:                 }
32:                 return writtenSpaces;
33:
34:         }
35:
36:         /**
37:          * Checks if a linebreak is needed and prints it into the writer.
38:          *
39:          *
40:          * @param row
41:          * the actual row in the file.
42:          * @param rowPosition
43:          * the row where we have to print.
44:          * @param stringBuffer
45:          * the given stringBuffer to print in.
46:          *
47:          * @return the number of written lines.
48:          */
49:         public int writeLineBreaks(final StringBuffer stringBuffer, final int row,
50:                         final Integer rowPosition) {
51:                 int writtenlines = 0;
52:•                for (int i = row; i < rowPosition; i++) {
53:                         stringBuffer.append(basic.PrinterConstants.LINEBREAK);
54:                         writtenlines++;
55:                 }
56:                 return writtenlines;
57:         }
58: }