/** * A {@code double} specialized version of {@link #checkPostcondition(Object, * ContractConditionType)}. * * @param value The value * @param condition The predicate * * @return value * * @throws PostconditionViolationException If the predicate is false */ public static double checkPostconditionD( final double value, final ContractDoubleConditionType condition) throws PostconditionViolationException { return checkPostconditionD( value, condition.predicate(), condition.describer()); }
/** * A {@code double} specialized version of {@link #checkInvariant(Object, * ContractConditionType)}. * * @param value The value * @param condition The predicate * * @return value * * @throws InvariantViolationException If the predicate is false */ public static double checkInvariantD( final double value, final ContractDoubleConditionType condition) throws InvariantViolationException { return checkInvariantD(value, condition.predicate(), condition.describer()); }
/** * A {@code double} specialized version of {@link #checkInvariant(Object, * ContractConditionType)}. * * @param value The value * @param condition The predicate * * @return value * * @throws InvariantViolationException If the predicate is false */ public static double checkInvariantD( final double value, final ContractDoubleConditionType condition) throws InvariantViolationException { return checkInvariantD(value, condition.predicate(), condition.describer()); }
/** * A {@code double} specialized version of {@link #checkPostcondition(Object, * ContractConditionType)}. * * @param value The value * @param condition The predicate * * @return value * * @throws PostconditionViolationException If the predicate is false */ public static double checkPostconditionD( final double value, final ContractDoubleConditionType condition) throws PostconditionViolationException { return checkPostconditionD( value, condition.predicate(), condition.describer()); }
/** * A {@code double} specialized version of {@link #checkPrecondition(Object, * ContractConditionType)}. * * @param value The value * @param condition The predicate * * @return value * * @throws PreconditionViolationException If the predicate is false */ public static double checkPreconditionD( final double value, final ContractDoubleConditionType condition) throws PreconditionViolationException { return checkPreconditionD( value, condition.predicate(), condition.describer()); }
/** * A {@code double} specialized version of {@link #checkPrecondition(Object, * ContractConditionType)}. * * @param value The value * @param condition The predicate * * @return value * * @throws PreconditionViolationException If the predicate is false */ public static double checkPreconditionD( final double value, final ContractDoubleConditionType condition) throws PreconditionViolationException { return checkPreconditionD( value, condition.predicate(), condition.describer()); }
/** * Fill a builder with attribute values from the provided {@code ContractDoubleConditionType} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(ContractDoubleConditionType instance) { Objects.requireNonNull(instance, "instance"); setPredicate(instance.predicate()); setDescriber(instance.describer()); return this; }
/** * Fill a builder with attribute values from the provided {@code ContractDoubleConditionType} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(ContractDoubleConditionType instance) { Objects.requireNonNull(instance, "instance"); setPredicate(instance.predicate()); setDescriber(instance.describer()); return this; }
static Violations innerCheckAllDouble( final double value, final ContractDoubleConditionType[] conditions) { Violations violations = null; for (int index = 0; index < conditions.length; ++index) { final ContractDoubleConditionType condition = conditions[index]; final DoublePredicate predicate = condition.predicate(); final boolean ok; final int count = conditions.length; try { ok = predicate.test(value); } catch (final Throwable e) { violations = maybeAllocate(violations, count); violations.messages()[index] = failedPredicate(e); violations.countUp(); continue; } if (!ok) { violations = maybeAllocate(violations, count); violations.messages()[index] = applyDescriberDChecked(value, condition.describer()); violations.countUp(); } } return violations; }
static Violations innerCheckAllDouble( final double value, final ContractDoubleConditionType[] conditions) { Violations violations = null; for (int index = 0; index < conditions.length; ++index) { final ContractDoubleConditionType condition = conditions[index]; final DoublePredicate predicate = condition.predicate(); final boolean ok; final int count = conditions.length; try { ok = predicate.test(value); } catch (final Throwable e) { violations = maybeAllocate(violations, count); violations.messages()[index] = failedPredicate(e); violations.countUp(); continue; } if (!ok) { violations = maybeAllocate(violations, count); violations.messages()[index] = applyDescriberDChecked(value, condition.describer()); violations.countUp(); } } return violations; }