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.ComparableA segment from a directed edge which has been assigned a depth value for its sides.
-
-
Field Summary
Fields Modifier and Type Field Description private intleftDepthprivate LineSegmentupwardSeg
-
Constructor Summary
Constructors Constructor Description DepthSegment(LineSegment seg, int depth)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Object obj)Defines a comparison operation on DepthSegments which orders them left to right.private intcompareX(LineSegment seg0, LineSegment seg1)Compare two collinear segments for left-most ordering.java.lang.StringtoString()
-
-
-
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.compareTocontract. 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:
compareToin 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:
toStringin classjava.lang.Object
-
-