Skip to content

Commit

Permalink
Update NoteData.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
EngineMachiner authored Aug 10, 2023
1 parent e6820e8 commit bf98664
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/main/kotlin/com/enginemachiner/honkytones/NoteData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ object NoteData {
val newSet = mutableSetOf<String>()

for ( r in range ) {

val r2 = r.toString()

for ( t in template!! ) {

var s: String

if ( t.contains("-") ) {

val first = template.first()
Expand All @@ -82,28 +81,26 @@ object NoteData {
// Sort the pair values according to the range given
val start = t.substringBefore("-")[1].toString()
val end = t.substringAfter("-")[1].toString()
var start2 = r2; var end2 = r2
var start2 = r; var end2 = r

if ( start.toInt() < end.toInt() ) {
start2 = (r2.toInt() - 1).toString()
}
if ( start.toInt() < end.toInt() ) start2 = r - 1

if ( first.toInt() < end.toInt() ) {
val dif = end.toInt() - first.toInt()
start2 = (start2.toInt() + dif).toString()
end2 = (end2.toInt() + dif).toString()
start2 += dif; end2 += dif
}

newSet.add( t.replace( start, start2 ).replace( end, end2 ) )
s = t.replace( start, "$start2" ).replace( end, "$end2" )

} else {

val s = t.filter { !it.isDigit() }; var s2 = s + r2
if ( s.contains("_") ) { s2 = s[0] + r2 + s[1] }
newSet.add(s2)
val s2 = t.filter { !it.isDigit() }; s = s2 + r
if ( s2.contains('_') ) { s = t[0] + "$r" + "_" }

}

newSet.add(s)

}

}
Expand All @@ -112,4 +109,4 @@ object NoteData {

}

}
}

0 comments on commit bf98664

Please sign in to comment.