|
1
|
|
package com.github.dakusui.symfonion.song; |
|
2
|
|
|
|
3
|
|
import com.github.dakusui.symfonion.compat.exceptions.SymfonionException; |
|
4
|
|
import com.github.dakusui.symfonion.compat.json.CompatJsonException; |
|
5
|
|
import com.github.dakusui.symfonion.compat.json.CompatJsonUtils; |
|
6
|
|
import com.github.dakusui.symfonion.utils.Fraction; |
|
7
|
|
import com.google.gson.JsonObject; |
|
8
|
|
|
|
9
|
|
import static com.github.dakusui.symfonion.compat.exceptions.CompatExceptionThrower.illegalFormatException; |
|
10
|
|
import static com.github.dakusui.symfonion.compat.exceptions.SymfonionIllegalFormatException.NOTE_LENGTH_EXAMPLE; |
|
11
|
|
import static com.github.dakusui.symfonion.compat.json.CompatJsonUtils.asJsonElement; |
|
12
|
|
import static com.github.valid8j.classic.Requires.requireNonNull; |
|
13
|
|
|
|
14
|
|
/** |
|
15
|
|
* A class that models a set of default parameter applied to each `Stroke` in this `Pattern`. |
|
16
|
|
* |
|
17
|
|
* Following is a list of available parameters.: |
|
18
|
|
* |
|
19
|
|
* * `$velocitybase` |
|
20
|
|
* * `$velocitydelta` |
|
21
|
|
* * `$gate` |
|
22
|
|
* * `$length` |
|
23
|
|
* * `$transpose` |
|
24
|
|
* * `$arpeggio` |
|
25
|
|
*/ |
|
26
|
|
public class PartMeasureParameters { |
|
27
|
|
final double gate; |
|
28
|
|
final Fraction length; |
|
29
|
|
final int transpose; |
|
30
|
|
final int velocityBase; |
|
31
|
|
final int velocityDelta; |
|
32
|
|
final int arpeggio; |
|
33
|
|
final NoteMap noteMap; |
|
34
|
|
|
|
35
|
|
/** |
|
36
|
|
* Creates an object of this class. |
|
37
|
|
* |
|
38
|
|
* @param json A JSON object that stores a part measure parameters. |
|
39
|
|
* @param noteMap An object that defines mappings from a character to a MIDI note number. |
|
40
|
|
*/ |
|
41
|
|
public PartMeasureParameters(JsonObject json, NoteMap noteMap) throws SymfonionException, CompatJsonException { |
|
42
|
1
1. <init> : negated conditional → KILLED
|
if (json == null) { |
|
43
|
|
json = CompatJsonUtils.toJson("{}").getAsJsonObject(); |
|
44
|
|
} |
|
45
|
|
this.velocityBase = CompatJsonUtils.asIntWithDefault(json, 64, Keyword.velocitybase); |
|
46
|
|
this.velocityDelta = CompatJsonUtils.asIntWithDefault(json, 5, Keyword.velocitydelta); |
|
47
|
|
this.gate = CompatJsonUtils.asDoubleWithDefault(json, 0.8, Keyword.gate); |
|
48
|
|
this.length = PartMeasure.parseNoteLength(CompatJsonUtils.asStringWithDefault(json, "16", Keyword.length)); |
|
49
|
1
1. <init> : negated conditional → KILLED
|
if (this.length == null) { |
|
50
|
|
throw illegalFormatException(asJsonElement(json, Keyword.length), NOTE_LENGTH_EXAMPLE); |
|
51
|
|
} |
|
52
|
|
this.transpose = CompatJsonUtils.asIntWithDefault(json, 0, Keyword.transpose); |
|
53
|
|
this.arpeggio = CompatJsonUtils.asIntWithDefault(json, 0, Keyword.arpeggio); |
|
54
|
|
this.noteMap = requireNonNull(noteMap); |
|
55
|
|
} |
|
56
|
|
|
|
57
|
|
/** |
|
58
|
|
* Returns a `$gate` value. |
|
59
|
|
* |
|
60
|
|
* @return a `$gate` value |
|
61
|
|
*/ |
|
62
|
|
public double gate() { |
|
63
|
1
1. gate : replaced double return with 0.0d for com/github/dakusui/symfonion/song/PartMeasureParameters::gate → KILLED
|
return this.gate; |
|
64
|
|
} |
|
65
|
|
|
|
66
|
|
/** |
|
67
|
|
* Returns a `$length` value. |
|
68
|
|
* |
|
69
|
|
* @return a `$length` value |
|
70
|
|
*/ |
|
71
|
|
public Fraction length() { |
|
72
|
1
1. length : replaced return value with null for com/github/dakusui/symfonion/song/PartMeasureParameters::length → KILLED
|
return this.length; |
|
73
|
|
} |
|
74
|
|
|
|
75
|
|
/** |
|
76
|
|
* Returns a `$transpose` value. |
|
77
|
|
* |
|
78
|
|
* @return a `$transpose` value |
|
79
|
|
*/ |
|
80
|
|
public int transpose() { |
|
81
|
1
1. transpose : replaced int return with 0 for com/github/dakusui/symfonion/song/PartMeasureParameters::transpose → SURVIVED
|
return this.transpose; |
|
82
|
|
} |
|
83
|
|
|
|
84
|
|
/** |
|
85
|
|
* Returns a `$velocitybase` value. |
|
86
|
|
* |
|
87
|
|
* @return a `$velocitybase` value |
|
88
|
|
*/ |
|
89
|
|
public int velocityBase() { |
|
90
|
1
1. velocityBase : replaced int return with 0 for com/github/dakusui/symfonion/song/PartMeasureParameters::velocityBase → SURVIVED
|
return this.velocityBase; |
|
91
|
|
} |
|
92
|
|
|
|
93
|
|
/** |
|
94
|
|
* A step value with which the velocity of a part measure is increased for a single accent sign. |
|
95
|
|
* |
|
96
|
|
* @return A step value for a velocity of a part measure. |
|
97
|
|
*/ |
|
98
|
|
public int velocityDelta() { |
|
99
|
1
1. velocityDelta : replaced int return with 0 for com/github/dakusui/symfonion/song/PartMeasureParameters::velocityDelta → SURVIVED
|
return this.velocityDelta; |
|
100
|
|
} |
|
101
|
|
|
|
102
|
|
/** |
|
103
|
|
* Returns a `$arpeggio` value. |
|
104
|
|
* |
|
105
|
|
* @return a `$arpeggio` value |
|
106
|
|
*/ |
|
107
|
|
public int arpeggio() { |
|
108
|
1
1. arpeggio : replaced int return with 0 for com/github/dakusui/symfonion/song/PartMeasureParameters::arpeggio → SURVIVED
|
return this.arpeggio; |
|
109
|
|
} |
|
110
|
|
} |
| | Mutations |
| 42 |
|
1.1 Location : <init> Killed by : com.github.dakusui.symfonion.tests.InvalidDataErrorTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.InvalidDataErrorTest]/[method:illegalNoteLength_02()] negated conditional → KILLED
|
| 49 |
|
1.1 Location : <init> Killed by : com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#4] negated conditional → KILLED
|
| 63 |
|
1.1 Location : gate Killed by : com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#7] replaced double return with 0.0d for com/github/dakusui/symfonion/song/PartMeasureParameters::gate → KILLED
|
| 72 |
|
1.1 Location : length Killed by : com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#4] replaced return value with null for com/github/dakusui/symfonion/song/PartMeasureParameters::length → KILLED
|
| 81 |
|
1.1 Location : transpose Killed by : none replaced int return with 0 for com/github/dakusui/symfonion/song/PartMeasureParameters::transpose → SURVIVED
Covering tests
Covered by tests:
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#4]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#8]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#13]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#10]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#9]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#11]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#12]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[method:pickupNotation_noteOnAtCorrectTick()]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#7]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#6]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#5]
- com.github.dakusui.symfonion.tests.cli.subcommands.CompatCompileTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.cli.subcommands.CompatCompileTest]/[method:test()]
- com.github.dakusui.symfonion.tests.ReferenceErrorTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.ReferenceErrorTest]/[method:missingPart()]
|
| 90 |
|
1.1 Location : velocityBase Killed by : none replaced int return with 0 for com/github/dakusui/symfonion/song/PartMeasureParameters::velocityBase → SURVIVED
Covering tests
Covered by tests:
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#4]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#8]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#13]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#10]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#9]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#11]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#12]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[method:pickupNotation_noteOnAtCorrectTick()]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#7]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#6]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#5]
- com.github.dakusui.symfonion.tests.cli.subcommands.CompatCompileTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.cli.subcommands.CompatCompileTest]/[method:test()]
- com.github.dakusui.symfonion.tests.ReferenceErrorTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.ReferenceErrorTest]/[method:missingPart()]
|
| 99 |
|
1.1 Location : velocityDelta Killed by : none replaced int return with 0 for com/github/dakusui/symfonion/song/PartMeasureParameters::velocityDelta → SURVIVED
Covering tests
Covered by tests:
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#4]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#8]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#13]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#10]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#9]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#11]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#12]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[method:pickupNotation_noteOnAtCorrectTick()]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#7]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#6]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#5]
- com.github.dakusui.symfonion.tests.cli.subcommands.CompatCompileTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.cli.subcommands.CompatCompileTest]/[method:test()]
- com.github.dakusui.symfonion.tests.ReferenceErrorTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.ReferenceErrorTest]/[method:missingPart()]
|
| 108 |
|
1.1 Location : arpeggio Killed by : none replaced int return with 0 for com/github/dakusui/symfonion/song/PartMeasureParameters::arpeggio → SURVIVED
Covering tests
Covered by tests:
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#4]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#8]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#13]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#10]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#9]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#11]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#12]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[method:pickupNotation_noteOnAtCorrectTick()]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#7]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#6]
- com.github.dakusui.symfonion.tests.MidiCompilerTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MidiCompilerTest]/[test-template:exercise(com.github.dakusui.symfonion.testutils.SymfonionTestCase)]/[test-template-invocation:#5]
- com.github.dakusui.symfonion.tests.cli.subcommands.CompatCompileTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.cli.subcommands.CompatCompileTest]/[method:test()]
- com.github.dakusui.symfonion.tests.ReferenceErrorTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.ReferenceErrorTest]/[method:missingPart()]
|