public void testMin_noArgs() { try { Ints.min(); fail(); } catch (IllegalArgumentException expected) { } }
/** * Copies bytes from this hash code into {@code dest}. * * @param dest the byte array into which the hash code will be written * @param offset the start offset in the data * @param maxLength the maximum number of bytes to write * @return the number of bytes written to {@code dest} * @throws IndexOutOfBoundsException if there is not enough room in {@code dest} */ @CanIgnoreReturnValue public int writeBytesTo(byte[] dest, int offset, int maxLength) { maxLength = Ints.min(maxLength, bits() / 8); Preconditions.checkPositionIndexes(offset, offset + maxLength, dest.length); writeBytesToImpl(dest, offset, maxLength); return maxLength; }
Ints.min( cost + levMatrix[i - 1][j - 1], levMatrix[i - 1][j] + 1, levMatrix[i][j - 1] + 1);
/** * Copies bytes from this hash code into {@code dest}. * * @param dest the byte array into which the hash code will be written * @param offset the start offset in the data * @param maxLength the maximum number of bytes to write * @return the number of bytes written to {@code dest} * @throws IndexOutOfBoundsException if there is not enough room in {@code dest} */ @CanIgnoreReturnValue public int writeBytesTo(byte[] dest, int offset, int maxLength) { maxLength = Ints.min(maxLength, bits() / 8); Preconditions.checkPositionIndexes(offset, offset + maxLength, dest.length); writeBytesToImpl(dest, offset, maxLength); return maxLength; }
cost + Ints.min(mMatrix[i - 1][j - 1], iMatrix[i - 1][j - 1], dMatrix[i - 1][j - 1]); int costOfEditScriptEndingWithDelete = dMatrix[sourceLength][targetLength]; int costOfEditScriptEndingWithInsert = iMatrix[sourceLength][targetLength]; return Ints.min( costOfEditScriptEndingWithMatch, costOfEditScriptEndingWithDelete,
/** * Copies bytes from this hash code into {@code dest}. * * @param dest the byte array into which the hash code will be written * @param offset the start offset in the data * @param maxLength the maximum number of bytes to write * @return the number of bytes written to {@code dest} * @throws IndexOutOfBoundsException if there is not enough room in {@code dest} */ @CanIgnoreReturnValue public int writeBytesTo(byte[] dest, int offset, int maxLength) { maxLength = Ints.min(maxLength, bits() / 8); Preconditions.checkPositionIndexes(offset, offset + maxLength, dest.length); writeBytesToImpl(dest, offset, maxLength); return maxLength; }
@Override public long getMin() { return Ints.min(values); }
private int calculateSharedBytes(byte[] leftKey, byte[] rightKey) { int sharedKeyBytes = 0; if (leftKey != null && rightKey != null) { int minSharedKeyBytes = Ints.min(leftKey.length, rightKey.length); while (sharedKeyBytes < minSharedKeyBytes && leftKey[sharedKeyBytes] == rightKey[sharedKeyBytes]) { sharedKeyBytes++; } } return sharedKeyBytes; } }
/** * Copies bytes from this hash code into {@code dest}. * * @param dest the byte array into which the hash code will be written * @param offset the start offset in the data * @param maxLength the maximum number of bytes to write * @return the number of bytes written to {@code dest} * @throws IndexOutOfBoundsException if there is not enough room in {@code dest} */ public int writeBytesTo(byte[] dest, int offset, int maxLength) { byte[] hash = asBytes(); maxLength = Ints.min(maxLength, hash.length); Preconditions.checkPositionIndexes(offset, offset + maxLength, dest.length); System.arraycopy(hash, 0, dest, offset, maxLength); return maxLength; }
/** * Copies bytes from this hash code into {@code dest}. * * @param dest the byte array into which the hash code will be written * @param offset the start offset in the data * @param maxLength the maximum number of bytes to write * @return the number of bytes written to {@code dest} * @throws IndexOutOfBoundsException if there is not enough room in {@code dest} */ public int writeBytesTo(byte[] dest, int offset, int maxLength) { byte[] hash = asBytes(); maxLength = Ints.min(maxLength, hash.length); Preconditions.checkPositionIndexes(offset, offset + maxLength, dest.length); System.arraycopy(hash, 0, dest, offset, maxLength); return maxLength; }
@Override public String apply(@Nullable Token token) { assert token != null; final String postag = nullToEmpty(token.getPostag()); return token.getLemma() + "_" + postag.substring(0, min(1, postag.length())); } });
public void testMin_noArgs() { try { Ints.min(); fail(); } catch (IllegalArgumentException expected) { } }
/** * Copies bytes from this hash code into {@code dest}. * * @param dest the byte array into which the hash code will be written * @param offset the start offset in the data * @param maxLength the maximum number of bytes to write * @return the number of bytes written to {@code dest} * @throws IndexOutOfBoundsException if there is not enough room in {@code dest} */ public int writeBytesTo(byte[] dest, int offset, int maxLength) { maxLength = Ints.min(maxLength, bits() / 8); Preconditions.checkPositionIndexes(offset, offset + maxLength, dest.length); writeBytesToImpl(dest, offset, maxLength); return maxLength; }
/** * Copies bytes from this hash code into {@code dest}. * * @param dest the byte array into which the hash code will be written * @param offset the start offset in the data * @param maxLength the maximum number of bytes to write * @return the number of bytes written to {@code dest} * @throws IndexOutOfBoundsException if there is not enough room in {@code dest} */ public int writeBytesTo(byte[] dest, int offset, int maxLength) { maxLength = Ints.min(maxLength, bits() / 8); Preconditions.checkPositionIndexes(offset, offset + maxLength, dest.length); writeBytesToImpl(dest, offset, maxLength); return maxLength; }
public static int calculateSharedBytes(Slice leftKey, Slice rightKey) { int sharedKeyBytes = 0; if (leftKey != null && rightKey != null) { int minSharedKeyBytes = Ints.min(leftKey.length(), rightKey.length()); while (sharedKeyBytes < minSharedKeyBytes && leftKey.getByte(sharedKeyBytes) == rightKey.getByte(sharedKeyBytes)) { sharedKeyBytes++; } } return sharedKeyBytes; }
/** * Copies bytes from this hash code into {@code dest}. * * @param dest the byte array into which the hash code will be written * @param offset the start offset in the data * @param maxLength the maximum number of bytes to write * @return the number of bytes written to {@code dest} * @throws IndexOutOfBoundsException if there is not enough room in {@code dest} */ @CanIgnoreReturnValue public int writeBytesTo(byte[] dest, int offset, int maxLength) { maxLength = Ints.min(maxLength, bits() / 8); Preconditions.checkPositionIndexes(offset, offset + maxLength, dest.length); writeBytesToImpl(dest, offset, maxLength); return maxLength; }
/** * Copies bytes from this hash code into {@code dest}. * * @param dest the byte array into which the hash code will be written * @param offset the start offset in the data * @param maxLength the maximum number of bytes to write * @return the number of bytes written to {@code dest} * @throws IndexOutOfBoundsException if there is not enough room in {@code dest} */ @CanIgnoreReturnValue public int writeBytesTo(byte[] dest, int offset, int maxLength) { maxLength = Ints.min(maxLength, bits() / 8); Preconditions.checkPositionIndexes(offset, offset + maxLength, dest.length); writeBytesToImpl(dest, offset, maxLength); return maxLength; }
public static QRcodeTicketJsonRtn createTemporaryQRcode(License license, long sceneId, int expireSeconds) { if (expireSeconds <= 0) { return JsonRtnUtil.buildFailureJsonRtn(QRcodeTicketJsonRtn.class, "expireSeconds must be positive"); } expireSeconds = Ints.min(expireSeconds, 1800); QRcodeActionInfo actionInfo = new QRcodeActionInfo(new QRcodeScene(sceneId)); return createQRcode(license, new QRcodeTicket(QRcodeType.TEMPORARY.getActionName(), expireSeconds, actionInfo)); }