Search this API

y.layout.router.polyline
Class Channel

java.lang.Object
  extended by y.layout.router.polyline.Channel

public class Channel
extends java.lang.Object

This class describes a channel, i.e., a set of vertical or horizontal edge segments whose locations depend on each other.

Channels are used by the ChannelBasedPathRouting to route edges using SegmentInfos describing their path.

 

Constructor Summary
Channel(SegmentInfo segment)
          Creates a new Channel that contains the given segment info.
 
Method Summary
 void addSegment(SegmentInfo segment)
          Adds a new segment info to the channel.
 void addSegmentGroup(SegmentGroup group)
          Adds a segment group to this channel.
 YRectangle getBounds()
          Returns the bounds of this channel.
 double getCurrentLocation(SegmentInfo segmentInfo)
          Returns the current location that the given segment info has been assigned within its location range.
 Interval getLengthInterval()
          Returns an interval spanning the union of the maximum extension of the segment infos.
 SegmentInfo getSegment(int index)
          Returns the segment info with the given index in the list of segments of this channel.
 SegmentGroup getSegmentGroup(int index)
          Returns the segment group with the given index in this channel.
 Interval getWidthInterval()
          Returns an interval spanning the union of the location ranges of the segment infos.
 boolean isVertical()
          Determines whether or not the segments in this channel are vertical.
 int segmentCount()
          Returns the number of segment infos in this channel.
 int segmentGroupCount()
          Returns the number of segment groups in this channel.
 void setCurrentLocation(SegmentInfo segmentInfo, double location)
          Specifies the current location that the given segment info has been assigned within its location range.
 java.lang.String toString()
          Returns a string representation of this Channel object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Channel

public Channel(SegmentInfo segment)
Creates a new Channel that contains the given segment info.

Parameters:
segment - the given segment info for which the Channel is created
Throws:
java.lang.IllegalArgumentException - if the given segment has a different orientation than the other segments already contained in the channel
Method Detail

addSegment

public void addSegment(SegmentInfo segment)
Adds a new segment info to the channel.

Parameters:
segment - the segment info to be added to this channel
Throws:
java.lang.IllegalArgumentException - if the given segment has a different orientation than the other segments already contained in the channel

getWidthInterval

public Interval getWidthInterval()
Returns an interval spanning the union of the location ranges of the segment infos.

Returns:
an interval spanning the union of the location ranges of the contained segments
See Also:
AbstractSegmentInfo.getLocationRange()

getLengthInterval

public Interval getLengthInterval()
Returns an interval spanning the union of the maximum extension of the segment infos.

Returns:
an interval spanning the union of the maximum extension of the contained segments
See Also:
AbstractSegmentInfo.getMaxExtension()

segmentCount

public int segmentCount()
Returns the number of segment infos in this channel.

Returns:
the number of segment infos in this channel

isVertical

public boolean isVertical()
Determines whether or not the segments in this channel are vertical.

Returns:
true if the segments in this channel are vertical, false otherwise

getSegment

public SegmentInfo getSegment(int index)
Returns the segment info with the given index in the list of segments of this channel.

Parameters:
index - the index of the segment in the list of segments
Returns:
the segment info with the given index in the list of segments

segmentGroupCount

public int segmentGroupCount()
Returns the number of segment groups in this channel.

Returns:
the number of segment groups in this channel

addSegmentGroup

public void addSegmentGroup(SegmentGroup group)
Adds a segment group to this channel.

Parameters:
group - the segment group to be added

getSegmentGroup

public SegmentGroup getSegmentGroup(int index)
Returns the segment group with the given index in this channel.

Parameters:
index - the index of the segment group
Returns:
the segment group with the given index in this channel

getCurrentLocation

public double getCurrentLocation(SegmentInfo segmentInfo)
Returns the current location that the given segment info has been assigned within its location range.

Parameters:
segmentInfo - the segment info for which the current location will be returned
Returns:
the current location of the segment info or Double.NaN if no location has been assigned before
See Also:
setCurrentLocation(SegmentInfo, double)

setCurrentLocation

public void setCurrentLocation(SegmentInfo segmentInfo,
                               double location)
Specifies the current location that the given segment info has been assigned within its location range.

During the distribution of the segments in the channel, different locations can be assigned but only the last one is finally assigned to the segment info.

Parameters:
segmentInfo - the segment info for which the current location will be set
location - the location of the segment info within its location range
See Also:
AbstractSegmentInfo.setLocation(double)

getBounds

public YRectangle getBounds()
Returns the bounds of this channel.

These bounds are determined by the channel's width and length.

Returns:
the bounds of this channel
See Also:
getWidthInterval(), getLengthInterval()

toString

public java.lang.String toString()
Returns a string representation of this Channel object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this Channel object

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.