@Test public void values1() { Ramp ramp = new Ramp(-10.0, 10.0, 2.0, 1.0); VDouble value = ramp.nextValue(); assertThat(value.getAlarmSeverity(), equalTo(AlarmSeverity.MAJOR)); assertThat(value.getAlarmName(), equalTo("LOLO")); assertThat(value.getLowerCtrlLimit(), equalTo(-10.0)); assertThat(value.getLowerDisplayLimit(), equalTo(-10.0)); assertThat(value.getLowerAlarmLimit(), equalTo(-8.0)); assertThat(value.getLowerWarningLimit(), equalTo(-6.0)); assertThat(value.getUpperWarningLimit(), equalTo(6.0)); assertThat(value.getUpperAlarmLimit(), equalTo(8.0)); assertThat(value.getUpperDisplayLimit(), equalTo(10.0)); assertThat(value.getUpperCtrlLimit(), equalTo(10.0)); assertThat(value.getValue(), equalTo(-10.0)); value = ramp.nextValue(); assertThat(value.getValue(), equalTo(-8.0)); value = ramp.nextValue(); assertThat(value.getValue(), equalTo(-6.0)); value = ramp.nextValue(); assertThat(value.getValue(), equalTo(-4.0)); value = ramp.nextValue(); assertThat(value.getValue(), equalTo(-2.0)); value = ramp.nextValue(); assertThat(value.getValue(), equalTo(0.0)); value = ramp.nextValue(); assertThat(value.getValue(), equalTo(2.0)); value = ramp.nextValue(); assertThat(value.getValue(), equalTo(4.0)); value = ramp.nextValue(); assertThat(value.getValue(), equalTo(6.0)); value = ramp.nextValue(); assertThat(value.getValue(), equalTo(8.0)); value = ramp.nextValue(); assertThat(value.getValue(), equalTo(10.0)); value = ramp.nextValue(); assertThat(value.getValue(), equalTo(-10.0)); }
@Override VDouble nextValue() { currentValue = currentValue + step; if (currentValue > max) { currentValue = min; } if (currentValue < min) { currentValue = max; } return newValue(currentValue, lastValue); }
Ramp extends SimFunction<VDouble> { @Override VDouble nextValue() { currentValue = currentValue + step; if (currentValue > max) { currentValue = min; } if (currentValue < min) { currentValue = max; } return newValue(currentValue, lastValue); } }
Ramp extends SimFunction<VDouble> { @Override VDouble nextValue() { currentValue = currentValue + step; if (currentValue > max) { currentValue = min; } if (currentValue < min) { currentValue = max; } return newValue(currentValue, lastValue); } Ramp(Double min, Double max, Double step, Double interval);  Ramp(Double min, Double max, Double interval);  Ramp(); }
Ramp extends SimFunction<VDouble> { @Override VDouble nextValue() { currentValue = currentValue + step; if (currentValue > max) { currentValue = min; } if (currentValue < min) { currentValue = max; } return newValue(currentValue, lastValue); } Ramp(Double min, Double max, Double step, Double interval);  Ramp(Double min, Double max, Double interval);  Ramp();  }
Ramp extends SimFunction<VDouble> { @Override VDouble nextValue() { currentValue = currentValue + step; if (currentValue > max) { currentValue = min; } if (currentValue < min) { currentValue = max; } return newValue(currentValue, lastValue); } Ramp(Double min, Double max, Double step, Double interval);  Ramp(Double min, Double max, Double interval);  Ramp();   }