Skip to content

Commit

Permalink
refactor(math/curves/radical): validate A != 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Baconing committed Sep 30, 2024
1 parent 8eb2556 commit 20168b9
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ public class RadicalCurve extends Curve {
* @param a The "A" variable in the curve equation.
* @param b The "B" variable in the curve equation.
* @param c The "C" variable in the curve equation.
* @throws IllegalArgumentException If A is 0.
*/
public RadicalCurve(double a, double b, double c) {
if (a == 0) throw new IllegalArgumentException("A cannot be 0.");

this.a = a;
this.b = b;
this.c = c;
Expand All @@ -48,8 +51,11 @@ public double getA() {
/**
* Sets the "A" variable in the curve equation.
* @param a The new "A" variable in the curve equation.
* @throws IllegalArgumentException If A is 0.
*/
public void setA(double a) {
if (a == 0) throw new IllegalArgumentException("A cannot be 0.");

this.a = a;
}

Expand Down

0 comments on commit 20168b9

Please sign in to comment.