public class Segment extends java.lang.Object implements java.lang.Comparable<Segment>
| Modifier and Type | Class and Description |
|---|---|
static class |
Segment.VerticalPart<S extends Segment>
A class for storing sweep-line segment projections on vertical axis.
|
| Modifier and Type | Field and Description |
|---|---|
double |
end
The end coordinate of the segment.
|
double |
pos
The position of the segment.
|
double |
start
The start coordinate of the segment.
|
| Constructor and Description |
|---|
Segment(double pos,
double start,
double end)
Creates a new Segment object.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Segment s)
Compares the two specified segments by their
pos value. |
double |
getEnd()
Returns the end position of the segment.
|
double |
getPos()
Returns the segments position.
|
double |
getStart()
Returns the start position of the segment.
|
void |
setEnd(double end)
Sets the end position of the segment.
|
void |
setPos(double pos)
Changes the position of the segment without moving the corresponding element.
|
void |
setStart(double start)
Sets the start position of the segment.
|
public double pos
public double start
public double end
public Segment(double pos,
double start,
double end)
pos - the position of the new Segmentstart - the start of the new Segmentend - the end of the new Segmentpublic double getPos()
public void setPos(double pos)
pos - the new abscissapublic double getStart()
public double getEnd()
public void setStart(double start)
start - the new start position of the segment.public void setEnd(double end)
end - the new end position of the segment.public int compareTo(Segment s)
pos value.compareTo in interface java.lang.Comparable<Segment>s - the segment to compare topos are numerically equal; a value less than 0 if the
value of the first pos is numerically less than that of the second; and a value
greater than 0 if d1 the value of the first pos is numerically greater than that of
the second.