| 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.*; | |
| 9 | ||
| 10 | import java.awt.*; | |
| 11 | ||
| 12 | /** | |
| 13 | * a Sound Interface Device | |
| 14 | */ | |
| 15 | public class SID | |
| 16 | implements IODevice, InterruptGenerator { | |
| 17 | protected Interruptable pic; | |
| 18 | ||
| 19 | public int getPortCount() { | |
| 20 | 3 | return 2; |
| 21 | } | |
| 22 | ||
| 23 | @Override | |
| 24 | public int getPort(int n) { | |
| 25 | 4 | if (n == 0 || n == 1) { |
| 26 | 3 | return 0; |
| 27 | } | |
| 28 | 5 | throw new RuntimeException("should not be possible " + n); |
| 29 | } | |
| 30 | ||
| 31 | @Override | |
| 32 | public void setPort(int n, int value) { | |
| 33 | switch (n) { | |
| 34 | case 0: | |
| 35 | 1 | if (value == 0) { |
| 36 | 2 | Toolkit.getDefaultToolkit().beep(); |
| 37 | } | |
| 38 | return; | |
| 39 | case 1: | |
| 40 | return; | |
| 41 | } | |
| 42 | 5 | throw new RuntimeException("should not be possible " + n); |
| 43 | } | |
| 44 | ||
| 45 | public void reset() { | |
| 46 | } | |
| 47 | ||
| 48 | public void update() { | |
| 49 | } | |
| 50 | ||
| 51 | public void link(Interruptable pic) { | |
| 52 | 1 | this.pic = pic; |
| 53 | } | |
| 54 | } | |
Mutations | ||
| 20 |
Substituted 2 with 3 : NO_COVERAGE Substituted 2 with 3 : NO_COVERAGE replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE |
|
| 25 |
negated conditional : NO_COVERAGE Substituted 1 with 0 : NO_COVERAGE Substituted 1 with 0 : NO_COVERAGE negated conditional : NO_COVERAGE |
|
| 26 |
Substituted 0 with 1 : NO_COVERAGE Substituted 0 with 1 : NO_COVERAGE replaced return of integer sized value with (x == 0 ? 1 : 0) : NO_COVERAGE |
|
| 28 |
removed call to java/lang/StringBuilder::<init> : NO_COVERAGE removed call to java/lang/StringBuilder::toString : NO_COVERAGE removed call to java/lang/RuntimeException::<init> : NO_COVERAGE removed call to java/lang/StringBuilder::append : NO_COVERAGE removed call to java/lang/StringBuilder::append : NO_COVERAGE |
|
| 35 |
negated conditional : NO_COVERAGE |
|
| 36 |
removed call to java/awt/Toolkit::beep : NO_COVERAGE removed call to java/awt/Toolkit::getDefaultToolkit : NO_COVERAGE |
|
| 42 |
removed call to java/lang/StringBuilder::append : NO_COVERAGE removed call to java/lang/StringBuilder::toString : 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/RuntimeException::<init> : NO_COVERAGE |
|
| 52 |
Removed assignment to member variable pic : SURVIVED |