From 0f0a66dc3bffcf42f574cf252a71078adcb200ce Mon Sep 17 00:00:00 2001 From: Bill Kuker Date: Thu, 4 Nov 2010 19:12:38 +0000 Subject: [PATCH] --- src/com/billkuker/rocketry/motorsim/grain/Star.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/billkuker/rocketry/motorsim/grain/Star.java b/src/com/billkuker/rocketry/motorsim/grain/Star.java index dc1d125..655daa5 100644 --- a/src/com/billkuker/rocketry/motorsim/grain/Star.java +++ b/src/com/billkuker/rocketry/motorsim/grain/Star.java @@ -95,7 +95,9 @@ public class Star extends ExtrudedShapeGrain implements Validating { return pointCount; } - public void setPointCount(final int points){ + public void setPointCount(final int points) throws PropertyVetoException{ + if ( points < 2 || points > 8 ) + throw new PropertyVetoException("Invalid number of points", null); pointCount = points; generateGeometry(); } @@ -117,5 +119,9 @@ public class Star extends ExtrudedShapeGrain implements Validating { throw new ValidationException(this, "Invalid Length"); if ( iD.isGreaterThan(oD) ) throw new ValidationException(this, "iD > oD"); + if ( iD.isGreaterThan(pD) ) + throw new ValidationException(this, "iD > pD"); + if ( pD.isGreaterThan(oD) ) + throw new ValidationException(this, "pD > oD"); } } -- 2.30.2