|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcsheets.ext.assertion.Interval
public class Interval
This class represents a non-empty interval.
A single number can be represented by setting lowerLimit == upperLimit
A one sided interval is represented by either setting upperLimit
to Double.POSITIVE_INFINITY or lowerLimit to Double.NEGATIVE_INFINITY.
| Constructor Summary | |
|---|---|
Interval(double constant)
Constructs a new instance of Interval containing a single value only. |
|
Interval(double lowerLimit,
double upperLimit,
boolean lowerLimitClosed,
boolean upperLimitClosed)
Constructs a new instance of Interval. |
|
| Method Summary | |
|---|---|
static Interval |
abs(Interval interval)
Calculates the absolute value Interval of an Interval |
static Interval |
add(Interval interval1,
Interval interval2)
Calculates the sum of two intervals |
static Interval |
avg(List<Interval> intervals)
Calculates the average interval for a List of intervals |
Interval |
clone()
|
int |
compareTo(Interval i)
Compares two intervals, by essentially comparing their lower limit. |
boolean |
contains(double value)
Indicates wether the specified value is contained in this Interval or not. |
static Interval |
cos(Interval interval)
Calculates the cosine interval of an interval. |
static Interval |
div(Interval interval1,
Interval interval2)
Calculates the quotient of two intervals |
boolean |
encloses(Interval interval)
Indicates wether this Interval fully encloses another interval. |
boolean |
equals(Object obj)
|
static Interval |
exp(Interval interval)
Calculates Eulers number e raised to an Interval |
static Interval |
fact(Interval interval)
Calculates the factorial of an Interval |
double |
getLowerLimit()
Return the lower limit of this Interval. |
double |
getUpperLimit()
Return the upper limit of this Interval. |
boolean |
intersects(Interval interval)
Indicates wether this interval intersects with another interval. |
boolean |
isLowerLimitClosed()
Indicates if this interval is closed at its lower limit or not (i.e. wether the value returned by getLowerLimit() is included in the interval
or not). |
boolean |
isUpperLimitClosed()
Indicates if this interval is closed at its upper limit or not (i.e. wether the value returned by getUpperLimit() is included in the interval
or not). |
static Interval |
ln(Interval interval)
Calculates the natural logarithm for an Interval |
static Interval |
log10(Interval interval)
Calculates the base 10 logarithm of an Interval |
static Interval |
mul(Interval interval1,
Interval interval2)
Calculates the product of two intervals |
static Interval |
negate(Interval interval)
Calculates the negation of an interval |
static Interval |
pow(Interval base,
Interval exponent)
Calculates the first Interval raised to the power of the second |
static Interval |
rand()
Returns an Interval holding all possible values you get from the Math.random() method |
static Interval |
sin(Interval interval)
Calculates the sine interval of an interval. |
double |
size()
Retrieve the size of this interval. |
static Interval |
sqrt(Interval interval)
Calculates the square root of an Interval |
static Interval |
sub(Interval interval1,
Interval interval2)
Calculates the difference between two intervals |
static Interval |
sum(List<Interval> intervals)
Calculates the sum of a List of intervals |
static Interval |
tan(Interval interval)
|
static Interval |
toInt(Interval interval)
Calculates the Interval you get if you convert the values from double to int |
String |
toString()
Converts this Interval into a string representation. |
static Interval |
union(Interval i1,
Interval i2)
Returns the union of two intersecting or bordering intervals. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Interval(double lowerLimit,
double upperLimit,
boolean lowerLimitClosed,
boolean upperLimitClosed)
throws IllegalArgumentException
lowerLimit - The value of the lower limit of this interval. This must be less than or equal to upperLimit.upperLimit - The value of the upper limit of this interval. This must be greater than or equal to lowerLimit.lowerLimitClosed - if true the value specified by lowerLimit will
be included in the interval, otherwise it will not be. Note that this must be false if
lowerLimit is infinite.upperLimitClosed - if true the value specified by upperLimit will
be included in the interval, otherwise it will not be. Note that this must be false if
upperLimit is infinite.
IllegalArgumentException - if illegal limits were passed. Limits must not be Double.NaNand
lowerLimit must be less than or equal to upperLimit.
public Interval(double constant)
throws IllegalArgumentException
constant - The single value this Interval should contain.
IllegalArgumentException - if constant is Double.NaN or infinite.| Method Detail |
|---|
public double getLowerLimit()
isLowerLimitClosed() returns false,
the value returned by this function is NOT part of the interval.
public double getUpperLimit()
isUpperLimitClosed() returns false,
the value returned by this function is NOT part of the interval.
public boolean isLowerLimitClosed()
getLowerLimit() is included in the interval
or not).
true if the value returned by getLowerLimit()
is included in the Interval, false otherwise.public boolean isUpperLimitClosed()
getUpperLimit() is included in the interval
or not).
true if the value returned by getUpperLimit()
is included in the Interval, false otherwise.public boolean contains(double value)
value - the value to check against this Interval.
true if value is contained in this Interval,
false otherwise.public boolean intersects(Interval interval)
interval - The interval to check this one against.
true if the intervals do intersect, false otherwise.public boolean encloses(Interval interval)
interval - The interval to check wether it is enclosed in this interval or not.
true if interval is fully enclosed within this Interval,
false otherwise.public boolean equals(Object obj)
equals in class Objectpublic int compareTo(Interval i)
compareTo in interface Comparable<Interval>i - the interval to compare this interval to.
public static Interval union(Interval i1,
Interval i2)
i1 - An intervali2 - An interval intersecting or bordering i1.
null if
the two intervals cannot be unioned into a single interval.public static Interval negate(Interval interval)
interval - is the interval
public static Interval add(Interval interval1,
Interval interval2)
interval1 - is the first intervalinterval2 - is the second interval
public static Interval sub(Interval interval1,
Interval interval2)
interval1 - is the first intervalinterval2 - is the second interval
public static Interval mul(Interval interval1,
Interval interval2)
interval1 - is the first intervalinterval2 - is the second interval
public static Interval cos(Interval interval)
public static Interval sin(Interval interval)
public static Interval tan(Interval interval)
throws MathException
MathException
public static Interval div(Interval interval1,
Interval interval2)
throws MathException
interval1 - is the first intervalinterval2 - is the second interval
ArithmeticException - if the second interval contains the value 0. Can't divide by zero.
MathException
public static Interval pow(Interval base,
Interval exponent)
throws MathException
Interval raised to the power of the second Interval
- Parameters:
base - is the first Intervalexponent - is the second Interval
- Returns:
- the first
Interval raised to the power of the second Interval
- Throws:
MathException - if the first Interval contains values below zero and the second Interval is not a singel integer value
public static Interval ln(Interval interval)
throws MathException
Interval
interval - is the Interval
Interval
MathException - if the Interval contains values below zero
public static Interval log10(Interval interval)
throws MathException
Interval
interval - is the Interval
Interval
MathException - if the Interval contains values below zeropublic static Interval exp(Interval interval)
Interval
interval - is the Interval
Interval
public static Interval sqrt(Interval interval)
throws MathException
Interval
interval - is the Interval
Interval
MathException - if the Interval contains values below zeropublic static Interval toInt(Interval interval)
Interval you get if you convert the values from double to int
interval - is the Interval
Interval you get if you convert the values from double to intpublic static Interval abs(Interval interval)
Interval of an Interval
interval - is the Interval
Interval of the Intervalpublic static Interval rand()
Interval holding all possible values you get from the Math.random() method
Interval holding all possible values you get from the Math.random() mathod
public static Interval fact(Interval interval)
throws MathException
Interval
interval - is the Interval
Interval
MathException - if the Interval contains values below zeropublic static Interval sum(List<Interval> intervals)
List of intervals
intervals - is the intervals to be summarized
Interval describing the sum of the intervalspublic static Interval avg(List<Interval> intervals)
List of intervals
intervals - is the intervals to calculate the average for
Interval describing the average of the intervalspublic Interval clone()
clone in class Objectpublic double size()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||