package schedule;

/**
 * A DistanceProximity represents the maximum distance between courses if they
 * are being taught by the same professor. The minutes represents how far apart
 * the classes are in regards to time, the amount represents how many of the
 * type (minutes, miles or meters) the classes can be in distance.
 *
 * DistanceProximity is described in Section 2.6.3 of the requirements.
 * @author vforney
 */
public abstract class DistanceProximity extends ScheduleConstraint {
  /**
   * Represents the possible types to separate classes by.
   */
  public enum DistanceType { MINUTES, MILES, METERS };

  /**
   * The number of minutes apart for courses to enforce this distance
   * restriction.
   */
  public int minutes;

  /**
   * The amount of units type that the courses can be apart if they are within
   * minutes of each other.
   */
  public int amount;

  /**
   * The units that the amount represents. Can be MINUTES, MILES, or METERS.
   */
  public DistanceType type;

  /**
   * Updates DistanceProximity values to the specified values.
   * @param minutes The maximum number of minutes between the courses taught by
   *  the same professor to enforce the distance proximity requirement.
   * @param amount The amount of units away of Type.
   * @param type Either minutes, miles, or meters.
   */
   /*@
    requires
      // 
      // The minutes are positive.
      //
      (minutes > 0)
        &&
      //
      // The amount is positive.
      //
      (amount > 0)
        &&
      //
      // The type is either MINUTES, MILES, or METERS.
      //
      (type == DistanceType.MINUTES || type == DistanceType.MILES ||
       type == DistanceType.METERS);

    ensures
      //
      // The DistanceProxmity values were updated properly.
      //
      (this.minutes == minutes && this.amount == amount && this.type == type);
  @*/
  public abstract void update(int minutes, int amount, DistanceType type);
}