S
- the segment class whose projections the parts will store.public static class Segment.VerticalPart<S extends Segment>
extends java.lang.Object
implements java.lang.Comparable
Constructor and Description |
---|
VerticalPart(double top,
double bottom,
S segment)
Creates a new VerticalPart object.
|
VerticalPart(S segment)
Creates a new VerticalPart object as a projection of a Segment instance.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object op)
Compares this part to another
VerticalPart . |
double |
getBottom()
Returns the bottom ordinate of the part.
|
S |
getSegment()
Returns the ID of the segment this part belongs to.
|
double |
getTop()
Returns the top ordinate of the part.
|
boolean |
intersects(S segment)
Returns whether this part intersects the projection of the given segment.
|
public VerticalPart(double top, double bottom, S segment)
top
- the top ordinate of the partbottom
- the bottom ordinate of the partsegment
- the ID of the segment this part belongs topublic VerticalPart(S segment)
segment
- the Segment to projectpublic double getTop()
public double getBottom()
public S getSegment()
public boolean intersects(S segment)
segment
- - the segment to check for intersectionpublic int compareTo(java.lang.Object op)
VerticalPart
. Compares with a priority to the top
endpoint, than the bottom one.compareTo
in interface java.lang.Comparable
op
- the VerticalPart
to compare to