GreekAlphabetFactory.java

1
/*
2
 * $Id: GreekAlphabetFactory.java 3373 2008-05-12 16:21:24Z xlv $
3
 *
4
 * Copyright 2007 by 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
package com.lowagie.text.factories;
50
51
import com.lowagie.text.SpecialSymbol;
52
53
/**
54
 * This class can produce String combinations representing a number built with
55
 * Greek letters (from alpha to omega, then alpha alpha, alpha beta, alpha gamma).
56
 * We are aware of the fact that the original Greek numbering is different;
57
 * See http://www.cogsci.indiana.edu/farg/harry/lan/grknum.htm#ancient
58
 * but this isn't implemented yet; the main reason being the fact that we
59
 * need a font that has the obsolete Greek characters qoppa and sampi.
60
 *
61
 * @since 2.0.7 (was called GreekNumberFactory in earlier versions)
62
 */
63
public class GreekAlphabetFactory {
64
    /**
65
     * Changes an int into a lower case Greek letter combination.
66
     * @param index the original number
67
     * @return the letter combination
68
     */
69
    public static final String getString(int index) {
70 1 1. getString : mutated return of Object value for com/lowagie/text/factories/GreekAlphabetFactory::getString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getString(index, true);
71
    }
72
73
    /**
74
     * Changes an int into a lower case Greek letter combination.
75
     * @param index the original number
76
     * @return the letter combination
77
     */
78
    public static final String getLowerCaseString(int index) {
79 1 1. getLowerCaseString : mutated return of Object value for com/lowagie/text/factories/GreekAlphabetFactory::getLowerCaseString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getString(index);
80
    }
81
82
    /**
83
     * Changes an int into a upper case Greek letter combination.
84
     * @param index the original number
85
     * @return the letter combination
86
     */
87
    public static final String getUpperCaseString(int index) {
88 1 1. getUpperCaseString : mutated return of Object value for com/lowagie/text/factories/GreekAlphabetFactory::getUpperCaseString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return getString(index).toUpperCase();
89
    }
90
91
    /**
92
     * Changes an int into a Greek letter combination.
93
     * @param index the original number
94
     * @return the letter combination
95
     */
96
    public static final String getString(int index, boolean lowercase) {
97 3 1. getString : changed conditional boundary → NO_COVERAGE
2. getString : negated conditional → NO_COVERAGE
3. getString : mutated return of Object value for com/lowagie/text/factories/GreekAlphabetFactory::getString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        if (index < 1) return "";
98 1 1. getString : Changed increment from -1 to 1 → NO_COVERAGE
        index--;
99
100
        int bytes = 1;
101
        int start = 0;
102
        int symbols = 24;
103 3 1. getString : changed conditional boundary → NO_COVERAGE
2. getString : Replaced integer addition with subtraction → NO_COVERAGE
3. getString : negated conditional → NO_COVERAGE
           while(index >= symbols + start) {
104 1 1. getString : Changed increment from 1 to -1 → NO_COVERAGE
               bytes++;
105 1 1. getString : Replaced integer addition with subtraction → NO_COVERAGE
               start += symbols;
106 1 1. getString : Replaced integer multiplication with division → NO_COVERAGE
               symbols *= 24;
107
           }
108
109 1 1. getString : Replaced integer subtraction with addition → NO_COVERAGE
           int c = index - start;
110
           char[] value = new char[bytes];
111 2 1. getString : changed conditional boundary → NO_COVERAGE
2. getString : negated conditional → NO_COVERAGE
           while(bytes > 0) {
112 1 1. getString : Changed increment from -1 to 1 → NO_COVERAGE
               bytes--;
113 1 1. getString : Replaced integer modulus with multiplication → NO_COVERAGE
               value[bytes] = (char)(c % 24);
114 3 1. getString : changed conditional boundary → NO_COVERAGE
2. getString : Replaced integer addition with subtraction → NO_COVERAGE
3. getString : negated conditional → NO_COVERAGE
               if (value[bytes] > 16) value[bytes]++;
115 2 1. getString : Replaced integer addition with subtraction → NO_COVERAGE
2. getString : negated conditional → NO_COVERAGE
               value[bytes] += (lowercase ? 945 : 913);
116
               value[bytes] = SpecialSymbol.getCorrespondingSymbol(value[bytes]);
117 1 1. getString : Replaced integer division with multiplication → NO_COVERAGE
               c /= 24;
118
           }
119
120 1 1. getString : mutated return of Object value for com/lowagie/text/factories/GreekAlphabetFactory::getString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
           return String.valueOf(value);
121
    }
122
}

Mutations

70

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

79

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

88

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

97

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

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

3.3
Location : getString
Killed by : none
mutated return of Object value for com/lowagie/text/factories/GreekAlphabetFactory::getString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

98

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

103

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

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

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

104

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

105

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

106

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

109

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

111

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

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

112

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

113

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

114

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

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

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

115

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

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

117

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

120

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

Active mutators

Tests examined


Report generated by PIT 1.4.2