Skip to content

Commit

Permalink
break some exceptionally long lines #143
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Aug 28, 2019
1 parent 7cded63 commit d470c6c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
13 changes: 8 additions & 5 deletions js/curve-fitting/model/Curve.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ define( require => {
* @public (read-only)
*/
getYValueAt( x ) {
assert && assert( this.coefficients.length === this.orderProperty.value + 1, `the coefficient array should be ${this.orderProperty.value} long but is ${this.coefficients.length}` );
assert && assert( this.coefficients.length === this.orderProperty.value + 1,
`the coefficient array should be ${this.orderProperty.value} long but is ${this.coefficients.length}` );

return this.coefficients.reduce( ( accumulator, value, index ) => accumulator + value * Math.pow( x, index ), 0 );
}
Expand Down Expand Up @@ -110,7 +111,8 @@ define( require => {
this.coefficients = this.getAdjustableFitCoefficients();
}

assert && assert( this.coefficients.length === this.orderProperty.value + 1, `the coefficient array should be ${this.orderProperty.value + 1} long but is ${this.coefficients.length}` );
assert && assert( this.coefficients.length === this.orderProperty.value + 1,
`the coefficient array should be ${this.orderProperty.value + 1} long but is ${this.coefficients.length}` );

// update the property values of r squared and chi squared
this.updateRAndChiSquared();
Expand Down Expand Up @@ -148,8 +150,8 @@ define( require => {
* chi squared ranges from 0 to infinity
*
* r squared ranges from 0 to 1 for 'best fit'
* it is possible for the adjustable fit to get such a bad fit that the standard r squared calculation would yield a negative value.
* For those cases, the r squared value to zero is set to zero.
* it is possible for the adjustable fit to get such a bad fit that the standard r squared calculation would
* yield a negative value. For those cases, the r squared value to zero is set to zero.
*
* @private
*/
Expand Down Expand Up @@ -318,7 +320,8 @@ define( require => {
}

bestFitCoefficients.forEach( ( value, index ) => {
assert && assert( typeof value === 'number' && isFinite( value ), `fit parameter: ${index} is not finite: ${value}` );
assert && assert( typeof value === 'number' && isFinite( value ),
`fit parameter: ${index} is not finite: ${value}` );
} );

return bestFitCoefficients;
Expand Down
7 changes: 4 additions & 3 deletions js/curve-fitting/model/CurveFittingModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ define( require => {
// @public {Property.<FitType>}, the method of fitting the curve to data points
this.fitProperty = new Property( FitType.BEST, { validValues: FitType.VALUES } );

// @public {Property.<number>[]}, user input values for coefficients of the polynomial, starting from lowest order x^0 to x^3
// @public {Property.<number>[]}, user input values for coefficients of the polynomial, starting from lowest
// order x^0 to x^3
this.sliderPropertyArray = [
new NumberProperty( CurveFittingConstants.CONSTANT_RANGE.defaultValue ),
new NumberProperty( CurveFittingConstants.LINEAR_RANGE.defaultValue ),
new NumberProperty( CurveFittingConstants.QUADRATIC_RANGE.defaultValue ),
new NumberProperty( CurveFittingConstants.CUBIC_RANGE.defaultValue )
];

// @public {Points} - Points for plotting curve. This includes points that are outside the bounds of the graph, so
// be careful to call getRelevantPoints when using points in calculations. Order of the points doesn't matter.
// @public {Points} - Points for plotting curve. This includes points that are outside the bounds of the graph,
// so be careful to call getRelevantPoints when using points in calculations. Order of the points doesn't matter.
this.points = new Points();

// @public {Curve} - the model of the curve
Expand Down
9 changes: 5 additions & 4 deletions js/curve-fitting/view/PointNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,11 @@ define( require => {
this.globalToLocalPoint( event.pointer.point ).y - circleView.centerY
);

// if initialTopBarDragLocation has a value, that means that it is intentionally so because the user can choose a drag direction
// the allowed direction of the top bar drag is now set by whether the user dragged up or down
// if the user dragged down, the top bar acts like the bottom bar because that is how the user interacted with it
// for this case, the user couldn't have interacted with the actual bottom bar because it was covered by this top one
// If initialTopBarDragLocation has a value, that means that it is intentionally so because the user can
// choose a drag direction the allowed direction of the top bar drag is now set by whether the user dragged
// up or down. If the user dragged down, the top bar acts like the bottom bar because that is how the user
// interacted with it for this case, the user couldn't have interacted with the actual bottom bar because
// it was covered by this top one.
if ( initialTopBarDragLocation !== null ) {
shouldTopBarActLikeBottomBar = event.pointer.point.y > initialTopBarDragLocation.y;
initialTopBarDragLocation = null;
Expand Down

0 comments on commit d470c6c

Please sign in to comment.