Package nxt.blockchain
Class UtxComparableData
java.lang.Object
nxt.blockchain.UtxComparableData
- All Implemented Interfaces:
Comparable<UtxComparableData>
Represents the data which is used to prioritize
UnconfirmedTransactions
in the unconfirmed pool.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionUtxComparableData(Transaction transaction, boolean isBundled, boolean isCompleteAtomicChain, long arrivalTimestamp, long fee, int fullSize) -
Method Summary
Modifier and TypeMethodDescriptioncloneIgnoringTimeAndId(long newArrivalTimestamp, long newId) intcompareTo(UtxComparableData that) booleanstatic <T> List<T>filterWithLimits(Stream<T> stream, Function<T, UtxComparableData> mapper, int minSize, int maxSize, UtxComparableData retentionThreshold, BiConsumer<T, UtxComparableData> rejectedElementConsumer) This method obtains a `UtxComparableData` object for each element in the stream using the specifiedmapper.inthashCode()toString()
-
Field Details
-
HIGHEST
-
-
Constructor Details
-
UtxComparableData
public UtxComparableData(Transaction transaction, boolean isBundled, boolean isCompleteAtomicChain, long arrivalTimestamp, long fee, int fullSize)
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<UtxComparableData>
-
equals
-
hashCode
public int hashCode() -
toString
-
cloneIgnoringTimeAndId
-
filterWithLimits
public static <T> List<T> filterWithLimits(Stream<T> stream, Function<T, UtxComparableData> mapper, int minSize, int maxSize, UtxComparableData retentionThreshold, BiConsumer<T, UtxComparableData> rejectedElementConsumer) This method obtains a `UtxComparableData` object for each element in the stream using the specifiedmapper. It then sorts the elements based on the `UtxComparableData`. After sorting, elements are removed from the end of the sorted list until the list size is reduced to either theretentionThresholdorminSize, whichever is larger. The list size is also limited bymaxSize. The list is returned as result.- Type Parameters:
T- Type of the stream elements- Parameters:
stream- Stream to sort and filtermapper- Mapper returning theUtxComparableDataof the elementsminSize- The minimum size of the returned array. If the collection size is smaller, this value is capped to the collection sizemaxSize- The maximum size of the returned arrayretentionThreshold- Elements bigger than this threshold will always be retained. If null, only the maxSize is respectedrejectedElementConsumer- If not null the rejected elements will be provided to it- Returns:
- List with the result
-