package curve;

import java.util.Collection;
import view.WindowFrame;
import gradebook.ClassGradebook;
import charts.*;
import view.Window;

/**
 * Window for the find gaps curve.
 * Derived from 2.6.3.2 of the requirements.
 * @author crahm
 */
public abstract class CurveFindGapsWindow extends WindowFrame
{
   /**
    * Collection of gaps that are shown in the window.
    */
   Collection<Gap> gaps;
   
   /**
    * Histogram that contains the proposed curve to model.
    */
   Histogram histo;
	
	/**
	 * Set Find Gaps Curve Window
	 */
	SetFindGapsCurveWindow setWindow;
   
   /**
    * Opens the SetFindGapsCurveWindow window.  Triggered by the button.
    */
   /*@
     ensures
     //
     // Set Find Gaps Curving Window is opened.
     (\exists Window w ;
        (w.open.contains(setWindow) && (setWindow != null)));
     @*/
   abstract void setCurve();
}

/**
 * Window for setting the find gaps curve.
 */
abstract class SetFindGapsCurveWindow extends WindowFrame
{

   /**
    * Collection of gaps found in the initial find gaps window.
    */
   Collection<Gap> gaps;
   
   /**
    * The find gaps curve breakdown.  Tentative curve.
    */
   GradeCurve tentativeLetterGrades;
 
   /**
   * This method applies the find gaps curve.
   */
   /*@
    ensures
    //
    //Curve is applied to Histogram, Pie Chart, and Gradebook
    //
    (\exists Histogram h;
       (h.curve.equals(tentativeLetterGrades))) &&
    (\exists PieChart p ;
       (p.curve.equals(tentativeLetterGrades))) &&
    (\exists ClassGradebook g ;
       (g.gradeCurve.equals(tentativeLetterGrades)));
    @*/
   abstract void applyCurve();
}

/**
 * Contains properties of a gap between grades
 */
abstract class Gap
{
   /**
    * High Percent Boundary of gap
    */
   double hiPercentBound;
   
   /**
    * Low Percent Boundary of gap
    */
   double loPercentBound;
}