Subject: | |
From: | |
Reply To: | |
Date: | Fri, 6 Jan 2012 10:11:58 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On Jan 3, 2012, at 1:01 PM, Axelrod, Benjamin wrote:
> Is there any reason the sim.util.Interval class doesn’t have a method to test whether or not a value falls within the interval?
Absolutely none. I'll add it. Also I'll add contains(double) since contains(Number) only autoboxes in later versions of the language (and it not particularly efficient):
public boolean contains(Number val) { return contains(val.doubleValue()); }
public boolean contains(double val) { return (val >= min.doubleValue() && val <= max.doubleValue()); }
> It makes using dom sliders and bounds testing a little nicer. For example:
>
> public static double lambda = 1.0;
> public double getLambda() { return lambda; }
> public void setLambda(double val) { if (((Interval)domLambda()).contains(val)) lambda = val; }
> public Object domLambda() { return new Interval(0.0, 1.0); }
Sure.
Sean
|
|
|