我应该检查该值,如果不是该值,我不会更新该值。如果输入有效,那么我将返回它。
最小可重现示例:
public class Student {
private int studentId;
private String name;
private double grade;
private double multiplier;
public double getMultiplier() {
return multiplier;
}
/**
* The setter for the multiplier must check that the value is either 1.08 *
* 1.06 or 1.08 or 1.06
*
* If not, then do not update the value
*
* @param multiplier
* @return if the input was valid
*/
public boolean setMultiplier(double multiplier) {
if( multiplier == 1.08 * 1.06 || multiplier == 1.08 || multiplier == 1.06 ) { }
return multiplier;
}
...
}
斯蒂芬大帝
蛊毒传说
当年话下
阿晨1998
相关分类