us.zuercher.gpx2map.data
Class Route

java.lang.Object
  extended by us.zuercher.gpx2map.data.AbstractGpxEntity
      extended by us.zuercher.gpx2map.data.Route
All Implemented Interfaces:
Iterable<RoutePoint>

public class Route
extends AbstractGpxEntity
implements Iterable<RoutePoint>

Route represents a GPX route. Routes are comprised of zero or more RoutePoint objects.

Route supports the following properties:

Name Type
name string
cmt string
desc string
src string
link string
type string
numberinteger

Author:
Stephan Zuercher

Field Summary
protected static Set<String> integerPropertyNames
          Integer property names.
private static List<String> nameLikePropertyNames
          Subset of stringPropertyNames.
private  List<RoutePoint> routePoints
          RoutePoints that comprise this Route.
protected static Set<String> stringPropertyNames
          String property names.
 
Fields inherited from class us.zuercher.gpx2map.data.AbstractGpxEntity
dateFormatter
 
Constructor Summary
Route()
          Constructs a new Route.
 
Method Summary
(package private)  void addRoutePoint(RoutePoint routePoint)
          Adds a RoutePoint to this route.
 boolean equals(Object other)
          Tests whether this Route is equal to another.
 boolean equals(Route other)
          Tests whether this Route is equal to another.
 Set<String> getDateTimePropertyNames()
          Returns an empty set.
 Set<String> getDecimalPropertyNames()
          Returns an empty set.
 Set<String> getIntegerPropertyNames()
          Returns the Route's integer property names.
 String getName()
          Get this route's name.
 Set<String> getStringPropertyNames()
          Returns the Route's string property names.
 int hashCode()
          Computes a reasonable hash code for this Route.
 Iterator<RoutePoint> iterator()
          Returns an Iterator over this Route's RoutePoints.
 String toExtendedString(String lineSep)
          Returns a string representation of this Route based on the Route's properties and RoutePoints.
 String toString()
          Returns a simple string representation of this Route based on the route's name, if any.
 
Methods inherited from class us.zuercher.gpx2map.data.AbstractGpxEntity
equals, getDateTimeProperty, getDecimalProperty, getIntegerProperty, getStringProperty, setDateTimeProperty, setDecimalProperty, setIntegerProperty, setStringProperty
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

stringPropertyNames

protected static final Set<String> stringPropertyNames
String property names.


nameLikePropertyNames

private static final List<String> nameLikePropertyNames
Subset of stringPropertyNames.


integerPropertyNames

protected static final Set<String> integerPropertyNames
Integer property names.


routePoints

private final List<RoutePoint> routePoints
RoutePoints that comprise this Route.

Constructor Detail

Route

public Route()
Constructs a new Route.

Method Detail

addRoutePoint

void addRoutePoint(RoutePoint routePoint)
Adds a RoutePoint to this route.

Parameters:
routePoint - the RoutePoint to add.

getName

public String getName()
Get this route's name. The name is the first of any of the nameLikePropertyNames set for this route.

Returns:
route's name, if available.

iterator

public Iterator<RoutePoint> iterator()
Returns an Iterator over this Route's RoutePoints.

Specified by:
iterator in interface Iterable<RoutePoint>
Returns:
an Iterator over this Route's RoutePoints.

hashCode

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

Overrides:
hashCode in class AbstractGpxEntity
Returns:
a reasonable hash code for this Route.

equals

public boolean equals(Route other)
Tests whether this Route is equal to another. Equality requires all Route properties and RoutePoints to be equal.

Parameters:
other - another Route
Returns:
true if the routes are equal, false otherwise

equals

public boolean equals(Object other)
Tests whether this Route is equal to another. Equality requires all Route properties and RoutePoints to be equal.

Overrides:
equals in class AbstractGpxEntity
Parameters:
other - another Route
Returns:
true if the routes are equal, false otherwise
Throws:
ClassCastException - if other is a not a Route

toString

public String toString()
Returns a simple string representation of this Route based on the route's name, if any.

Overrides:
toString in class AbstractGpxEntity
Returns:
a string representation of this Route.

toExtendedString

public String toExtendedString(String lineSep)
Returns a string representation of this Route based on the Route's properties and RoutePoints.

Parameters:
lineSep - line separate character
Returns:
string representation of this Route.

getStringPropertyNames

public Set<String> getStringPropertyNames()
Returns the Route's string property names.

Specified by:
getStringPropertyNames in class AbstractGpxEntity
Returns:
the Route's string property names.
See Also:
AbstractGpxEntity.getStringPropertyNames()

getDecimalPropertyNames

public Set<String> getDecimalPropertyNames()
Returns an empty set. Routes have no decimal properties.

Specified by:
getDecimalPropertyNames in class AbstractGpxEntity
Returns:
an empty set.
See Also:
AbstractGpxEntity.getDecimalPropertyNames()

getIntegerPropertyNames

public Set<String> getIntegerPropertyNames()
Returns the Route's integer property names.

Specified by:
getIntegerPropertyNames in class AbstractGpxEntity
Returns:
the Route's integer property names.
See Also:
AbstractGpxEntity.getIntegerPropertyNames()

getDateTimePropertyNames

public Set<String> getDateTimePropertyNames()
Returns an empty set. Routes have no date/tiem properties.

Specified by:
getDateTimePropertyNames in class AbstractGpxEntity
Returns:
an empty set.
See Also:
AbstractGpxEntity.getDateTimePropertyNames()