/** * An {@code int} 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 int checkInvariantI( final int value, final ContractIntConditionType condition) throws InvariantViolationException { return checkInvariantI( value, condition.predicate(), condition.describer()); }
/** * An {@code int} 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 int checkInvariantI( final int value, final ContractIntConditionType condition) throws InvariantViolationException { return checkInvariantI( value, condition.predicate(), condition.describer()); }
Invariants.checkInvariantI( word_count, word_count > 1, c -> "Word count must be > 1");
@Override public void onFinish() { if (this.errors.isEmpty()) { Invariants.checkInvariantI( this.attr_buffers.size(), this.attr_buffers.size() == this.config.size(), x -> "Must have correct number of buffers"); final SMFByteBufferPackedMesh.Builder mb = SMFByteBufferPackedMesh.builder(); for (final Tuple2<Integer, ByteBuffer> p : this.attr_buffers) { mb.addAttributeSets(SMFByteBufferPackedAttributeSet.of( p._1.intValue(), this.config.get(p._1).get(), p._2)); } if (this.tri_buffer != null) { final SMFTriangles triangles = this.header.triangles(); mb.setTriangles(SMFByteBufferPackedTriangles.of( this.tri_buffer, triangles.triangleCount(), Math.toIntExact(triangles.triangleIndexSizeBits()))); } mb.setHeader(this.header); this.mesh = mb.build(); } }