Modifier | Constructor and Description |
---|---|
protected |
Interval(double a,
double b)
should not be ever called directly use intervalFactory for creation of Interval
|
protected |
Interval(double a,
double b,
int precision)
should not be ever called directly use intervalFactory for creation of Interval
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Interval other)
comparing intervals based on their endpoints
|
boolean |
contains(double value)
true if min <= value <= max
|
boolean |
contains(Interval other)
true if this minimum is <= other minimum and other maximum is <= this maximum
|
boolean |
containsWithoutEndpoints(double value)
true if min < value < max
|
boolean |
equals(java.lang.Object obj) |
double |
getMax()
maximal value of the interval
|
double |
getMidPoint()
((maximum - minimum)/2)+minimum
|
double |
getMin()
minimal value of the interval
|
int |
getPrecision()
get method for property
|
double |
getWidth()
maximum minus minimum
|
int |
hashCode() |
Interval |
intersection(Interval other)
intersection of the two intervals as a interval
|
boolean |
intersects(Interval other)
true if the two intervals intercts in any way
|
Interval |
intervalHull(Interval other)
construct interval hull of the two intervals
|
boolean |
isDegenerate()
true if minimum and maximum of the interval are equal
|
boolean |
isEndpoint(double value)
checks if the value is one of the endpoints of the interval
|
boolean |
isMorePositive()
return true if the midpoint of the interval is higher or equal to 0
|
boolean |
isNegative()
true if the higher value of the interval is lower then 0
|
boolean |
isNotNegative()
true if the lower value of the interval is higher or equal to 0
|
boolean |
isNotPositive()
true if the higher value of the interval is lower or equal then 0
|
boolean |
isPositive()
true if the lower value of the interval is higher to 0
|
void |
round(int numberOfDigits)
rounds the values of the interval to specified number of digits
|
java.lang.String |
toString() |
Interval |
union(Interval other)
union of the two intervals as a interval
|
protected Interval(double a, double b, int precision)
a
- b
- precision
- protected Interval(double a, double b)
a
- b
- public double getWidth()
public double getMin()
public double getMax()
public double getMidPoint()
public int getPrecision()
public boolean contains(double value)
value
- public boolean containsWithoutEndpoints(double value)
value
- public boolean contains(Interval other)
other
- public boolean isEndpoint(double value)
value
- public boolean isDegenerate()
public boolean intersects(Interval other)
other
- public Interval intersection(Interval other) throws java.lang.ArithmeticException
other
- java.lang.ArithmeticException
- if the two intervals does not intersect the intersection cannot be constructedpublic Interval union(Interval other) throws java.lang.ArithmeticException
other
- java.lang.ArithmeticException
- if the two intervals does not intersect the union cannot be constructedpublic Interval intervalHull(Interval other)
other
- public boolean isNegative()
public boolean isNotPositive()
public boolean isPositive()
public boolean isNotNegative()
public boolean isMorePositive()
public void round(int numberOfDigits)
numberOfDigits
- public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(Interval other)
compareTo
in interface java.lang.Comparable<Interval>
other
- public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object