Package com.ike.rwdccalc.Objects

Examples of com.ike.rwdccalc.Objects.DistancePath


   
    // Add in the distance of the outside circle that the plane will have to travel as well
    totalDistance.add(new DoubleObject(tau * baseRadius));
   
    // Return the answer as a DistancePath object
    DistancePath dp = new DistancePath(addArray(totalDistance), distanceFromCenter, angleFromCenter, segmentType);

    return dp;
  }
View Full Code Here


  // getRadiusDifference //
  /////////////////////////
  public static ArrayList<RadiusIteration> getRadiusDifference(int planes,
      double footprintWidth, double pricePerHour, double groundSpeed, double increment) {

    DistancePath small = new DistancePath()// Farthest inside plane
    DistancePath middle = new DistancePath()// Middle inside plane
    DistancePath bigger = new DistancePath()// Middle outside plane
    DistancePath big = new DistancePath();    // Farthest outside plane

    double time = 0;   // Time will be calculated based on speed and distance0
    double price = 0// Price will be calculated based on price per hour and time
    double speed = groundSpeed * 5280; // Convert miles per hour to feet per hour

    int max = 2 * 5280// Set the outside radius
    int min = 0;    // Set the inside
    int mid = 0;    // Set the middle
    int first = 0;    // Used as place holders
    int second = 0;    // Used as place holders

    // Only calculate for the number of planes that we have
    switch (planes) {
    // Two planes
    case 2:
      for (double x = 1; x < max; x+=increment) {
        // Not much to be done, find the inside distnace
        small = CalculatingTools.calculate(true, true, 0, x,
            footprintWidth);
        // Find the outside distance
        big = CalculatingTools.calculate(true, true, x, max,
            footprintWidth);

        // Find out which plane takes longer
        time = Math.max(small.getAnswerInFeet(), big.getAnswerInFeet());
        // Base the time calculation off of that
        time = time / speed;
        time -= 0.1;

        // Find out the price from how long it took
        price = time * pricePerHour * 2;

        // Add a new object to distnace
        distance.add(new RadiusIteration(
          price,
          new String[] {
            "Plane One: " + x, "Plane Two: " + max
          },
          new MissionPath[] {
            new MissionPath(
              small.getDistanceFromCenter(),
              small.getAngleFromCenter(),
              small.getSegmentType()),
            new MissionPath(
              big.getDistanceFromCenter(),
              big.getAngleFromCenter(),
              big.getSegmentType())
          },
          x, time
        ));
       
      }
      break;
    // Three planes
    case 3:
      for (int x = 1; x < max; x+=increment) {
        first = max - x;
        small = CalculatingTools.calculate(true, true, 0, x,
            footprintWidth);
        for (int y = x + 1; y < first; y+=10) {
          min = x + y;
          middle = CalculatingTools.calculate(true, true, x, min,
              footprintWidth);
          big = CalculatingTools.calculate(true, true, min, max,
              footprintWidth);

          time = Math.max(small.getAnswerInFeet(),
              middle.getAnswerInFeet());
          time = Math.max(time, big.getAnswerInFeet());
          time = time / speed;

          price = time * pricePerHour * 3;

          distance.add(new RadiusIteration(
            price,
            new String[] {
              "Plane One: " + x, "Plane Two: " + min, "Plane Three " + max
            },
            new MissionPath[] {
              new MissionPath(
                small.getDistanceFromCenter(),
                small.getAngleFromCenter(),
                small.getSegmentType()),
              new MissionPath(
                middle.getDistanceFromCenter(),
                middle.getAngleFromCenter(),
                middle.getSegmentType()),
              new MissionPath(
                big.getDistanceFromCenter(),
                big.getAngleFromCenter(),
                big.getSegmentType())
            },
            x, time
          ));
        }
      }
      break;
    // Fource planes
    case 4:
      for (int x = 1; x < max; x+=increment) {
        first = max - x;
        small = CalculatingTools.calculate(true, true, 0, x,
            footprintWidth);
        for (int y = x + 1; y < first; y+=10) {
          min = x + y;
          second = max - min;
          middle = CalculatingTools.calculate(true, true, x, min,
              footprintWidth);
          for (int z = y + 1; z < second; z+=10) {
            mid = min + z;
            bigger = CalculatingTools.calculate(true, true, min,
                mid, footprintWidth);
            big = CalculatingTools.calculate(true, true, mid, max,
                footprintWidth);

            time = Math.max(small.getAnswerInFeet(),
                middle.getAnswerInFeet());
            time = Math.max(time, bigger.getAnswerInFeet());
            time = Math.max(time, big.getAnswerInFeet());

            time = time / speed;

            price = time * pricePerHour * 4;

            distance.add(new RadiusIteration(
              price,
              new String[] {
                "Plane One: " + x, "Plane Two: " + min, "Plane Three " + mid, "Plane Four: " + max
              },
              new MissionPath[] {
                new MissionPath(
                  small.getDistanceFromCenter(),
                  small.getAngleFromCenter(),
                  small.getSegmentType()),
                new MissionPath(
                  middle.getDistanceFromCenter(),
                  middle.getAngleFromCenter(),
                  middle.getSegmentType()),
                new MissionPath(
                  bigger.getDistanceFromCenter(),
                  bigger.getAngleFromCenter(),
                  bigger.getSegmentType()),
                new MissionPath(
                  big.getDistanceFromCenter(),
                  big.getAngleFromCenter(),
                  big.getSegmentType())
              },
              x, time
            ));
          }
        }
View Full Code Here

TOP

Related Classes of com.ike.rwdccalc.Objects.DistancePath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.