|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.router.polyline.Interval
public class Interval
This class represents a one-dimensional, closed interval.
Constructor Summary | |
---|---|
Interval(double bound1,
double bound2)
Creates a new interval between the given bounds. |
Method Summary | |
---|---|
static Interval |
calculateBridge(Interval i1,
Interval i2)
Returns the bridging interval between the given intervals. |
static Interval |
calculateIntersection(Interval i1,
Interval i2)
Returns the intersection of the given intervals. |
static YRectangle |
calculateSpanningRectangle(Interval horizontal,
Interval vertical)
Returns the spanning rectangle between the given intervals. |
static Interval |
calculateUnion(Interval interval,
double value)
Returns the union of the given interval and the given value. |
static Interval |
calculateUnion(Interval i1,
Interval i2)
Returns the union of the given intervals. |
boolean |
contains(double value)
Checks if the given value is inside the interval. |
boolean |
coveredBy(Interval other)
Checks if the given interval covers this interval fully. |
boolean |
coveredBy(Interval other,
double eps)
Checks if the given interval covers this interval fully. |
double |
distanceTo(double value)
Returns the distance between the value and the interval. |
double |
distanceTo(Interval other)
Returns the distance between this interval and the given interval. |
boolean |
equals(Object other)
Checks if this interval equals the given interval. |
double |
getCenter()
Returns the midpoint of the interval. |
double |
getClosest(double value)
Returns the interval bound that is closest to the given value. |
double |
getMax()
Returns the upper bound of the interval. |
double |
getMin()
Returns the lower bound of the interval. |
double |
getSize()
Returns the size of the interval. |
int |
hashCode()
Returns the hash code for this interval. |
boolean |
hasSameRange(Interval other)
Checks if this interval and the given interval cover about the same range. |
boolean |
hasSameRange(Interval other,
double eps)
Checks if this interval and the given interval cover the same range. |
boolean |
intersects(Interval other)
Checks if this interval intersects the given interval. |
boolean |
intersects(Interval other,
double minIntersection)
Checks if this interval intersects the given interval and the intersection has a length of at least minIntersection . |
boolean |
isGreaterThan(Interval other)
Checks if the lower bound of this interval is greater than the upper bound of the given interval. |
boolean |
isLessThan(Interval other)
Checks if the upper bound of this interval is lesser than the lower bound of the given interval. |
String |
toString()
Returns a string representation of this interval. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Interval(double bound1, double bound2)
bound1
- the first interval boundbound2
- the second interval boundMethod Detail |
---|
public double getMin()
public double getMax()
public double getCenter()
public boolean contains(double value)
value
- the value to check
true
, if the value is inside the interval, false
otherwise.public double getSize()
public boolean intersects(Interval other)
other
- the other interval to check
true
, if the intervals have at least one common value, false
otherwise.public boolean intersects(Interval other, double minIntersection)
minIntersection
.
other
- the other interval to checkminIntersection
- the minimal length the intervals have to intersect
true
, if the intervals intersect by at least minIntersection
, false
otherwise.public double distanceTo(double value)
If this interval contains the specified value, the distance is 0. Otherwise, it is the minimum of dist(value, lower bound) and dist(value, upper bound).
value
- the value to calculate the distance to
public double distanceTo(Interval other)
If the intervals intersects(y.layout.router.polyline.Interval)
, the distance is 0. Otherwise, it is dist(minimum of upper bounds, maximum of
lower bounds)."
other
- the other interval to calculate the distance to
public boolean coveredBy(Interval other)
The given interval covers this interval, if lower bound other - epsilon <= lower bound this
and
upper bound this <= upper bound other + epsilon
where epsilon
is a small value.
other
- the other interval
true
if this interval is fully covered by the other interval, false
otherwise.public boolean coveredBy(Interval other, double eps)
The given interval covers this interval, if lower bound other - epsilon <= lower bound this
and
upper bound this <= upper bound other + epsilon
.
other
- the other intervaleps
- The epsilon value the range of the other interval is extended.
true
if this interval is fully covered by the other interval, false
otherwise.public double getClosest(double value)
value
- the value to get the closest interval bound for
value
, if the given value is inside the interval, the lower bound if the given value is
lesser than or equal the lower bound and the upper bound if the given value is greater than or equal the upper
bound.public boolean isLessThan(Interval other)
other
- the interval to compare.
true
if the current interval is left of the given one, false
otherwise.public boolean isGreaterThan(Interval other)
other
- the interval to compare.
true
if the current interval is right of the given one, false
otherwise.public String toString()
toString
in class Object
public boolean hasSameRange(Interval other)
The intervals are considered to cover the same range, if their minimum values as well as their maximum values differ only in an epsilon value.
other
- the other interval
true
if the intervals cover the same range, false
otherwise.public boolean hasSameRange(Interval other, double eps)
other
- the other intervaleps
- The maximum distance between the two minimum and the two maximum values.
true
if the intervals cover the same range, false
otherwise.public static Interval calculateIntersection(Interval i1, Interval i2)
The intersection is null
if the given intervals do not intersect. Otherwise the intersection is
[maximum lower bounds, minimum upper bounds].
i1
- the first intervali2
- the second interval
null
if the intervals do not intersect.public static Interval calculateUnion(Interval i1, Interval i2)
The union is [minimum lower bounds, maximum upper bounds].
i1
- the first intervali2
- the second interval
public static Interval calculateUnion(Interval interval, double value)
The union is between the
minimal of the lower bound of interval
and value
and the maximum of the upper bound of
interval
and value
.
interval
- the interval to extendvalue
- the value to be in the union
public static Interval calculateBridge(Interval i1, Interval i2)
The bridging interval is null
if the given intervals intersect. Otherwise the bridging interval is
[minimum upper bounds, maximum lower bounds].
i1
- the first intervali2
- the second interval
null
if the intervals intersect.public static YRectangle calculateSpanningRectangle(Interval horizontal, Interval vertical)
The first interval spans the rectangle in horizontal dimension, the second interval in vertical dimension.
horizontal
- the interval that defines the location and length of the rectangle in horizontal dimensionvertical
- the interval that defines the location and length of the rectangle in vertical dimension
public boolean equals(Object other)
Two intervals are equal if the have the same lower and upper bounds.
equals
in class Object
other
- the other interval
true
if this and the given interval are equal, false
otherwise.public int hashCode()
hashCode
in class Object
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |