From d51671b67d613a6192ab79528e16f044cd6173d1 Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Thu, 7 Feb 2019 15:54:12 +0300 Subject: [PATCH] javadocs added --- .../java/org/redisson/api/RLexSortedSet.java | 179 ++++++++++++++++- .../org/redisson/api/RLexSortedSetAsync.java | 189 +++++++++++++++++- .../redisson/api/RLexSortedSetReactive.java | 101 +++++++++- .../org/redisson/api/RLexSortedSetRx.java | 101 +++++++++- 4 files changed, 566 insertions(+), 4 deletions(-) diff --git a/redisson/src/main/java/org/redisson/api/RLexSortedSet.java b/redisson/src/main/java/org/redisson/api/RLexSortedSet.java index bd9f41e43..3a043b419 100644 --- a/redisson/src/main/java/org/redisson/api/RLexSortedSet.java +++ b/redisson/src/main/java/org/redisson/api/RLexSortedSet.java @@ -25,8 +25,19 @@ import java.util.Collection; */ public interface RLexSortedSet extends RLexSortedSetAsync, RSortedSet, RExpirable { + /** + * Removes and returns the head element or {@code null} if this sorted set is empty. + * + * @return the head element, + * or {@code null} if this sorted set is empty + */ String pollFirst(); + /** + * Removes and returns the tail element or {@code null} if this sorted set is empty. + * + * @return the tail element or {@code null} if this sorted set is empty + */ String pollLast(); /** @@ -37,44 +48,210 @@ public interface RLexSortedSet extends RLexSortedSetAsync, RSortedSet, R */ Integer revRank(String o); + /** + * Removes tail values range starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return number of elements removed + */ int removeRangeTail(String fromElement, boolean fromInclusive); - + + /** + * Removes head values range ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements removed + */ int removeRangeHead(String toElement, boolean toInclusive); + /** + * Removes values range starting with fromElement and ending with toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements removed + */ int removeRange(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Returns the number of tail values starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return number of elements + */ int countTail(String fromElement, boolean fromInclusive); + /** + * Returns the number of head values ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements + */ int countHead(String toElement, boolean toInclusive); + /** + * Returns tail values range starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return collection of elements + */ Collection rangeTail(String fromElement, boolean fromInclusive); + /** + * Returns head values range ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Collection rangeHead(String toElement, boolean toInclusive); + /** + * Returns values range starting with fromElement and ending with toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Collection range(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Returns tail values range starting with fromElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ Collection rangeTail(String fromElement, boolean fromInclusive, int offset, int count); + /** + * Returns head values range ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ Collection rangeHead(String toElement, boolean toInclusive, int offset, int count); + /** + * Returns values range starting with fromElement and ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Collection range(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count); + /** + * Returns tail values range in reverse order starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return collection of elements + */ Collection rangeTailReversed(String fromElement, boolean fromInclusive); + /** + * Returns head values range in reverse order ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Collection rangeHeadReversed(String toElement, boolean toInclusive); + /** + * Returns values range in reverse order starting with fromElement and ending with toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Collection rangeReversed(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Returns tail values range in reverse order starting with fromElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ Collection rangeTailReversed(String fromElement, boolean fromInclusive, int offset, int count); + /** + * Returns head values range in reverse order ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ Collection rangeHeadReversed(String toElement, boolean toInclusive, int offset, int count); + /** + * Returns values range in reverse order starting with fromElement and ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Collection rangeReversed(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count); + /** + * Returns the number of elements between fromElement and toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements + */ int count(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Returns rank of the element + * + * @param o - element to rank + * @return rank or null if element does not exist + */ Integer rank(String o); + /** + * Returns values by rank range. Indexes are zero based. + * -1 means the highest score, -2 means the second highest score. + * + * @param startIndex - start index + * @param endIndex - end index + * @return collection of elements + */ Collection range(int startIndex, int endIndex); } diff --git a/redisson/src/main/java/org/redisson/api/RLexSortedSetAsync.java b/redisson/src/main/java/org/redisson/api/RLexSortedSetAsync.java index a54090806..aee22d0e4 100644 --- a/redisson/src/main/java/org/redisson/api/RLexSortedSetAsync.java +++ b/redisson/src/main/java/org/redisson/api/RLexSortedSetAsync.java @@ -18,19 +18,40 @@ package org.redisson.api; import java.util.Collection; /** - * Sorted set contained values of String type + * Async interface for sorted set contained values of String type. * * @author Nikita Koksharov * */ public interface RLexSortedSetAsync extends RCollectionAsync { + /** + * Removes and returns the tail element or {@code null} if this sorted set is empty. + * + * @return the tail element or {@code null} if this sorted set is empty + */ RFuture pollLastAsync(); + /** + * Removes and returns the head element or {@code null} if this sorted set is empty. + * + * @return the head element, + * or {@code null} if this sorted set is empty + */ RFuture pollFirstAsync(); + /** + * Returns the first element. + * + * @return element + */ RFuture firstAsync(); + /** + * Returns the last element. + * + * @return element + */ RFuture lastAsync(); /** @@ -40,44 +61,210 @@ public interface RLexSortedSetAsync extends RCollectionAsync { */ RFuture> readAllAsync(); + /** + * Removes values range starting with fromElement and ending with toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements removed + */ RFuture removeRangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Removes tail values range starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return number of elements removed + */ RFuture removeRangeTailAsync(String fromElement, boolean fromInclusive); + /** + * Removes head values range ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements removed + */ RFuture removeRangeHeadAsync(String toElement, boolean toInclusive); + /** + * Returns the number of tail values starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return number of elements + */ RFuture countTailAsync(String fromElement, boolean fromInclusive); + /** + * Returns the number of head values ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements + */ RFuture countHeadAsync(String toElement, boolean toInclusive); + /** + * Returns tail values range starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return collection of elements + */ RFuture> rangeTailAsync(String fromElement, boolean fromInclusive); + /** + * Returns head values range ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ RFuture> rangeHeadAsync(String toElement, boolean toInclusive); + /** + * Returns values range starting with fromElement and ending with toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ RFuture> rangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Returns tail values range starting with fromElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ RFuture> rangeTailAsync(String fromElement, boolean fromInclusive, int offset, int count); + /** + * Returns head values range ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ RFuture> rangeHeadAsync(String toElement, boolean toInclusive, int offset, int count); + /** + * Returns values range starting with fromElement and ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ RFuture> rangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count); + /** + * Returns tail values range in reverse order starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return collection of elements + */ RFuture> rangeTailReversedAsync(String fromElement, boolean fromInclusive); + /** + * Returns head values range in reverse order ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ RFuture> rangeHeadReversedAsync(String toElement, boolean toInclusive); + /** + * Returns values range in reverse order starting with fromElement and ending with toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ RFuture> rangeReversedAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Returns tail values range in reverse order starting with fromElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ RFuture> rangeTailReversedAsync(String fromElement, boolean fromInclusive, int offset, int count); + /** + * Returns head values range in reverse order ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ RFuture> rangeHeadReversedAsync(String toElement, boolean toInclusive, int offset, int count); + /** + * Returns values range in reverse order starting with fromElement and ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ RFuture> rangeReversedAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count); + /** + * Returns the number of elements between fromElement and toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements + */ RFuture countAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Returns rank of the element + * + * @param o - element to rank + * @return rank or null if element does not exist + */ RFuture rankAsync(String o); + /** + * Returns values by rank range. Indexes are zero based. + * -1 means the highest score, -2 means the second highest score. + * + * @param startIndex - start index + * @param endIndex - end index + * @return collection of elements + */ RFuture> rangeAsync(int startIndex, int endIndex); /** diff --git a/redisson/src/main/java/org/redisson/api/RLexSortedSetReactive.java b/redisson/src/main/java/org/redisson/api/RLexSortedSetReactive.java index a3bc4585d..ec2cc945c 100644 --- a/redisson/src/main/java/org/redisson/api/RLexSortedSetReactive.java +++ b/redisson/src/main/java/org/redisson/api/RLexSortedSetReactive.java @@ -20,35 +20,134 @@ import java.util.Collection; import org.reactivestreams.Publisher; /** - * Reactive interface for LexSortedSet object + * Reactive interface for sorted set contained values of String type. * * @author Nikita Koksharov * */ public interface RLexSortedSetReactive extends RScoredSortedSetReactive, RCollectionReactive { + /** + * Removes values range starting with fromElement and ending with toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements removed + */ Publisher removeRange(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Removes tail values range starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return number of elements removed + */ Publisher removeRangeTail(String fromElement, boolean fromInclusive); + /** + * Removes head values range ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements removed + */ Publisher removeRangeHead(String toElement, boolean toInclusive); + /** + * Returns the number of tail values starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return number of elements + */ Publisher countTail(String fromElement, boolean fromInclusive); + /** + * Returns the number of head values ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements + */ Publisher countHead(String toElement, boolean toInclusive); + /** + * Returns tail values range starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return collection of elements + */ Publisher> rangeTail(String fromElement, boolean fromInclusive); + /** + * Returns head values range ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Publisher> rangeHead(String toElement, boolean toInclusive); + /** + * Returns values range starting with fromElement and ending with toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Publisher> range(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Returns tail values range starting with fromElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ Publisher> rangeTail(String fromElement, boolean fromInclusive, int offset, int count); + /** + * Returns head values range ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ Publisher> rangeHead(String toElement, boolean toInclusive, int offset, int count); + /** + * Returns values range starting with fromElement and ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Publisher> range(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count); + /** + * Returns the number of elements between fromElement and toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements + */ Publisher count(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); } diff --git a/redisson/src/main/java/org/redisson/api/RLexSortedSetRx.java b/redisson/src/main/java/org/redisson/api/RLexSortedSetRx.java index daebca176..f937bc36b 100644 --- a/redisson/src/main/java/org/redisson/api/RLexSortedSetRx.java +++ b/redisson/src/main/java/org/redisson/api/RLexSortedSetRx.java @@ -20,35 +20,134 @@ import java.util.Collection; import io.reactivex.Flowable; /** - * RxJava2 interface for LexSortedSet object + * RxJava2 interface for sorted set contained values of String type. * * @author Nikita Koksharov * */ public interface RLexSortedSetRx extends RScoredSortedSetRx, RCollectionRx { + /** + * Removes values range starting with fromElement and ending with toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements removed + */ Flowable removeRange(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Removes tail values range starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return number of elements removed + */ Flowable removeRangeTail(String fromElement, boolean fromInclusive); + /** + * Removes head values range ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements removed + */ Flowable removeRangeHead(String toElement, boolean toInclusive); + /** + * Returns the number of tail values starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return number of elements + */ Flowable countTail(String fromElement, boolean fromInclusive); + /** + * Returns the number of head values ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements + */ Flowable countHead(String toElement, boolean toInclusive); + /** + * Returns tail values range starting with fromElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @return collection of elements + */ Flowable> rangeTail(String fromElement, boolean fromInclusive); + /** + * Returns head values range ending with toElement. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Flowable> rangeHead(String toElement, boolean toInclusive); + /** + * Returns values range starting with fromElement and ending with toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Flowable> range(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); + /** + * Returns tail values range starting with fromElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ Flowable> rangeTail(String fromElement, boolean fromInclusive, int offset, int count); + /** + * Returns head values range ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param toElement - end element + * @param toInclusive - end element inclusive + * @param offset - offset of result collection + * @param count - amount of result collection + * @return collection of elements + */ Flowable> rangeHead(String toElement, boolean toInclusive, int offset, int count); + /** + * Returns values range starting with fromElement and ending with toElement. + * Returned collection limited by count and starts with offset. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return collection of elements + */ Flowable> range(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count); + /** + * Returns the number of elements between fromElement and toElement. + * + * @param fromElement - start element + * @param fromInclusive - start element inclusive + * @param toElement - end element + * @param toInclusive - end element inclusive + * @return number of elements + */ Flowable count(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); }