Packagecom.yworks.yfiles.geom
Classpublic class BorderLine
InheritanceBorderLine Inheritance YObject Inheritance Object

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.



Public Properties
 PropertyDefined By
  max : Number
[read-only] Returns the greatest position of this borderline
BorderLine
  maxValue : Number
[read-only] Returns the maximum value that is set on this borderline
BorderLine
  min : Number
[read-only] Returns the smallest position of this borderline
BorderLine
  minValue : Number
[read-only] Returns the minimum value that is set on this borderline
BorderLine
Public Methods
 MethodDefined By
  
BorderLine(min:Number, max:Number, value:Number, init:Boolean = true)
Creates a new BorderLine from a single segment.
BorderLine
  
addOffset(delta:Number):void
Adds the given offset to the segments' positions.
BorderLine
  
addValueOffset(delta:Number):void
Adds the given offset to the current values of the whole borderline.
BorderLine
  
Convenience method that copies the actual data from the given argument to this instance.
BorderLine
  
createCopy(negateValues:Boolean, negateOffsets:Boolean):BorderLine
Creates a copy of this borderline.
BorderLine
  
Merges this borderline with the given borderline using the "maximum" policy.
BorderLine
  
Merges this borderline with the given borderline using the "minimum" policy.
BorderLine
 Inherited
equals(o:Object):Boolean
YObject
  
Returns the first segment or null if there is no such segment.
BorderLine
  
getClass():Class
[override]
BorderLine
  
getDistanceTo(greater:BorderLine):Number
Calculates the minimal distance between this borderline and the other one.
BorderLine
  
Returns the maximum position of the given segment.
BorderLine
  
getMaxValue(from:Number, to:Number):Number
Calculates the maximum value in the interval from->to.
BorderLine
  
Returns the minimum position of the given segment.
BorderLine
  
getMinValue(from:Number, to:Number):Number
Calculates the minimum value in the interval from->to.
BorderLine
  
Returns the segment at the given position.
BorderLine
  
Returns the slope of the given segment.
BorderLine
  
Returns the value of the minimum of the given segment.
BorderLine
  
getValueAt(pos:Number):Number
Returns the value that is set on this borderline at the specified position.
BorderLine
  
getValueAt2(cell:ListCell, pos:Number):Number
Returns the value that is set on this borderline at the specified position.
BorderLine
  
getValueAt3(segment:BorderLine_Segment, pos:Number):Number
Returns the value that is set on this borderline at the specified position.
BorderLine
  
grow(toMin:Number, toMax:Number, positive:Boolean):void
Grows this BorderLine horizontally, so that the values (getValueAt3()) of the BorderLine stay the same however their start (getMin()) and end (getMax()) points are moved in the direction of toMin and toMax.
BorderLine
 Inherited
hashCode():int
YObject
  
Returns the last segment or null if there is no such segment.
BorderLine
  
Merges this borderline with the given borderline using the "maximum" policy.
BorderLine
  
Merges this borderline with the given borderline using the "minimum" policy.
BorderLine
  
[static] Creates a new BorderLine with the given value from -Double.MAX_VALUE to Double.MAX_VALUE.
BorderLine
  
newBorderLine2(min:Number, max:Number, value:Number):BorderLine
[static] Creates a new BorderLine from a single segment.
BorderLine
  
newBorderLine3(min:Number, max:Number, valueAtMin:Number, valueAtMax:Number):BorderLine
[static] Creates a new BorderLine from a single segment.
BorderLine
  
Returns the next segment or null if there is no such segment.
BorderLine
  
Returns the previous segment or null if there is no such segment.
BorderLine
  
setMaxValue(min:Number, max:Number, value:Number):void
Assures that all values in the given interval are greater or equal than the given value.
BorderLine
  
setMinValue(min:Number, max:Number, value:Number):void
Assures that all values in the given interval are less or equal than the given value.
BorderLine
  
setSloped(min:Number, max:Number, value:Number, slope:Number):void
Sets a specific interval to a slope starting at a given value.
BorderLine
  
setValue(min:Number, max:Number, value:Number):void
Sets a specific interval described by min and max to a given value.
BorderLine
  
toString():String
Returns a lengthy String representation of this borderline.
BorderLine
Protected Methods
 MethodDefined By
  
initBorderLine1(value:Number):void
Initializes this object.
BorderLine
  
initBorderLine2(min:Number, max:Number, value:Number):void
Initializes this object.
BorderLine
  
initBorderLine3(min:Number, max:Number, valueAtMin:Number, valueAtMax:Number):void
Initializes this object.
BorderLine
Property Detail
maxproperty
max:Number  [read-only]

Returns the greatest position of this borderline


Implementation
    public function get max():Number
maxValueproperty 
maxValue:Number  [read-only]

Returns the maximum value that is set on this borderline


Implementation
    public function get maxValue():Number
minproperty 
min:Number  [read-only]

Returns the smallest position of this borderline


Implementation
    public function get min():Number
minValueproperty 
minValue:Number  [read-only]

Returns the minimum value that is set on this borderline


Implementation
    public function get minValue():Number
Constructor Detail
BorderLine()Constructor
public function BorderLine(min:Number, max:Number, value:Number, init:Boolean = true)

Creates a new BorderLine from a single segment.

Parameters
min:Number — the beginning of this borderline
 
max:Number — the ending of this borderline
 
value:Number — the value of the segment
 
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
addOffset()method
public function addOffset(delta:Number):void

Adds the given offset to the segments' positions. This method has complexity O(1).

Parameters

delta:Number — the delta to add to the positions

addValueOffset()method 
public function addValueOffset(delta:Number):void

Adds the given offset to the current values of the whole borderline. This method has complexity O(1).

Parameters

delta:Number — the delta to add to the values

adoptValues()method 
public function adoptValues(other:BorderLine):void

Convenience method that copies the actual data from the given argument to this instance.

Parameters

other:BorderLine — the argument to retrieve the values from

createCopy()method 
public function createCopy(negateValues:Boolean, negateOffsets:Boolean):BorderLine

Creates a copy of this borderline. Optionally negates the values or offsets.

Parameters

negateValues:Boolean — whether the values are negated
 
negateOffsets:Boolean — whether the offsets are negated

Returns
BorderLine — the copy of the borderline
createMax()method 
public function createMax(other:BorderLine):BorderLine

Merges this borderline with the given borderline using the "maximum" policy. That means the resulting borderline will have greater value of both borderline on each position. If you imagine each borderline as a the upper border of a plane, the resulting borderline will be the upper border of the merged planes.

Parameters

other:BorderLine — the other borderline

Returns
BorderLine — a new borderline that is the result of the merge
createMin()method 
public function createMin(other:BorderLine):BorderLine

Merges this borderline with the given borderline using the "minimum" policy. That means the resulting borderline will have smaller value of both borderline on each position. If you imagine each borderline as a the lower border of a plane, the resulting borderline will be the lower border of the merged planes.

Parameters

other:BorderLine — the other borderline

Returns
BorderLine — a new borderline that is the result of the merge
firstSegment()method 
public function firstSegment():BorderLine_Segment

Returns the first segment or null if there is no such segment.

Returns
BorderLine_Segment
getClass()method 
override public function getClass():Class

Returns
Class
getDistanceTo()method 
public function getDistanceTo(greater:BorderLine):Number

Calculates the minimal distance between this borderline and the other one. The other one is treated as if the values were all greater.

Parameters

greater:BorderLine

Returns
Number
getMax()method 
public function getMax(s:BorderLine_Segment):Number

Returns the maximum position of the given segment.

Parameters

s:BorderLine_Segment — the segment

Returns
Number
getMaxValue()method 
public function getMaxValue(from:Number, to:Number):Number

Calculates the maximum value in the interval from->to.

Parameters

from:Number
 
to:Number

Returns
Number
getMin()method 
public function getMin(s:BorderLine_Segment):Number

Returns the minimum position of the given segment.

Parameters

s:BorderLine_Segment — the segment

Returns
Number
getMinValue()method 
public function getMinValue(from:Number, to:Number):Number

Calculates the minimum value in the interval from->to.

Parameters

from:Number
 
to:Number

Returns
Number
getSegmentAt()method 
public function getSegmentAt(pos:Number):BorderLine_Segment

Returns the segment at the given position.

Parameters

pos:Number — the position

Returns
BorderLine_Segment
getSlope()method 
public function getSlope(s:BorderLine_Segment):Number

Returns the slope of the given segment.

Parameters

s:BorderLine_Segment — the segment

Returns
Number
getValue()method 
public function getValue(s:BorderLine_Segment):Number

Returns the value of the minimum of the given segment. If the segment's slope is 0, it's the value of the whole segment. In case the slope differs from 0, it's the value of the start of the slope.

Parameters

s:BorderLine_Segment — the segment

Returns
Number
getValueAt()method 
public function getValueAt(pos:Number):Number

Returns the value that is set on this borderline at the specified position.

Parameters

pos:Number — the position

Returns
Number — the value

Throws
RangeError — if the position is outside of the borderline.
getValueAt2()method 
public function getValueAt2(cell:ListCell, pos:Number):Number

Returns the value that is set on this borderline at the specified position. The position must lie within the range of the segment that is stored in cell.

Parameters

cell:ListCell — The list cell containing the segment whose value shall be returned.
 
pos:Number — the position

Returns
Number — the value

Throws
IllegalArgumentException — if pos is outside the segment's range that is stored in cell.
getValueAt3()method 
public function getValueAt3(segment:BorderLine_Segment, pos:Number):Number

Returns the value that is set on this borderline at the specified position. The position must lie within the range of the segment.

Parameters

segment:BorderLine_Segment — The segment whose value shall be returned.
 
pos:Number — the position where the value will be retrieved.

Returns
Number — the value

Throws
IllegalArgumentException — if pos is outside the segment's range.
grow()method 
public function grow(toMin:Number, toMax:Number, positive:Boolean):void

Grows this BorderLine horizontally, so that the values (getValueAt3()) of the BorderLine stay the same however their start (getMin()) and end (getMax()) 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.

Note that this method normalizes the segments, i.e., it transforms each segment with slope != 0 to a segment with slope == 0.

Parameters

toMin:Number — the delta by which the border should be extended towards -Infinity
 
toMax:Number — the delta by which the border should be extended towards +Infinity
 
positive:Boolean — whether the BorderLine should be interpreted to point in positive direction. This influences the direction into which a segment's border is extended.

See also

initBorderLine1()method 
protected final function initBorderLine1(value:Number):void

Initializes this object. See the documentation of the corresponding factory method newBorderLine1() for details.

Parameters

value:Number

See also

initBorderLine2()method 
protected final function initBorderLine2(min:Number, max:Number, value:Number):void

Initializes this object. See the documentation of the corresponding factory method newBorderLine2() for details.

Parameters

min:Number
 
max:Number
 
value:Number

See also

initBorderLine3()method 
protected final function initBorderLine3(min:Number, max:Number, valueAtMin:Number, valueAtMax:Number):void

Initializes this object. See the documentation of the corresponding factory method newBorderLine3() for details.

Parameters

min:Number
 
max:Number
 
valueAtMin:Number
 
valueAtMax:Number

See also

lastSegment()method 
public function lastSegment():BorderLine_Segment

Returns the last segment or null if there is no such segment.

Returns
BorderLine_Segment
mergeWithMax()method 
public function mergeWithMax(other:BorderLine):void

Merges this borderline with the given borderline using the "maximum" policy.

Parameters

other:BorderLine — the other borderline

mergeWithMin()method 
public function mergeWithMin(other:BorderLine):void

Merges this borderline with the given borderline using the "minimum" policy.

Parameters

other:BorderLine — the other borderline

newBorderLine1()method 
public static function newBorderLine1(value:Number):BorderLine

Creates a new BorderLine with the given value from -Double.MAX_VALUE to Double.MAX_VALUE.

Parameters

value:Number — the value of the segment

Returns
BorderLine
newBorderLine2()method 
public static function newBorderLine2(min:Number, max:Number, value:Number):BorderLine

Creates a new BorderLine from a single segment.

Parameters

min:Number — the beginning of this borderline
 
max:Number — the ending of this borderline
 
value:Number — the value of the segment

Returns
BorderLine
newBorderLine3()method 
public static function newBorderLine3(min:Number, max:Number, valueAtMin:Number, valueAtMax:Number):BorderLine

Creates a new BorderLine from a single segment.

Parameters

min:Number — the beginning of this borderline
 
max:Number — the ending of this borderline
 
valueAtMin:Number — the value of the segment at the beginning of this borderline
 
valueAtMax:Number — the value of the segment at the ending of this borderline

Returns
BorderLine
next()method 
public function next(s:BorderLine_Segment):BorderLine_Segment

Returns the next segment or null if there is no such segment.

Parameters

s:BorderLine_Segment

Returns
BorderLine_Segment
prev()method 
public function prev(s:BorderLine_Segment):BorderLine_Segment

Returns the previous segment or null if there is no such segment.

Parameters

s:BorderLine_Segment

Returns
BorderLine_Segment
setMaxValue()method 
public function setMaxValue(min:Number, max:Number, value:Number):void

Assures that all values in the given interval are greater or equal than the given value.

Parameters

min:Number — the lower end of the interval
 
max:Number — the upper end of the interval
 
value:Number — the smallest possible value for the interval

setMinValue()method 
public function setMinValue(min:Number, max:Number, value:Number):void

Assures that all values in the given interval are less or equal than the given value.

Parameters

min:Number — the lower end of the interval
 
max:Number — the upper end of the interval
 
value:Number — the greatest possible value for the interval

setSloped()method 
public function setSloped(min:Number, max:Number, value:Number, slope:Number):void

Sets a specific interval to a slope starting at a given value.

Parameters

min:Number — the left side of the interval.
 
max:Number — the right side of the interval.
 
value:Number — the value at min where the slope starts.
 
slope:Number — the slope of the segment in the given interval.


Throws
IllegalArgumentException — if min is greater than max.
setValue()method 
public function setValue(min:Number, max:Number, value:Number):void

Sets a specific interval described by min and max to a given value.

Parameters

min:Number — the left side of the interval.
 
max:Number — the right side of the interval.
 
value:Number — the value for the whole interval.

toString()method 
public function toString():String

Returns a lengthy String representation of this borderline.

Returns
String