private static void addMinMaxOptionsAndHideOriginal(Options options, SimpleListener listener) {
    for (Options.Option option : options.getOptions()) {
      if (option.isAdvanced()) {
        // At this stage we don't want to deal with batches of advanced options.
        // The advanced options at the moment are only for MUSCLE and there are a lot of them
        // which would bloat the interface too much if we added them all on one line as a
        // MultiValueOption
        option.setAdvanced(
            false); // add advanced option back to basic panel, since there is a layout issue on
                    // small screen
        continue;
      }

      MultiValueOption multiValueOption = null;
      if (option instanceof Options.IntegerOption) {
        multiValueOption = new IntegerMultiValueOption((Options.IntegerOption) option);
      } else if (option instanceof Options.DoubleOption) {
        multiValueOption = new DoubleMultiValueOption((Options.DoubleOption) option);
      }

      if (multiValueOption != null) {
        option.setVisible(false);
        options.addCustomOption(multiValueOption);
        multiValueOption.addChangeListener(listener);
      }
    }

    for (Options childOptions : options.getChildOptions().values()) {
      addMinMaxOptionsAndHideOriginal(childOptions, listener);
    }
  }
 private static <T extends Number> Set<OptionToSet> getOptionsToSet(
     String fullOptionName, MultiValueOption<T> multiValueOption) {
   Set<OptionToSet> set = new HashSet<OptionToSet>();
   for (T value : multiValueOption.getValue()) {
     set.add(new OptionToSet<T>(fullOptionName, value));
   }
   return set;
 }