MASON-INTEREST-L Archives

January 2012

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Fri, 6 Jan 2012 10:11:58 -0500
MIME-version:
1.0 (Apple Message framework v1084)
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Content-type:
text/plain; charset=windows-1252
Subject:
From:
Sean Luke <[log in to unmask]>
In-Reply-To:
Content-Transfer-Encoding:
8bit
Parts/Attachments:
text/plain (22 lines)
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

ATOM RSS1 RSS2