/** * A {@code long} 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 long checkInvariantL( final long value, final ContractLongConditionType condition) throws InvariantViolationException { return checkInvariantL(value, condition.predicate(), condition.describer()); }
/** * A {@code long} 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 long checkInvariantL( final long value, final ContractLongConditionType condition) throws InvariantViolationException { return checkInvariantL(value, condition.predicate(), condition.describer()); }
/** * A {@code long} 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 long checkPreconditionL( final long value, final ContractLongConditionType condition) throws PreconditionViolationException { return checkPreconditionL( value, condition.predicate(), condition.describer()); }
/** * A {@code long} 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 long checkPostconditionL( final long value, final ContractLongConditionType condition) throws PostconditionViolationException { return checkPostconditionL( value, condition.predicate(), condition.describer()); }
/** * A {@code long} 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 long checkPreconditionL( final long value, final ContractLongConditionType condition) throws PreconditionViolationException { return checkPreconditionL( value, condition.predicate(), condition.describer()); }
/** * A {@code long} 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 long checkPostconditionL( final long value, final ContractLongConditionType condition) throws PostconditionViolationException { return checkPostconditionL( value, condition.predicate(), condition.describer()); }
/** * Fill a builder with attribute values from the provided {@code ContractLongConditionType} 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(ContractLongConditionType instance) { Objects.requireNonNull(instance, "instance"); setPredicate(instance.predicate()); setDescriber(instance.describer()); return this; }
/** * Fill a builder with attribute values from the provided {@code ContractLongConditionType} 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(ContractLongConditionType instance) { Objects.requireNonNull(instance, "instance"); setPredicate(instance.predicate()); setDescriber(instance.describer()); return this; }
static Violations innerCheckAllLong( final long value, final ContractLongConditionType[] conditions) { Violations violations = null; for (int index = 0; index < conditions.length; ++index) { final ContractLongConditionType condition = conditions[index]; final LongPredicate 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] = applyDescriberLChecked(value, condition.describer()); violations.countUp(); } } return violations; }
static Violations innerCheckAllLong( final long value, final ContractLongConditionType[] conditions) { Violations violations = null; for (int index = 0; index < conditions.length; ++index) { final ContractLongConditionType condition = conditions[index]; final LongPredicate 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] = applyDescriberLChecked(value, condition.describer()); violations.countUp(); } } return violations; }