Class SubgraphDepthLocater.DepthSegment
- java.lang.Object
-
- org.locationtech.jts.operation.buffer.SubgraphDepthLocater.DepthSegment
-
- All Implemented Interfaces:
java.lang.Comparable
- Enclosing class:
- SubgraphDepthLocater
static class SubgraphDepthLocater.DepthSegment extends java.lang.Object implements java.lang.Comparable
A segment from a directed edge which has been assigned a depth value for its sides.
-
-
Field Summary
Fields Modifier and Type Field Description private int
leftDepth
private LineSegment
upwardSeg
-
Constructor Summary
Constructors Constructor Description DepthSegment(LineSegment seg, int depth)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(java.lang.Object obj)
Defines a comparison operation on DepthSegments which orders them left to right.private int
compareX(LineSegment seg0, LineSegment seg1)
Compare two collinear segments for left-most ordering.java.lang.String
toString()
-
-
-
Field Detail
-
upwardSeg
private LineSegment upwardSeg
-
leftDepth
private int leftDepth
-
-
Constructor Detail
-
DepthSegment
public DepthSegment(LineSegment seg, int depth)
-
-
Method Detail
-
compareTo
public int compareTo(java.lang.Object obj)
Defines a comparison operation on DepthSegments which orders them left to right. Assumes the segments are normalized.The definition of the ordering is:
- -1 : if DS1.seg is left of or below DS2.seg (DS1 < DS2)
- 1 : if DS1.seg is right of or above DS2.seg (DS1 > DS2)
- 0 : if the segments are identical
- The logic does not obey the
Comparator.compareTo
contract. This is acceptable for the intended usage, but may cause problems if used with some utilities in the Java standard library (e.g. {@link Collections.sort()}.
- Specified by:
compareTo
in interfacejava.lang.Comparable
- Parameters:
obj
- a DepthSegment- Returns:
- the comparison value
-
compareX
private int compareX(LineSegment seg0, LineSegment seg1)
Compare two collinear segments for left-most ordering. If segs are vertical, use vertical ordering for comparison. If segs are equal, return 0. Segments are assumed to be directed so that the second coordinate is >= to the first (e.g. up and to the right).- Parameters:
seg0
- a segment to compareseg1
- a segment to compare- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-