Sender: |
|
Date: |
Fri, 6 Jan 2012 10:11:58 -0500 |
MIME-version: |
1.0 (Apple Message framework v1084) |
Reply-To: |
|
Content-type: |
text/plain; charset=windows-1252 |
Subject: |
|
From: |
|
In-Reply-To: |
|
Content-Transfer-Encoding: |
8bit |
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
|
|
|