package de.mrunde.bachelorthesis.instructions;

import com.mapquest.android.maps.GeoPoint;

import de.mrunde.bachelorthesis.basics.Maneuver;

/**
 * This is a distance-based instruction.
 * 
 * @author Marius Runde
 */
public class DistanceInstruction extends Instruction {

	/**
	 * Distance to the decision point
	 */
	private int distance;

	/**
	 * Constructor of the DistanceInstruction class
	 * 
	 * @param maneuver
	 *            The maneuver type
	 * @param distance
	 *            Distance to the decision point
	 */
	public DistanceInstruction(GeoPoint decisionPoint, int maneuverType,
			int distance) {
		super(decisionPoint, maneuverType);
		this.distance = distance;
	}

	/**
	 * @return The Instruction as a verbal text
	 */
	public String toString() {
		if (Maneuver.isTurnAction(super.getManeuverType())) {
			String instruction = super.getManeuver();
			if (this.distance > 0) {
				instruction += " in ";
				if (this.distance >= 1000) {
					float distanceAsFloat = ((float) distance) / 1000;
					instruction += distanceAsFloat + " kilometers";
				} else {
					instruction += distance + " meters";
				}
			}
			return instruction;
		} else {
			return null;
		}
	}
}

@@ -417,16 +417,77 @@
 %0D%0A%09 * %0D%0A
+%09 * @param decisionPoint%0D%0A%09 *            The decision point%0D%0A
 %09 * @par
@@ -497,16 +497,20 @@
 maneuver
+Type
 %0D%0A%09 *   

Add information to JavaDoc in DistanceInstruction