public class Channel extends Object
Channels are used by the ChannelBasedPathRouting
to route edges using
SegmentInfo
s describing their path.
Constructor and Description |
---|
Channel(SegmentInfo segment)
Creates a new
Channel that contains the given segment info . |
Modifier and Type | Method and Description |
---|---|
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()
Gets 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()
Gets 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()
Gets an
interval spanning the union of the location ranges of the segment infos . |
boolean |
isVertical()
Gets 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 . |
String |
toString()
Returns a string representation of this
Channel object. |
public Channel(SegmentInfo segment)
Channel
that contains the given segment info
.IllegalArgumentException
- if the given segment has a different orientation than the other segments already contained in the channelsegment
- the given segment info for which the Channel
is createdpublic void addSegment(SegmentInfo segment)
segment info
to the channel
.IllegalArgumentException
- if the given segment has a different orientation than the other segments already contained in the channelsegment
- the segment info to be added to this channelpublic void addSegmentGroup(SegmentGroup group)
segment group
to this channel
.group
- the segment group to be addedpublic YRectangle getBounds()
getWidthInterval()
,
getLengthInterval()
public double getCurrentLocation(SegmentInfo segmentInfo)
segment info
has been assigned within its
location range
.segmentInfo
- the segment info for which the current location will be returnedDouble.NaN
if no location has been assigned beforesetCurrentLocation(SegmentInfo, double)
public Interval getLengthInterval()
interval
spanning the union of the maximum extension of the segment infos
.AbstractSegmentInfo.getMaxExtension()
public SegmentInfo getSegment(int index)
segment info
with the given index in the list of segments of this
channel
.index
- the index of the segment in the list of segmentssegment info
with the given index in the list of segmentspublic SegmentGroup getSegmentGroup(int index)
segment group
with the given index in this channel
.index
- the index of the segment groupsegment group
with the given index in this channelpublic Interval getWidthInterval()
interval
spanning the union of the location ranges of the segment infos
.AbstractSegmentInfo.getLocationRange()
public boolean isVertical()
channel
are vertical.true
if the segments in this channel are vertical, false
otherwisepublic int segmentCount()
segment infos
in this channel.public int segmentGroupCount()
segment groups
in this channel
.public void setCurrentLocation(SegmentInfo segmentInfo, double location)
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
.
segmentInfo
- the segment info for which the current location will be setlocation
- the location of the segment info within its location rangeAbstractSegmentInfo.setLocation(double)