|
JavaGenes, NASA Ames. Written largely by Al Globus | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nasa.alsUtility.DoubleInterval
implements an interval between two double values
Field Summary | |
protected double |
bottom
the lowest value in the interval |
protected boolean |
includeBottom
does this interval include the bottom most value? |
protected boolean |
includeTop
does this interval include to most value? |
protected double |
top
the highest value in the interval |
Constructor Summary | |
DoubleInterval()
create an interval 0 to 1 |
|
DoubleInterval(double[] ofDoubles)
|
|
DoubleInterval(double x,
boolean includeX,
double y,
boolean includeY)
|
|
DoubleInterval(double x,
double y)
create an interval with between x and y. |
|
DoubleInterval(DoubleInterval i)
|
|
DoubleInterval(java.util.Vector ofDoubles)
|
Method Summary | |
double |
distanceFrom(double value)
how far outside of the interval is value? |
double |
equalIncrements(int divisions)
|
void |
expand(double factor)
change the interval of this by a factor keeping the center of the interval the same. |
void |
expandByAddition(double expandBy)
|
void |
extendIfNecessary(double d)
|
double |
get(int i)
|
double |
high()
|
double |
interval()
|
boolean |
isBetween(double value)
|
boolean |
isEmpty()
are there any numbers that fall within this interval? |
boolean |
isPositive()
|
double |
limitTo(double value)
|
DoubleInterval |
limitTo(DoubleInterval interval)
|
double |
low()
|
double |
midPoint()
|
boolean |
nearlyEqual(DoubleInterval other)
|
double |
random()
choose a random number in the interval (including the high and low values) |
double |
randomGaussian(double center,
double sd)
choose a random number in the interval from a Gaussian distribution |
double |
randomLog()
choose a random number in the interval (including the high and low values) from a log distribution |
double |
randomLogFromBothEnds()
choose a random number in the interval (including the high and low values) from a log distribution whether you start from the top or the bottom |
DoubleInterval |
set(double x,
boolean includeX,
double y,
boolean includeY)
|
DoubleInterval |
set(double x,
double y)
set the high and low values of the interval. |
DoubleInterval |
set(DoubleInterval interval)
make this equal to interval |
DoubleInterval |
setHigh(double v)
|
DoubleInterval |
setLow(double v)
|
void |
setToExtremes(double[] array)
set the bounds to the extreme values in array |
void |
setToExtremes(java.util.Vector ofDoubles)
|
DoubleInterval |
setToLog()
convert the top and bottom values to their natural logarithm |
double |
terpolate0to1(double value)
interpolate or exterpolate to a 0-1 space |
java.lang.String |
toString()
|
DoubleInterval |
translate(double distance)
add distance to the top and bottom |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected double bottom
protected double top
protected boolean includeBottom
protected boolean includeTop
Constructor Detail |
public DoubleInterval()
public DoubleInterval(double x, double y)
public DoubleInterval(double x, boolean includeX, double y, boolean includeY)
public DoubleInterval(DoubleInterval i)
public DoubleInterval(java.util.Vector ofDoubles)
public DoubleInterval(double[] ofDoubles)
Method Detail |
public boolean isPositive()
public void expand(double factor)
factor
- the factor by which to change the size of the interval. factor < 1 will
shrink the interval. factor > 1 will expand the interval. Negative factors
with be converted to positive.public void expandByAddition(double expandBy)
public double midPoint()
public DoubleInterval set(double x, double y)
public DoubleInterval setLow(double v)
public DoubleInterval setHigh(double v)
public DoubleInterval set(DoubleInterval interval)
public DoubleInterval set(double x, boolean includeX, double y, boolean includeY)
public DoubleInterval limitTo(DoubleInterval interval)
public boolean nearlyEqual(DoubleInterval other)
public double limitTo(double value)
public boolean isBetween(double value)
public double distanceFrom(double value)
public boolean isEmpty()
public void setToExtremes(double[] array)
public void setToExtremes(java.util.Vector ofDoubles)
public void extendIfNecessary(double d)
public java.lang.String toString()
public double random()
public double randomLogFromBothEnds()
public double randomGaussian(double center, double sd)
center
- the mean of the Gaussiansd
- the standard deviation of the Gaussianpublic double randomLog()
public double terpolate0to1(double value)
public DoubleInterval translate(double distance)
public DoubleInterval setToLog()
public double low()
public double high()
public double get(int i)
public double interval()
public double equalIncrements(int divisions)
|
JavaGenes, NASA Ames. Written largely by Al Globus | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |