/** * 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 #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()); }
private void evict( final C context, final TimedEntry<K, T> e) { Preconditions.checkPrecondition( e.key, this.entries_free.containsKey(e.key), k -> "Key " + k + " must be free"); Preconditions.checkPreconditionL( this.size_now, Long.compareUnsigned(this.size_now, 0L) > 0, x -> "Size " + x + " must be > 0"); final SortedSet<TimedEntry<K, T>> free = this.entries_free.get(e.key); free.remove(e); this.entries_free_timed.remove(e); this.size_now = BigUnsigned.checkedSubtractLong(this.size_now, e.size); Postconditions.checkPostconditionL( this.size_now, Long.compareUnsigned(this.size_now, 0L) >= 0, x -> "Size " + x + " must be >= 0"); this.listener.onDelete(context, e.key, e.value); }