/** * Builds a new {@link RangeInclusiveD RangeInclusiveD}. * @return An immutable instance of RangeInclusiveD * @throws java.lang.IllegalStateException if any required attributes are missing */ public RangeInclusiveD build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return RangeInclusiveD.validate(new RangeInclusiveD(lower, upper)); }
/** * Copy the current immutable object by setting a value for the {@link RangeInclusiveDType#lower() lower} attribute. * A value strict bits equality used to prevent copying of the same value by returning {@code this}. * @param value A new value for lower * @return A modified copy of the {@code this} object */ public final RangeInclusiveD withLower(double value) { if (Double.doubleToLongBits(this.lower) == Double.doubleToLongBits(value)) return this; return validate(new RangeInclusiveD(value, this.upper)); }
/** * Copy the current immutable object by setting a value for the {@link RangeInclusiveDType#upper() upper} attribute. * A value strict bits equality used to prevent copying of the same value by returning {@code this}. * @param value A new value for upper * @return A modified copy of the {@code this} object */ public final RangeInclusiveD withUpper(double value) { if (Double.doubleToLongBits(this.upper) == Double.doubleToLongBits(value)) return this; return validate(new RangeInclusiveD(this.lower, value)); }
/** * Construct a new immutable {@code RangeInclusiveD} instance. * @param lower The value for the {@code lower} attribute * @param upper The value for the {@code upper} attribute * @return An immutable RangeInclusiveD instance */ public static RangeInclusiveD of(double lower, double upper) { return validate(new RangeInclusiveD(lower, upper)); }