package curve; import java.util.*; import gradebook.*; /** * The Histogram class defines the necessary components for graphically changing the GradeScheme * * Derived from the requirements documentation regarding visuals. */ public abstract class Histogram extends AbstractGraph { /** * GradeScheme used to project how a particular adjustment will propagate. Pushed to the Section once the user finalizes their choice with apply(). */ GradeScheme tempGradeScheme; /** * Given a particular letter grade and new lowerbound, this method will apply them to the temporary GradeScheme. * * @param letterGrade The LetterGrade that has been changed * @param newLowerBound The new Percentage that denotes the LetterGrade's new lower bound. *
post: //The LetterGrade and Percentage have been properly applied to the tempGradeScheme and no other changes have been made forall (DivisionBar divisionBar; tempGradeScheme'.divisions.contains(divisionBar) iff (divisionBar.letterGrade.equals(letterGrade) && divisionBar.low.equals(newLowerBound)) || tempGradeScheme.divisions.contains(divisionBar)); */ void adjustCurve(LetterGrade letterGrade, Percentage newLowerBound) { DivisionBar divisionBar = null; tempGradeScheme.divisions.contains(divisionBar); divisionBar.letterGrade.equals(letterGrade); tempGradeScheme.divisions.contains(divisionBar); } /* SPEST PROBLEM: The checker outputs what seem to be the following incorrect errors: Invalid invocation: contains(antlr.TestGenerator$arguments_return@839803e) at line: 25 at character: 33 Invalid id: letterGrade at line: 26 at character: 20 no viable alternative at input '.' at line: 26 at character: 32 Expected type: null, but found: boolean at line: 25 character: 56 found: divisionBar expecting:at line: 26 at character: 56 found: tempGradeScheme expecting: at line: 28 at character: 8 The adapted postcond code in the adjustCurve method body is OK with javac. */ /** * Changes made via the GUI manipulations will be pushed over to the full model. post: //The GradeScheme of the Section must be identical to the tempGradeScheme. forall (DivisionBar divisionBar; tempGradeScheme.contains(divisionBar); exists(DivisionBar sDivisionBar; section'.gradeScheme.divisions.contains(sDivisionBar); divisionBar.equals(sDivisionBar))); */ abstract void apply(); }