コード例 #1
0
  @Override
  public void initialize(ParameterValueAssignment configuration) {
    final String paramType = configuration.getParameter().getType();
    final DynamicValueAssignment dva = (DynamicValueAssignment) configuration;
    final Map<String, String> params = dva.getConfiguration();

    parameterType = SupportedTypes.get(paramType);
    if (parameterType == null) {
      throw new IllegalArgumentException(
          "The given parameter value assignment is not supported by "
              + this.getClass().getSimpleName()
              + ".");
    }

    final LMVState dState = new LMVState();
    dState.min = Double.valueOf(params.get(PARAM_MIN));
    dState.max = Double.valueOf(params.get(PARAM_MAX));
    dState.step = Double.valueOf(params.get(PARAM_STEP));
    state = dState;

    if (state.step == 0) {
      state.size = 1;
    } else {
      state.size = (int) (1 + Math.floor((state.max - state.min) / state.step));
    }

    dynamicValueAssignment = dva;
  }
コード例 #2
0
 @Override
 public boolean canVary(ParameterValueAssignment configuration) {
   final SupportedTypes paramType = SupportedTypes.get(configuration.getParameter().getType());
   final boolean typeCheck =
       (paramType != null)
           && (paramType == SupportedTypes.Double || paramType == SupportedTypes.Integer);
   return (configuration instanceof DynamicValueAssignment) && typeCheck;
 }