From 289f5ff4f51197ddd672be2bb0621f096479a168 Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Wed, 14 Nov 2018 15:31:35 +0300 Subject: [PATCH] Javadocs added --- .../org/redisson/api/RCollectionAsync.java | 6 +- .../org/redisson/api/RScoredSortedSet.java | 217 +++++++++++++++++- .../redisson/api/RScoredSortedSetAsync.java | 208 ++++++++++++++++- 3 files changed, 422 insertions(+), 9 deletions(-) diff --git a/redisson/src/main/java/org/redisson/api/RCollectionAsync.java b/redisson/src/main/java/org/redisson/api/RCollectionAsync.java index dd8666933..94f2d3158 100644 --- a/redisson/src/main/java/org/redisson/api/RCollectionAsync.java +++ b/redisson/src/main/java/org/redisson/api/RCollectionAsync.java @@ -28,7 +28,7 @@ public interface RCollectionAsync extends RExpirableAsync { /** * Retains only the elements in this collection that are contained in the - * specified collection (optional operation). + * specified collection. * * @param c collection containing elements to be retained in this collection * @return true if this collection changed as a result of the call @@ -37,7 +37,7 @@ public interface RCollectionAsync extends RExpirableAsync { /** * Removes all of this collection's elements that are also contained in the - * specified collection (optional operation). + * specified collection. * * @param c collection containing elements to be removed from this collection * @return true if this collection changed as a result of the @@ -66,7 +66,7 @@ public interface RCollectionAsync extends RExpirableAsync { /** * Removes a single instance of the specified element from this - * collection, if it is present (optional operation). + * collection, if it is present. * * @param o element to be removed from this collection, if present * @return true if an element was removed as a result of this call diff --git a/redisson/src/main/java/org/redisson/api/RScoredSortedSet.java b/redisson/src/main/java/org/redisson/api/RScoredSortedSet.java index 35c0cab68..d9005de60 100644 --- a/redisson/src/main/java/org/redisson/api/RScoredSortedSet.java +++ b/redisson/src/main/java/org/redisson/api/RScoredSortedSet.java @@ -162,10 +162,39 @@ public interface RScoredSortedSet extends RScoredSortedSetAsync, Iterable< */ Double lastScore(); + /** + * Adds all elements contained in the specified map to this sorted set. + * Map contains of score mapped by object. + * + * @param objects - map of elements to add + * @return amount of added elements, not including already existing in this sorted set + */ int addAll(Map objects); + /** + * Removes values by score range. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @return number of elements removed + */ int removeRangeByScore(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive); + /** + * Removes 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 number of elements removed + */ int removeRangeByRank(int startIndex, int endIndex); /** @@ -273,23 +302,81 @@ public interface RScoredSortedSet extends RScoredSortedSetAsync, Iterable< */ Iterator iterator(String pattern, int count); + /** + * Returns true if this sorted set contains encoded state of the specified element. + * + * @param o element whose presence in this collection is to be tested + * @return true if this sorted set contains the specified + * element and false otherwise + */ boolean contains(Object o); + /** + * Returns this sorted set in array of Object type. + * + * @return array of values + */ Object[] toArray(); + /** + * Returns this sorted set in array of defined type. + * + * @param a - instance of array + * @return array of values + */ T[] toArray(T[] a); + /** + * Removes a single instance of the specified element from this + * sorted set, if it is present. + * + * @param o element to be removed from this sorted set, if present + * @return true if an element was removed as a result of this call + */ boolean remove(Object o); + /** + * Returns true if this sorted set contains all of the elements + * in encoded state in the specified collection. + * + * @param c collection to be checked for containment in this sorted set + * @return true if this sorted set contains all of the elements + * in the specified collection + */ boolean containsAll(Collection c); + /** + * Removes all of this sorted set's elements that are also contained in the + * specified collection. + * + * @param c collection containing elements to be removed from this collection + * @return true if this sorted set changed as a result of the + * call + */ boolean removeAll(Collection c); + /** + * Retains only the elements in this sorted set that are contained in the + * specified collection. + * + * @param c collection containing elements to be retained in this collection + * @return true if this sorted set changed as a result of the call + */ boolean retainAll(Collection c); + /** + * Removes all elements of this sorted set. + */ void clear(); - Double addScore(V object, Number value); + /** + * Increases score of specified element by value. + * + * @param element - element whose score needs to be increased + * @param value - value + * @return updated score of element + */ + Double addScore(V element, Number value); /** * Adds score to element and returns its rank @@ -309,12 +396,44 @@ public interface RScoredSortedSet extends RScoredSortedSetAsync, Iterable< */ Integer addScoreAndGetRevRank(V object, Number value); + /** + * 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 elements + */ Collection valueRange(int startIndex, int endIndex); - + + /** + * Returns values by rank range in reverse order. Indexes are zero based. + * -1 means the highest score, -2 means the second highest score. + * + * @param startIndex - start index + * @param endIndex - end index + * @return elements + */ Collection valueRangeReversed(int startIndex, int endIndex); + /** + * Returns entries (value and its score) 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 entries + */ Collection> entryRange(int startIndex, int endIndex); + /** + * Returns entries (value and its score) by rank range in reverse order. Indexes are zero based. + * -1 means the highest score, -2 means the second highest score. + * + * @param startIndex - start index + * @param endIndex - end index + * @return entries + */ Collection> entryRangeReversed(int startIndex, int endIndex); /** @@ -349,16 +468,108 @@ public interface RScoredSortedSet extends RScoredSortedSetAsync, Iterable< */ Collection valueRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive); + /** + * Returns all entries (value and its score) between startScore and endScore. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @return entries + */ Collection> entryRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive); + /** + * Returns all values between startScore and endScore. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @param offset - offset of sorted data + * @param count - amount of sorted data + * @return values + */ Collection valueRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count); + /** + * Returns all values between startScore and endScore in reversed order. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @param offset - offset of sorted data + * @param count - amount of sorted data + * @return values + */ Collection valueRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count); + /** + * Returns all entries (value and its score) between startScore and endScore. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @param offset - offset of sorted data + * @param count - amount of sorted data + * @return entries + */ Collection> entryRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count); + /** + * Returns all entries (value and its score) between startScore and endScore in reversed order. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @return entries + */ Collection> entryRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive); - + + /** + * Returns all entries (value and its score) between startScore and endScore in reversed order. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @param offset - offset of sorted data + * @param count - amount of sorted data + * @return entries + */ Collection> entryRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count); /** diff --git a/redisson/src/main/java/org/redisson/api/RScoredSortedSetAsync.java b/redisson/src/main/java/org/redisson/api/RScoredSortedSetAsync.java index 2ba628746..a8f481507 100644 --- a/redisson/src/main/java/org/redisson/api/RScoredSortedSetAsync.java +++ b/redisson/src/main/java/org/redisson/api/RScoredSortedSetAsync.java @@ -151,10 +151,39 @@ public interface RScoredSortedSetAsync extends RExpirableAsync, RSortableAsyn */ RFuture lastScoreAsync(); + /** + * Adds all elements contained in the specified map to this sorted set. + * Map contains of score mapped by object. + * + * @param objects - map of elements to add + * @return amount of added elements, not including already existing in this sorted set + */ RFuture addAllAsync(Map objects); + /** + * Removes values by score range. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @return number of elements removed + */ RFuture removeRangeByScoreAsync(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive); + /** + * Removes 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 + */ RFuture removeRangeByRankAsync(int startIndex, int endIndex); /** @@ -219,19 +248,68 @@ public interface RScoredSortedSetAsync extends RExpirableAsync, RSortableAsyn */ RFuture tryAddAsync(double score, V object); - RFuture removeAsync(V object); + /** + * Removes a single instance of the specified element from this + * sorted set, if it is present. + * + * @param o element to be removed from this sorted set, if present + * @return true if an element was removed as a result of this call + */ + RFuture removeAsync(V o); + /** + * Returns size of this set. + * + * @return size + */ RFuture sizeAsync(); + /** + * Returns true if this sorted set contains encoded state of the specified element. + * + * @param o element whose presence in this collection is to be tested + * @return true if this sorted set contains the specified + * element and false otherwise + */ RFuture containsAsync(Object o); + /** + * Returns true if this sorted set contains all of the elements + * in encoded state in the specified collection. + * + * @param c collection to be checked for containment in this sorted set + * @return true if this sorted set contains all of the elements + * in the specified collection + */ RFuture containsAllAsync(Collection c); + /** + * Removes all of this sorted set's elements that are also contained in the + * specified collection. + * + * @param c sorted set containing elements to be removed from this collection + * @return true if this sorted set changed as a result of the + * call + */ RFuture removeAllAsync(Collection c); + /** + * Retains only the elements in this sorted set that are contained in the + * specified collection. + * + * @param c collection containing elements to be retained in this collection + * @return true if this sorted set changed as a result of the call + */ RFuture retainAllAsync(Collection c); - RFuture addScoreAsync(V object, Number value); + /** + * Increases score of specified element by value. + * + * @param element - element whose score needs to be increased + * @param value - value + * @return updated score of element + */ + RFuture addScoreAsync(V element, Number value); /** * Adds score to element and returns its reverse rank @@ -251,12 +329,44 @@ public interface RScoredSortedSetAsync extends RExpirableAsync, RSortableAsyn */ RFuture addScoreAndGetRankAsync(V object, Number value); + /** + * 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 elements + */ RFuture> valueRangeAsync(int startIndex, int endIndex); + /** + * Returns values by rank range in reverse order. Indexes are zero based. + * -1 means the highest score, -2 means the second highest score. + * + * @param startIndex - start index + * @param endIndex - end index + * @return elements + */ RFuture> valueRangeReversedAsync(int startIndex, int endIndex); + /** + * Returns entries (value and its score) 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 entries + */ RFuture>> entryRangeAsync(int startIndex, int endIndex); + /** + * Returns entries (value and its score) by rank range in reverse order. Indexes are zero based. + * -1 means the highest score, -2 means the second highest score. + * + * @param startIndex - start index + * @param endIndex - end index + * @return entries + */ RFuture>> entryRangeReversedAsync(int startIndex, int endIndex); /** @@ -291,16 +401,108 @@ public interface RScoredSortedSetAsync extends RExpirableAsync, RSortableAsyn */ RFuture> valueRangeReversedAsync(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive); + /** + * Returns all entries (value and its score) between startScore and endScore. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @return entries + */ RFuture>> entryRangeAsync(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive); + /** + * Returns all values between startScore and endScore. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @param offset - offset of sorted data + * @param count - amount of sorted data + * @return values + */ RFuture> valueRangeAsync(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count); + /** + * Returns all values between startScore and endScore in reversed order. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @param offset - offset of sorted data + * @param count - amount of sorted data + * @return values + */ RFuture> valueRangeReversedAsync(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count); + /** + * Returns all entries (value and its score) between startScore and endScore. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @param offset - offset of sorted data + * @param count - amount of sorted data + * @return entries + */ RFuture>> entryRangeAsync(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count); + /** + * Returns all entries (value and its score) between startScore and endScore in reversed order. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @return entries + */ RFuture>> entryRangeReversedAsync(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive); - + + /** + * Returns all entries (value and its score) between startScore and endScore in reversed order. + * + * @param startScore - start score. + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * @param startScoreInclusive - start score inclusive + * @param endScore - end score + * Use Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY + * to define infinity numbers + * + * @param endScoreInclusive - end score inclusive + * @param offset - offset of sorted data + * @param count - amount of sorted data + * @return entries + */ RFuture>> entryRangeReversedAsync(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count); /**