|
@@ -241,7 +241,7 @@ export class SkyBottomLineCalculator {
|
|
|
* This method updates the BottomLine for a given range with a given value
|
|
|
* @param to update the BottomLine for
|
|
|
* @param start Start index of the range
|
|
|
- * @param end End index of the range
|
|
|
+ * @param end End index of the range (excluding)
|
|
|
* @param value ??
|
|
|
*/
|
|
|
public updateBottomLineInRange(startIndex: number, endIndex: number, value: number): void {
|
|
@@ -252,7 +252,7 @@ export class SkyBottomLineCalculator {
|
|
|
* Resets a SkyLine in a range to its original value
|
|
|
* @param to reset the SkyLine in
|
|
|
* @param startIndex Start index of the range
|
|
|
- * @param endIndex End index of the range
|
|
|
+ * @param endIndex End index of the range (excluding)
|
|
|
*/
|
|
|
public resetSkyLineInRange(startIndex: number, endIndex: number): void {
|
|
|
this.updateInRange(this.SkyLine, startIndex, endIndex);
|
|
@@ -339,7 +339,7 @@ export class SkyBottomLineCalculator {
|
|
|
* This method finds the SkyLine's minimum value within a given range.
|
|
|
* @param staffLine Staffline to apply to
|
|
|
* @param startIndex Starting index
|
|
|
- * @param endIndex End index
|
|
|
+ * @param endIndex End index (including)
|
|
|
*/
|
|
|
public getSkyLineMinInRange(startIndex: number, endIndex: number): number {
|
|
|
return this.getMinInRange(this.SkyLine, startIndex, endIndex);
|
|
@@ -362,7 +362,7 @@ export class SkyBottomLineCalculator {
|
|
|
* This method finds the BottomLine's maximum value within a given range.
|
|
|
* @param staffLine Staffline to find the max value in
|
|
|
* @param startIndex Start index of the range
|
|
|
- * @param endIndex End index of the range
|
|
|
+ * @param endIndex End index of the range (excluding)
|
|
|
*/
|
|
|
public getBottomLineMaxInRange(startIndex: number, endIndex: number): number {
|
|
|
return this.getMaxInRange(this.BottomLine, startIndex, endIndex);
|
|
@@ -413,7 +413,7 @@ export class SkyBottomLineCalculator {
|
|
|
* Update an array with the value given inside a range. NOTE: will only be updated if value > oldValue
|
|
|
* @param array Array to fill in the new value
|
|
|
* @param startIndex start index to begin with (default: 0)
|
|
|
- * @param endIndex end index of array (default: array length)
|
|
|
+ * @param endIndex end index of array (excluding, default: array length)
|
|
|
* @param value value to fill in (default: 0)
|
|
|
*/
|
|
|
private updateInRange(array: number[], startIndex: number = 0, endIndex: number = array.length, value: number = 0): void {
|
|
@@ -441,7 +441,7 @@ export class SkyBottomLineCalculator {
|
|
|
* Sets the value given to the range inside the array. NOTE: will always update the value
|
|
|
* @param array Array to fill in the new value
|
|
|
* @param startIndex start index to begin with (default: 0)
|
|
|
- * @param endIndex end index of array (default: array length)
|
|
|
+ * @param endIndex end index of array (excluding, default: array length)
|
|
|
* @param value value to fill in (default: 0)
|
|
|
*/
|
|
|
private setInRange(array: number[], startIndex: number = 0, endIndex: number = array.length, value: number = 0): void {
|
|
@@ -468,7 +468,7 @@ export class SkyBottomLineCalculator {
|
|
|
* Get all values of the selected line inside the given range
|
|
|
* @param skyBottomArray Skyline or bottom line
|
|
|
* @param startIndex start index
|
|
|
- * @param endIndex end index
|
|
|
+ * @param endIndex end index (including)
|
|
|
*/
|
|
|
private getMinInRange(skyBottomArray: number[], startIndex: number, endIndex: number): number {
|
|
|
startIndex = Math.floor(startIndex * this.SamplingUnit);
|
|
@@ -493,7 +493,7 @@ export class SkyBottomLineCalculator {
|
|
|
}
|
|
|
|
|
|
if (startIndex >= 0 && endIndex <= skyBottomArray.length) {
|
|
|
- return Math.min(...skyBottomArray.slice(startIndex, endIndex));
|
|
|
+ return Math.min(...skyBottomArray.slice(startIndex, endIndex + 1)); // slice does not include end (index)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -501,7 +501,7 @@ export class SkyBottomLineCalculator {
|
|
|
* Get the maximum value inside the given indices
|
|
|
* @param skyBottomArray Skyline or bottom line
|
|
|
* @param startIndex start index
|
|
|
- * @param endIndex end index
|
|
|
+ * @param endIndex end index (including)
|
|
|
*/
|
|
|
private getMaxInRange(skyBottomArray: number[], startIndex: number, endIndex: number): number {
|
|
|
startIndex = Math.floor(startIndex * this.SamplingUnit);
|
|
@@ -526,7 +526,7 @@ export class SkyBottomLineCalculator {
|
|
|
}
|
|
|
|
|
|
if (startIndex >= 0 && endIndex <= skyBottomArray.length) {
|
|
|
- return Math.max(...skyBottomArray.slice(startIndex, endIndex));
|
|
|
+ return Math.max(...skyBottomArray.slice(startIndex, endIndex + 1)); // slice does not include end (index)
|
|
|
}
|
|
|
}
|
|
|
// FIXME: What does this do here?
|