us.zuercher.gpx2map.data
Class TrackSegment

java.lang.Object
  extended by us.zuercher.gpx2map.data.TrackSegment
All Implemented Interfaces:
Iterable<TrackPoint>

public class TrackSegment
extends Object
implements Iterable<TrackPoint>

TrackSegment represents a track segment. Track segments are made up of zero or more TrackPoint objects.

Author:
Stephan Zuercher

Field Summary
private  List<TrackPoint> points
          TrackPoints that make up this TrackSegment.
 
Constructor Summary
TrackSegment()
          Construct a new TrackSegment.
 
Method Summary
 void addTrackPoint(TrackPoint point)
          Add a TrackPoint to this TrackSegment.
 boolean equals(Object other)
          Tests this TrackSegment for equality with another TrackSegment.
 boolean equals(TrackSegment other)
          Tests this TrackSegment for equality with another TrackSegment.
 int hashCode()
          Computes a reasonable hash code for this TrackSegment.
 Iterator<TrackPoint> iterator()
          Returns an iterator over the TrackPoints comprising this TrackSegment.
 String toExtendedString(String lineSep)
          Returns a complex string representation of this TrackSegement, using lineSep to delimit TrackPoint representations.
 String toString()
          Returns a simple string representation of this TrackSegment.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

points

private final List<TrackPoint> points
TrackPoints that make up this TrackSegment.

Constructor Detail

TrackSegment

public TrackSegment()
Construct a new TrackSegment.

Method Detail

addTrackPoint

public void addTrackPoint(TrackPoint point)
Add a TrackPoint to this TrackSegment.

Parameters:
point - the TrackPoint at add to this segment.

iterator

public Iterator<TrackPoint> iterator()
Returns an iterator over the TrackPoints comprising this TrackSegment.

Specified by:
iterator in interface Iterable<TrackPoint>
Returns:
an iterator over the TrackPoints comprising this TrackSegment.

hashCode

public int hashCode()
Computes a reasonable hash code for this TrackSegment.

Overrides:
hashCode in class Object
Returns:
a reasonable hash code for this TrackSegment.

equals

public boolean equals(TrackSegment other)
Tests this TrackSegment for equality with another TrackSegment.

Parameters:
other - another TrackSegment
Returns:
true if this TrackSegment and other are equal

equals

public boolean equals(Object other)
Tests this TrackSegment for equality with another TrackSegment.

Overrides:
equals in class Object
Parameters:
other - another TrackSegment
Returns:
true if this TrackSegment and other are equal
Throws:
ClassCastException - if other is not a TrackSegment.

toString

public String toString()
Returns a simple string representation of this TrackSegment.

Overrides:
toString in class Object
Returns:
a simple string representation of this TrackSegment.

toExtendedString

public String toExtendedString(String lineSep)
Returns a complex string representation of this TrackSegement, using lineSep to delimit TrackPoint representations.

Parameters:
lineSep - line separator
Returns:
a complex string representation of this TrackSegement.