public final class WaySegment extends java.lang.Object implements java.lang.Comparable<WaySegment>
Modifier and Type | Field and Description |
---|---|
int |
lowerIndex
The index of one of the 2 nodes in the way.
|
Way |
way
The way.
|
Constructor and Description |
---|
WaySegment(Way w,
int i)
Constructs a new
WaySegment . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(WaySegment o) |
boolean |
equals(java.lang.Object o) |
static WaySegment |
forNodePair(Way way,
Node first,
Node second)
Determines and returns the way segment for the given way and node pair.
|
Node |
getFirstNode()
Returns the first node of the way segment.
|
Node |
getSecondNode()
Returns the second (last) node of the way segment.
|
int |
hashCode() |
boolean |
intersects(WaySegment s2)
Checks whether this segment crosses other segment
|
boolean |
isSimilar(WaySegment s2)
Checks whether this segment and another way segment share the same points
|
java.lang.String |
toString() |
Way |
toWay()
Returns this way segment as complete way.
|
public final int lowerIndex
lowerIndex + 1
.public WaySegment(Way w, int i)
WaySegment
.w
- The wayi
- The node lower indexjava.lang.IllegalArgumentException
- in case of invalid indexpublic Node getFirstNode()
public Node getSecondNode()
public static WaySegment forNodePair(Way way, Node first, Node second)
way
- wayfirst
- first nodesecond
- second nodejava.lang.IllegalArgumentException
- if the node pair is not part of waypublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(WaySegment o)
compareTo
in interface java.lang.Comparable<WaySegment>
public boolean intersects(WaySegment s2)
s2
- The other segmentpublic boolean isSimilar(WaySegment s2)
s2
- The other segmentpublic java.lang.String toString()
toString
in class java.lang.Object