List of usage examples for com.google.common.primitives UnsignedInteger compareTo
@Override public int compareTo(UnsignedInteger other)
From source file:com.spotify.crtauth.utils.TimeIntervals.java
public static boolean isExpired(int validFrom, int validTo, TimeSupplier timeSupplier) { UnsignedInteger currentUTime = timeSupplier.getTime(); UnsignedInteger validUFrom = UnsignedInteger.fromIntBits(validFrom); UnsignedInteger validUTo = UnsignedInteger.fromIntBits(validTo); if (validUFrom.compareTo(currentUTime) > 0 || validUTo.compareTo(currentUTime) < 0) { return true; }//ww w .j a v a2 s . c o m return false; }
From source file:org.apache.nifi.processors.evtx.parser.NumberUtil.java
/** * Throws an exception if the UnsignedInteger is greater than a given int, returning the int value otherwise * * @param unsignedInteger the number// w w w.j a v a 2 s. c om * @param max the maximum value * @param errorMessage error message (can be Java format string) * @param args args for error message format string * @return the value * @throws IOException if the value is greater than max */ public static int intValueMax(UnsignedInteger unsignedInteger, int max, String errorMessage, Object... args) throws IOException { if (unsignedInteger.compareTo(UnsignedInteger.valueOf(max)) > 0) { throw createException(errorMessage, args, "< " + max, unsignedInteger); } return unsignedInteger.intValue(); }
From source file:com.mrd.bitlib.model.Transaction.java
/** * Returns the minimum nSequence number of all inputs * Can be used to detect transactions marked for Full-RBF and thus are very low trust while having 0 conf * Transactions with minSequenceNumber < MAX_INT-1 are eligible for full RBF * https://github.com/bitcoin/bitcoin/pull/6871#event-476297575 * * @return the min nSequence of all inputs of that transaction *//*from w w w .j av a 2 s . c om*/ public UnsignedInteger getMinSequenceNumber() { UnsignedInteger minVal = UnsignedInteger.MAX_VALUE; for (TransactionInput input : inputs) { UnsignedInteger nSequence = UnsignedInteger.fromIntBits(input.sequence); if (nSequence.compareTo(minVal) < 0) { minVal = nSequence; } } return minVal; }