GUIThreader.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.io.File;
9
10
public class GUIThreader implements Runnable {
11
    private short task;
12
    private GUIBrain brains;
13
    public static final short TASK_OPEN_FILE = 1;
14
    public static final short TASK_COMPILE = 2;
15
    public static final short TASK_RUN = 3;
16
    public static final short TASK_CONTINUE = 4;
17
    public static final short TASK_ENTER_NUMBER = 5;
18
    public static final short TASK_STOP = 6;
19
20
    private Object param1;
21
22
    public GUIThreader(short methodToRun, GUIBrain brains) {
23 1
        this.task = methodToRun;
24 1
        this.brains = brains;
25
    }
26
27
    public GUIThreader(short methodToRun, GUIBrain brains, Object param1) {
28 1
        this.task = methodToRun;
29 1
        this.brains = brains;
30 1
        this.param1 = param1;
31
    }
32
33
34
    public void run() throws ClassCastException {
35
        switch (task) {
36
            case TASK_OPEN_FILE:
37 1
                brains.menuOpenFile((File) param1);
38
                break;
39
40
            case TASK_COMPILE:
41 1
                brains.menuCompile();
42
                break;
43
44
            case TASK_RUN:
45 1
                brains.menuRun();
46
                break;
47
48
            case TASK_CONTINUE:
49 1
                brains.continueTask();
50
                break;
51
52
            case TASK_STOP:
53 3
                brains.menuInterrupt(false);
54
                break;
55
56
            case TASK_ENTER_NUMBER:
57 1
                brains.enterInput((String) param1);
58
                break;
59
        }
60
        /// case ...// etc
61
    }
62
}
63
64
// Käyttö: GUI:ssa new GUIThreader(GUIThreader.TASK_SHOW_HELP, myGuiBrain).run()

Mutations

23

Removed assignment to member variable task : NO_COVERAGE

24

Removed assignment to member variable brains : NO_COVERAGE

28

Removed assignment to member variable task : NO_COVERAGE

29

Removed assignment to member variable brains : NO_COVERAGE

30

Removed assignment to member variable param1 : NO_COVERAGE

37

removed call to fi/helsinki/cs/titokone/GUIBrain::menuOpenFile : NO_COVERAGE

41

removed call to fi/helsinki/cs/titokone/GUIBrain::menuCompile : NO_COVERAGE

45

removed call to fi/helsinki/cs/titokone/GUIBrain::menuRun : NO_COVERAGE

49

removed call to fi/helsinki/cs/titokone/GUIBrain::continueTask : NO_COVERAGE

53

Substituted 0 with 1 : NO_COVERAGE

Substituted 0 with 1 : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/GUIBrain::menuInterrupt : NO_COVERAGE

57

removed call to fi/helsinki/cs/titokone/GUIBrain::enterInput : NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.27