@Test public void testModify() { final ModifierProperties modifierProperties = new ModifierProperties(); modifierProperties.put("minimum", UnsignedLong.ZERO); modifierProperties.put("maximum", UnsignedLong.valueOf(10L)); modifierProperties.put("minimumStep", UnsignedLong.valueOf(1L)); modifierProperties.put("maximumStep", UnsignedLong.valueOf(10L)); final Counter64Modifier modifier = new Counter64Modifier(); modifier.init(modifierProperties); final Counter64 counter64 = new Counter64(0); assertEquals(counter64.getValue(), 0); final Counter64 modifiedVariable = modifier.modify(counter64); assertNotEquals(modifiedVariable.getValue(), 0); }
@Override public Counter64 modify(final Counter64 variable) { UnsignedLong currentValue = UnsignedLong.valueOf(variable.toString()); if (currentValue.compareTo(minimum) < 0 || currentValue.compareTo(maximum) > 0) { currentValue = minimum; } final UnsignedLong step = UnsignedLong.valueOf((long) (Math.random() * maximumStep.minus(minimumStep).longValue())).plus(minimumStep); final UnsignedLong newValue = currentValue.plus(step); return new Counter64(newValue.longValue()); }
Counter64Modifier implements VariableModifier<Counter64> { @Override public Counter64 modify(final Counter64 variable) { UnsignedLong currentValue = UnsignedLong.valueOf(variable.toString()); if (currentValue.compareTo(minimum) < 0 || currentValue.compareTo(maximum) > 0) { currentValue = minimum; } final UnsignedLong step = UnsignedLong.valueOf((long) (Math.random() * maximumStep.minus(minimumStep).longValue())).plus(minimumStep); final UnsignedLong newValue = currentValue.plus(step); return new Counter64(newValue.longValue()); } }
Counter64Modifier implements VariableModifier<Counter64> { @Override public Counter64 modify(final Counter64 variable) { UnsignedLong currentValue = UnsignedLong.valueOf(variable.toString()); if (currentValue.compareTo(minimum) < 0 || currentValue.compareTo(maximum) > 0) { currentValue = minimum; } final UnsignedLong step = UnsignedLong.valueOf((long) (Math.random() * maximumStep.minus(minimumStep).longValue())).plus(minimumStep); final UnsignedLong newValue = currentValue.plus(step); return new Counter64(newValue.longValue()); }  }
Counter64Modifier implements VariableModifier<Counter64> { @Override public Counter64 modify(final Counter64 variable) { UnsignedLong currentValue = UnsignedLong.valueOf(variable.toString()); if (currentValue.compareTo(minimum) < 0 || currentValue.compareTo(maximum) > 0) { currentValue = minimum; } final UnsignedLong step = UnsignedLong.valueOf((long) (Math.random() * maximumStep.minus(minimumStep).longValue())).plus(minimumStep); final UnsignedLong newValue = currentValue.plus(step); return new Counter64(newValue.longValue()); }  @Override void init(final ModifierProperties properties); @Override Counter64 modify(final Counter64 variable); }
Counter64Modifier implements VariableModifier<Counter64> { @Override public Counter64 modify(final Counter64 variable) { UnsignedLong currentValue = UnsignedLong.valueOf(variable.toString()); if (currentValue.compareTo(minimum) < 0 || currentValue.compareTo(maximum) > 0) { currentValue = minimum; } final UnsignedLong step = UnsignedLong.valueOf((long) (Math.random() * maximumStep.minus(minimumStep).longValue())).plus(minimumStep); final UnsignedLong newValue = currentValue.plus(step); return new Counter64(newValue.longValue()); }  @Override void init(final ModifierProperties properties); @Override Counter64 modify(final Counter64 variable);  }