package org.opentripplanner.profile;

import org.joda.time.LocalDate;
import org.opentripplanner.api.parameter.QualifiedModeSet;
import org.opentripplanner.routing.core.TraverseModeSet;

import java.io.Serializable;

/**
 * All the modifiable parameters for profile routing.
 */
public class ProfileRequest implements Serializable, Cloneable {

    public double fromLat;
    public double fromLon;
    public double toLat;
    public double toLon;
    
    public int    fromTime;
    public int    toTime;

    /* Speeds are in meters per second. */
    public float  walkSpeed;
    public float  bikeSpeed;
    public float  carSpeed;

    /* The following times are all in minutes. */
    public int    streetTime;
    public int    maxWalkTime;
    public int    maxBikeTime;
    public int    maxCarTime;
    public int    minBikeTime;
    public int    minCarTime;

    public LocalDate date;
    public Option.SortOrder orderBy;
    public int limit; // the maximum number of options presented PER ACCESS MODE
    public QualifiedModeSet accessModes, egressModes, directModes;
    public TraverseModeSet transitModes;
    public boolean analyst = false; // if true, propagate travel times out to street network

    /* The relative importance of different factors when biking */
    public int bikeSafe;
    public int bikeSlope;
    public int bikeTime;
    // FIXME change "safe" to "danger" to consistently refer to the things being minimized

    /*
      This parameter compensates for the fact that GTFS does not contain information about schedule deviation (lateness).
      The min-max travel time range for some trains is zero, since the trips are reported to always have the same
      timings in the schedule. Such an option does not overlap (temporally) its alternatives, and is too easily
      eliminated by an alternative that is only marginally better. We want to effectively push the max travel time of
      alternatives out a bit to account for the fact that they don't always run on schedule.
    */
    public int suboptimalMinutes;
    
    public ProfileRequest clone () throws CloneNotSupportedException {
        return (ProfileRequest) super.clone();
    }
}

@@ -346,140 +346,544 @@
     
-public double fromLat;%0A    public double fromLon;%0A    public double toLat;%0A    public double toLon;%0A    %0A    public int    fromTime;
+/** The latitude of the origin. */%0A    public double fromLat;%0A    %0A    /** The longitude of the origin. */%0A    public double fromLon;%0A    %0A    /** The latitude of the destination. Must be set even in Analyst mode. */%0A    public double toLat;%0A    %0A    /** The longitude of the destination. Must be set even in Analyst mode. */%0A    public double toLon;%0A    %0A    /** The beginning of the departure window, in seconds since midnight. */%0A    public int    fromTime;%0A    %0A    /** The end of the departure window, in seconds since midnight. */
 %0A   
@@ -916,19 +916,31 @@
   /*
- Speeds are
+* The speed of walking,
  in 
@@ -956,17 +956,16 @@
 r second
-.
  */%0A    
@@ -997,322 +997,898 @@
     
-public float  bikeSpeed;%0A    public float  carSpeed;%0A%0A    /* The following times are all in minutes. */%0A    public int    streetTime;%0A    public int    maxWalkTime;%0A    public int    maxBikeTime;%0A    public int    maxCarTime;%0A    public int    minBikeTime;%0A    public int    minCarTime;%0A%0A    public LocalDate date;
+%0A    /** The speed of cycling, in meters per second */%0A    public float  bikeSpeed;%0A    %0A    /** The speed of driving, in meters per second */%0A    public float  carSpeed;%0A%0A    /** Maximum time to reach the destination without using transit */%0A    public int    streetTime;%0A    %0A    /** Maximum walk time before and after using transit */%0A    public int    maxWalkTime;%0A    %0A    /** Maximum bike time when using transit */%0A    public int    maxBikeTime;%0A    %0A    /** Maximum car time before when using transit */ %0A    public int    maxCarTime;%0A    %0A    /** Minimum time to ride a bike (to prevent extremely short bike legs) */%0A    public int    minBikeTime;%0A    %0A    /** Minimum time to drive (to prevent extremely short driving legs) */%0A    public int    minCarTime;%0A%0A    /** The date of the search */%0A    public LocalDate date;%0A    %0A    /** The order in which to return multiple options */
 %0A   
@@ -1929,28 +1929,16 @@
     
-public int limit; //
+%0A    /**
  the
@@ -1993,328 +1993,900 @@
 MODE
-%0A    public QualifiedModeSet accessModes, egressModes, directModes;%0A    public TraverseModeSet transitModes;%0A    public boolean analyst = false; // if true, propagate travel times out to street network%0A%0A    /* The relative importance of different factors when biking */%0A    public int bikeSafe;%0A    public int bikeSlope;
+ */%0A    public int limit;%0A    %0A    /** The modes used to access transit */%0A    public QualifiedModeSet accessModes;%0A    %0A    /** The modes used to reach the destination after leaving transit */%0A    public QualifiedModeSet egressModes;%0A    %0A    /** The modes used to reach the destination without transit */%0A    public QualifiedModeSet directModes;%0A    %0A    /** The transit modes used */%0A    public TraverseModeSet transitModes;%0A    %0A    /** If true, disable all goal direction and propagate results to the street network */%0A    public boolean analyst = false;%0A%0A    /* The relative importance of different factors when biking */%0A    /** The relative importance of maximizing safety when cycling */%0A    public int bikeSafe;%0A    %0A    /** The relative importance of minimizing hills when cycling */%0A    public int bikeSlope;%0A    %0A    /** The relative importance of minimizing time when cycling */
 %0A   
@@ -3005,16 +3005,17 @@
 %0A%0A    /*
+*
 %0A      T

add comments to profilerequest.