Set the upgrade discount to a value between 0 and 1.

@param float discount The discount amount
779614
public function setUpgradeDiscount($discount)
    {
        if ($this->ordering <= 1) {
            $discount = 0;
        }

        $discount = (float) min(1, max(0, $discount));
        $this->setValue('upgrade_discount', $discount);

        return $this;
    }
1294908
public void setMaxValue(final double VALUE) {
        if (Status.RUNNING == timeline.getStatus()) { timeline.jumpTo(Duration.ONE); }
        if (null == maxValue) {
            if (VALUE < getMinValue()) { setMinValue(VALUE); }
            _maxValue = clamp(getMinValue(), Double.MAX_VALUE, VALUE);
            setRange(_maxValue - getMinValue());
            if (Helper.equals(originalMaxValue, Double.MAX_VALUE)) originalMaxValue = _maxValue;
            if (Helper.biggerThan(originalThreshold, getThreshold())) { setThreshold(clamp(getMinValue(), _maxValue, originalThreshold)); }
            fireTileEvent(RECALC_EVENT);
            if (!valueProperty().isBound()) Tile.this.setValue(clamp(getMinValue(), getMaxValue(), Tile.this.getValue()));
        } else {
            maxValue.set(VALUE);
        }
    }
1076525
def __set_unit_price(self, value):
        '''
        
        '''
        try:
            if value < 0:
                raise ValueError()

            self.__unit_price = Decimal(str(value))
        except ValueError:
            raise ValueError("Unit Price must be a positive number")
500772
public static void setValue(Progression model, int value) {
		if (model != null && value > model.getValue()) {
			model.setValue(value);
		}
	}
252943
public void setValue(float value, boolean animation){
        value = Math.min(mMaxValue, Math.max(value, mMinValue));
        setPosition((value - mMinValue) / (mMaxValue - mMinValue), animation);
    }
1273290
public void setPremiumRateValue(com.google.api.ads.admanager.axis.v201805.PremiumRateValue premiumRateValue) {
        this.premiumRateValue = premiumRateValue;
    }
761549
private void setNormalizedMinValue(double value) {
        normalizedMinValue = Math.max(0d, Math.min(1d, Math.min(value, normalizedMaxValue)));
        invalidate();
    }
188737
public void setMax(int value) {
		updateDisable = true;
		maxSpinner.setValue(new Integer(value));
		updateDisable = false;
	}
1265554
public void setFloat(int index, float value)
    {
        checkIndexLength(index, SizeOf.SIZE_OF_FLOAT);
        unsafe.putFloat(base, address + index, value);
    }
185179
public final void setValue(final int value)
	{
		expUnitAdjustment = 0;
		try {
			data = toDpt(dimensionlessCounter, value);
		}
		catch (final KNXFormatException e) {
			logger.error("{} {} coding {} (value {}) should alway have correct format", dpt.getID(),
					dpt.getDescription(), binary(dimensionlessCounter), value, e);
		}
	}
356339
public void setLimit(int lim) {
        if(0<=lim && lim<=rep.length()) {
            limit=lim;
        } else {
            limit=rep.length();
        }
        reachedLimit=false;
    }
856758
public void setProgress(float percent){
		if(mCircular)
			((CircularProgressDrawable)mProgressDrawable).setProgress(percent);
		else
			((LinearProgressDrawable)mProgressDrawable).setProgress(percent);
	}
879390
public void offer(float value)
  {
    // update min/max
    if (value < min) {
      min = value;
    }
    if (value > max) {
      max = value;
    }

    // initial value
    if (binCount == 0) {
      positions[0] = value;
      bins[0] = 1;
      count++;

      binCount++;
      return;
    }

    final int index = Arrays.binarySearch(positions, 0, binCount, value);

    if (index >= 0) {
      // we have an exact match, simply increase the count, but keep the approximate flag
      bins[index] = (bins[index] & APPROX_FLAG_BIT) | ((bins[index] & COUNT_BITS) + 1);
      count++;
      return;
    }

    // otherwise merge the value into a new or existing bin at the following position
    final int insertAt = -(index + 1);

    if (binCount < size) {
      // we have a spare slot, put the value into a new bin
      shiftRight(insertAt, binCount);

      positions[insertAt] = value;
      bins[insertAt] = 1;
      count++;

      binCount++;
      return;
    }

    // no more slots available merge the new value into and existing bin
    // or merge existing bins before inserting the new one

    int minPos = minDeltaIndex();
    float minDelta = minPos >= 0 ? positions[minPos + 1] - positions[minPos] : Float.POSITIVE_INFINITY;

    // determine the distance of new value to the nearest bins
    final float deltaRight = insertAt < binCount ? positions[insertAt] - value : Float.POSITIVE_INFINITY;
    final float deltaLeft = insertAt > 0 ? value - positions[insertAt - 1] : Float.POSITIVE_INFINITY;

    boolean mergeValue = false;
    if (deltaRight < minDelta) {
      minDelta = deltaRight;
      minPos = insertAt;
      mergeValue = true;
    }
    if (deltaLeft < minDelta) {
      minPos = insertAt - 1;
      mergeValue = true;
    }

    if (mergeValue) {
      // merge new value into an existing bin and set approximate flag
      final long k = bins[minPos] & COUNT_BITS;
      positions[minPos] = (positions[minPos] * k + value) / (k + 1);
      bins[minPos] = (k + 1) | APPROX_FLAG_BIT;
      count++;
    } else {
      // merge the closest bins together and insert new value as a separate bin
      mergeInsert(minPos, insertAt, value, 1);
    }
  }
890491
@Override
    public void setValue(final double VALUE) {
        if (isEnabled()) {
            this.value100 = (VALUE % 1000) / 100;
            this.value1000 = (VALUE % 10000) / 100;
            this.value10000 = (VALUE % 100000) / 100;

            if (isValueCoupled()) {
                setLcdValue(VALUE);
            }

            fireStateChanged();
            this.oldValue = VALUE;
            repaint();
        }
    }
969038
public void setProgress(float progress) {
        if (progress < 0)
            mProgress = 0;
        else if (mProgress > 1)
            mProgress = 1;
        else
            mProgress = progress;
        stop();
        onProgressChange(mProgress);
        invalidateSelf();
    }
1141713
public final void setMaxValue(final int maxValue) {
        Condition.INSTANCE.ensureGreater(maxValue, getMinValue(),
                "The maximum value must be greater than the minimum value");
        this.maxValue = maxValue;
        setValue(Math.min(getValue(), maxValue));
    }
1265887
public void setValue(double value) {
        this.value = lockValueInRange
                ? Op.bound(value, minimum, maximum)
                : value;
    }