AddressMappingIODevice.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.devices;
7
8
import fi.helsinki.cs.titokone.IODevice;
9
import fi.helsinki.cs.ttk91.TTK91RuntimeException;
10
11
/**
12
 * a dummy device which maps underlying device to a new address
13
 */
14
public class AddressMappingIODevice
15
        implements IODevice {
16
    protected IODevice delegate;
17
    protected int base;
18
19
    public AddressMappingIODevice(int base, IODevice delegate) {
20 1
        this.delegate = delegate;
21 1
        this.base = base;
22 7
        if (delegate == null || base < 0 || base > 65000) {
23 1
            throw new IllegalArgumentException("delegate must not be null");
24
        }
25
    }
26
27
    public int getPortCount() {
28 2
        return delegate.getPortCount();
29
    }
30
31
    public int getPort(int n)
32
            throws TTK91RuntimeException {
33 3
        return delegate.getPort(n - base);
34
    }
35
36
    public void setPort(int n, int value)
37
            throws TTK91RuntimeException {
38 2
        delegate.setPort(n - base, value);
39
    }
40
41
    public void reset() {
42 1
        delegate.reset();
43
    }
44
45
    public void update() {
46 1
        delegate.update();
47
    }
48
}

Mutations

20

Removed assignment to member variable delegate : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

21

Removed assignment to member variable base : SURVIVED

22

Replaced constant value of 65000 with 65001 : SURVIVED

negated conditional : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

negated conditional : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

changed conditional boundary : SURVIVED

changed conditional boundary : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

Substituted 65000 with 65001 : SURVIVED

negated conditional : KILLED -> fi.helsinki.cs.titokone.ControlTest.testGetApplicationDefinitions(fi.helsinki.cs.titokone.ControlTest)

23

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

28

replaced return of integer sized value with (x == 0 ? 1 : 0) : SURVIVED

removed call to fi/helsinki/cs/titokone/IODevice::getPortCount : SURVIVED

33

removed call to fi/helsinki/cs/titokone/IODevice::getPort : NO_COVERAGE

replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE

Replaced integer subtraction with addition : NO_COVERAGE

38

Replaced integer subtraction with addition : NO_COVERAGE

removed call to fi/helsinki/cs/titokone/IODevice::setPort : NO_COVERAGE

42

removed call to fi/helsinki/cs/titokone/IODevice::reset : SURVIVED

46

removed call to fi/helsinki/cs/titokone/IODevice::update : NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.27