/**
     * @return new {@link Range} with {@literal min} and {@literal max} set to {@link
     *     Boundary#infinite()}.
     */
    public static Range unbounded() {

      Range range = new Range();
      range.min = Boundary.infinite();
      range.max = Boundary.infinite();
      return range;
    }
예제 #2
0
파일: Repl.java 프로젝트: anba/es6draft
 @Override
 protected Integer parse(String argument) throws NumberFormatException, CmdLineException {
   int value = Integer.parseInt(argument);
   Range range = setter.asAnnotatedElement().getAnnotation(Range.class);
   if (range != null && value != Math.min(Math.max(value, range.min()), range.max())) {
     throw new NumberFormatException();
   }
   return value;
 }
예제 #3
0
 @Override
 public Property create(
     Object target, FieldMetadata<Object, ?> fieldMetadata, String id, Range range) {
   UISlider slider = new UISlider();
   slider.setMinimum(range.min());
   slider.setRange(range.max() - range.min());
   slider.setPrecision(range.precision());
   slider.setIncrement(range.increment());
   Binding<Float> binding = createFloatBinding(target, fieldMetadata);
   slider.bindValue(binding);
   String label = fromLabelOrId(range.label(), id);
   return new Property<>(label, binding, slider, range.description());
 }