|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.geom.BorderLine
public class BorderLine
This class can be used to easily model an orthogonal border line or sky-line. It provides methods for measuring the distance between different BorderLine instances, merging multiple instances, modifying and efficiently moving them around.
Nested Class Summary | |
---|---|
static class |
BorderLine.Segment
The handle of a segment of a borderline. |
Constructor Summary | |
---|---|
BorderLine(double value)
Creates a new BorderLine with the given value from -Double.MAX_VALUE to Double.MAX_VALUE. |
|
BorderLine(double min,
double max,
double value)
Creates a new BorderLine from a single segment. |
|
BorderLine(double min,
double max,
double valueAtMin,
double valueAtMax)
Creates a new BorderLine from a single segment. |
Method Summary | |
---|---|
void |
addOffset(double delta)
Adds the given offset to the segments' positions. |
void |
addValueOffset(double delta)
Adds the given offset to the current values of the whole borderline. |
void |
adoptValues(BorderLine other)
Convenience method that copies the actual data from the given argument to this instance. |
BorderLine |
createCopy(boolean negateValues,
boolean negateOffsets)
Creates a copy of this borderline. |
BorderLine |
createMax(BorderLine other)
Merges this borderline with the given borderline using the "maximum" policy. |
BorderLine |
createMin(BorderLine other)
Merges this borderline with the given borderline using the "minimum" policy. |
BorderLine.Segment |
firstSegment()
Returns the first segment or null if there is
no such segment. |
double |
getDistanceTo(BorderLine greater)
Calculates the minimal distance between this borderline and the other one. |
double |
getMax()
Returns the greatest position of this borderline |
double |
getMax(BorderLine.Segment s)
Returns the maximum position of the given segment. |
double |
getMaxValue()
Returns the maximum value that is set on this borderline |
double |
getMaxValue(double from,
double to)
Calculates the maximum value in the interval from->to. |
double |
getMin()
Returns the smallest position of this borderline |
double |
getMin(BorderLine.Segment s)
Returns the minimum position of the given segment. |
double |
getMinValue()
Returns the minimum value that is set on this borderline |
double |
getMinValue(double from,
double to)
Calculates the minimum value in the interval from->to. |
BorderLine.Segment |
getSegmentAt(double pos)
Returns the segment at the given position. |
double |
getSlope(BorderLine.Segment s)
Returns the slope of the given segment. |
double |
getValue(BorderLine.Segment s)
Returns the value of the minimum of the given segment. |
double |
getValueAt(BorderLine.Segment segment,
double pos)
Returns the value that is set on this borderline at the specified position. |
double |
getValueAt(double pos)
Returns the value that is set on this borderline at the specified position. |
double |
getValueAt(ListCell cell,
double pos)
Returns the value that is set on this borderline at the specified position. |
void |
grow(double toMin,
double toMax,
boolean positive)
Grows this BorderLine horizontally, so that the getValueAt(y.geom.BorderLine.Segment, double) values}
of the BorderLine stay the same however their start and
end points are moved in the direction of toMin
and toMax . |
BorderLine.Segment |
lastSegment()
Returns the last segment or null if there is
no such segment. |
void |
mergeWithMax(BorderLine other)
Merges this borderline with the given borderline using the "maximum" policy. |
void |
mergeWithMin(BorderLine other)
Merges this borderline with the given borderline using the "minimum" policy. |
BorderLine.Segment |
next(BorderLine.Segment s)
Returns the next segment or null if there is
no such segment. |
BorderLine.Segment |
prev(BorderLine.Segment s)
Returns the previous segment or null if there is
no such segment. |
void |
setMaxValue(double min,
double max,
double value)
Assures that all values in the given interval are greater or equal than the given value. |
void |
setMinValue(double min,
double max,
double value)
Assures that all values in the given interval are less or equal than the given value. |
void |
setSloped(double min,
double max,
double value,
double slope)
Sets a specific interval to a slope starting at a given value. |
void |
setValue(double min,
double max,
double value)
Sets a specific interval described by min and max to a given value. |
String |
toString()
Returns a lengthy String representation of this borderline. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BorderLine(double value)
value
- the value of the segmentpublic BorderLine(double min, double max, double value)
min
- the beginning of this borderlinemax
- the ending of this borderlinevalue
- the value of the segmentpublic BorderLine(double min, double max, double valueAtMin, double valueAtMax)
min
- the beginning of this borderlinemax
- the ending of this borderlinevalueAtMin
- the value of the segment at the beginning of this borderlinevalueAtMax
- the value of the segment at the ending of this borderlineMethod Detail |
---|
public BorderLine createCopy(boolean negateValues, boolean negateOffsets)
negateValues
- whether the values are negatednegateOffsets
- whether the offsets are negated
public void setMinValue(double min, double max, double value)
min
- the lower end of the intervalmax
- the upper end of the intervalvalue
- the greatest possible value for the intervalpublic void setMaxValue(double min, double max, double value)
min
- the lower end of the intervalmax
- the upper end of the intervalvalue
- the smallest possible value for the intervalpublic void adoptValues(BorderLine other)
other
- the argument to retrieve the values frompublic void setValue(double min, double max, double value)
min
and max
to a given value.
min
- the left side of the interval.max
- the right side of the interval.value
- the value for the whole interval.public void setSloped(double min, double max, double value, double slope)
IllegalArgumentException
- if min
is greater than max
.min
- the left side of the interval.max
- the right side of the interval.value
- the value at min
where the slope starts.slope
- the slope of the segment in the given interval.public void addValueOffset(double delta)
delta
- the delta to add to the valuespublic void addOffset(double delta)
delta
- the delta to add to the positionspublic double getMin()
public double getMax()
public double getMinValue()
public double getMaxValue()
public double getValueAt(double pos)
IndexOutOfBoundsException
- if the position is outside of the borderline.pos
- the position
public double getValueAt(ListCell cell, double pos)
cell
.
IllegalArgumentException
- if pos
is outside the segment's range that is stored in cell
.cell
- The list cell containing the segment whose value shall be returned.pos
- the position
public double getValueAt(BorderLine.Segment segment, double pos)
IllegalArgumentException
- if pos
is outside the segment's range.segment
- The segment whose value shall be returned.pos
- the position where the value will be retrieved.
public BorderLine createMax(BorderLine other)
other
- the other borderline
public BorderLine createMin(BorderLine other)
other
- the other borderline
public void mergeWithMax(BorderLine other)
other
- the other borderlinepublic void mergeWithMin(BorderLine other)
other
- the other borderlinepublic double getValue(BorderLine.Segment s)
s
- the segmentpublic double getMin(BorderLine.Segment s)
s
- the segmentpublic double getSlope(BorderLine.Segment s)
s
- the segmentpublic BorderLine.Segment getSegmentAt(double pos)
pos
- the positionpublic double getMax(BorderLine.Segment s)
s
- the segmentpublic BorderLine.Segment firstSegment()
null
if there is
no such segment.
public BorderLine.Segment lastSegment()
null
if there is
no such segment.
public BorderLine.Segment prev(BorderLine.Segment s)
null
if there is
no such segment.
public BorderLine.Segment next(BorderLine.Segment s)
null
if there is
no such segment.
public double getMaxValue(double from, double to)
public double getMinValue(double from, double to)
public double getDistanceTo(BorderLine greater)
public String toString()
toString
in class Object
public void grow(double toMin, double toMax, boolean positive)
getValueAt(y.geom.BorderLine.Segment, double)
values}
of the BorderLine stay the same however their start
and
end
points are moved in the direction of toMin
and toMax
.
This is useful for scenarios where a BorderLine is needed that consists of an enlarged border.
toMin
- the delta by which the border should be extended towards -InfinitytoMax
- the delta by which the border should be extended towards +Infinitypositive
- whether the BorderLine should be interpreted to point in positive direction. This influences the
direction into which a segment's border is extended.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |