MarketDataShift implements StructureManipulator<Double>, ImmutableBean { @Override public Double execute(Double value, ValueSpecification valueSpecification, FunctionExecutionContext executionContext) { switch (_shiftType) { case ABSOLUTE: return value + _shift; case RELATIVE: return value * (1 + _shift); default: throw new IllegalArgumentException("Unexpected shift type " + _shiftType); } } @ImmutableConstructor  MarketDataShift(ScenarioShiftType shiftType, double shift); @Override Double execute(Double value, ValueSpecification valueSpecification, FunctionExecutionContext executionContext); @Override Class<Double> getExpectedType(); static MarketDataShift.Meta meta(); static MarketDataShift.Builder builder(); @Override MarketDataShift.Meta metaBean(); @Override Property<R> property(String propertyName); @Override Set<String> propertyNames(); ScenarioShiftType getShiftType(); double getShift(); Builder toBuilder(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void absolute() { MarketDataShift shift = new MarketDataShift(ScenarioShiftType.ABSOLUTE, 1); assertEquals(shift.execute(3d, null, null), 4d); }
@Test public void relative() { MarketDataShift shift = new MarketDataShift(ScenarioShiftType.RELATIVE, 0.5); assertEquals(shift.execute(3d, null, null), 4.5d); }