Package net.sf.eBusx.geo
Class LineString
- java.lang.Object
-
- net.sf.eBus.messages.EMessageObject
-
- net.sf.eBus.messages.EField
-
- net.sf.eBusx.geo.LineString
-
- All Implemented Interfaces:
java.io.Serializable
public final class LineString extends EField
Contains two or morePositions used to define a "line". The reason for the quotes is the the points may form a figure which may cross itself, form a closed polygon, or define a curve. It does not have to define a straight line.- Author:
- Charles W. Rapp
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLineString.BuilderBuilder class used to createLineStringinstances.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LineString.Builderbuilder()Returns a new line string builder instance.booleanequals(java.lang.Object o)Returnstrueifois a non-null Linestringwith a position array equalingthis LineStringposition array.inthashCode()Returns hash code of contained positions.booleanisClosed()Returnstrueif this line string has three or more positions and the first and last position are equal; otherwise returnsfalsebooleanisEmpty()Returnstrueif this line string has no positions.java.lang.StringtoString()Returns a single text line containing all the line string positions.
-
-
-
Field Detail
-
positions
public final Position[] positions
The multiple points defining this line string.
-
-
Method Detail
-
toString
public java.lang.String toString()
Returns a single text line containing all the line string positions.- Overrides:
toStringin classjava.lang.Object- Returns:
- text containing line string positions.
-
equals
public boolean equals(java.lang.Object o)
Returnstrueifois a non-null Linestringwith a position array equalingthis LineStringposition array. Otherwise returnsfalse.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- comparison object.- Returns:
trueifois a non-null Linestringwith a position array equalingthis LineStringposition array.
-
hashCode
public int hashCode()
Returns hash code of contained positions.- Overrides:
hashCodein classjava.lang.Object- Returns:
- contained positions hash code.
-
isEmpty
public boolean isEmpty()
Returnstrueif this line string has no positions.- Returns:
trueif this line string has no positions.
-
isClosed
public boolean isClosed()
Returnstrueif this line string has three or more positions and the first and last position are equal; otherwise returnsfalse- Returns:
trueif contains > 2 positions and the first and last positions are equal.
-
builder
public static LineString.Builder builder()
Returns a new line string builder instance.- Returns:
- new line string builder instance.
-
-