Titokone.java

1
// Copyright © 2004-2006 University of Helsinki, Department of Computer Science
2
// Copyright © 2012 various contributors
3
// This software is released under GNU Lesser General Public License 2.1.
4
// The license text is at http://www.gnu.org/licenses/lgpl-2.1.html
5
6
package fi.helsinki.cs.titokone;
7
8
import java.util.logging.*;
9
10
/**
11
 * This class is just a launcher for the actual program. It creates an instance
12
 * GUI and initiates a debugger, which is accessed all over the program in order
13
 * to write logs for debugging the program.
14
 */
15
public class Titokone {
16
    /**
17
     * This variable is a system.exit parameter for when an invalid
18
     * parameter is given to the application.
19
     */
20
    public static final int INVALID_PARAMETER = -1;
21
22
23
    private static final String PACKAGE = "fi.helsinki.cs.titokone";
24
25
    public static void main(String[] args) {
26
        Logger myLogger = Logger.getLogger(PACKAGE);
27
        GUI gui;
28
29
        myLogger.setLevel(Level.WARNING); // By default we only show warnings.
30
31 5
        for (int i = 0; i < args.length; i++) {
32 1
            handleParameter(args[i]);
33
        }
34 1
        gui = new GUI();
35
    }
36
37
    private static void handleParameter(String parameter) {
38
        Logger myLogger = Logger.getLogger(PACKAGE);
39 2
        if (parameter.equals("-v")) {
40
            myLogger.setLevel(Level.INFO);
41 2
        } else if (parameter.equals("-vv")) {
42
            myLogger.setLevel(Level.FINE);
43 2
        } else if (parameter.equals("-vvv")) {
44
            myLogger.setLevel(Level.FINER);
45
        } else {
46 6
            System.err.println("Sorry, parameter '" + parameter + "' is unknown.");
47 1
            showAvailableParameters();
48 3
            System.exit(INVALID_PARAMETER);
49
        }
50
51
    }
52
53
    private static void showAvailableParameters() {
54 1
        String lbrk = System.getProperty("line.separator");
55 12
        System.err.println("Available parameters are:" + lbrk +
56
                "-v\tShows 'info' level logging messages. (Default " +
57
                "level is 'warning'.)" + lbrk +
58
                "-vv\tShows 'fine' level logging messages." + lbrk +
59
                "-vvv\tShows 'finer' level logging messages." + lbrk);
60
    }
61
}
62
63
64
65

Mutations

31

changed conditional boundary : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

negated conditional : NO_COVERAGE

Changed increment from 1 to -1 : NO_COVERAGE

32

removed call to fi/helsinki/cs/titokone/Titokone::handleParameter : NO_COVERAGE

34

removed call to fi/helsinki/cs/titokone/GUI::<init> : NO_COVERAGE

39

negated conditional : NO_COVERAGE

removed call to java/lang/String::equals : NO_COVERAGE

41

negated conditional : NO_COVERAGE

removed call to java/lang/String::equals : NO_COVERAGE

43

negated conditional : NO_COVERAGE

removed call to java/lang/String::equals : NO_COVERAGE

46

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::<init> : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/io/PrintStream::println : NO_COVERAGE

removed call to java/lang/StringBuilder::toString : NO_COVERAGE

47

removed call to fi/helsinki/cs/titokone/Titokone::showAvailableParameters : NO_COVERAGE

48

Substituted -1 with 0 : NO_COVERAGE

Substituted -1 with 1 : NO_COVERAGE

removed call to java/lang/System::exit : NO_COVERAGE

54

removed call to java/lang/System::getProperty : NO_COVERAGE

55

removed call to java/lang/StringBuilder::toString : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::<init> : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/lang/StringBuilder::append : NO_COVERAGE

removed call to java/io/PrintStream::println : NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.27