Skip to content

Commit

Permalink
RLexSortedSet should extend RSortedSet #940
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita committed Jun 26, 2017
1 parent 631f455 commit 96a62e6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 32 deletions.
29 changes: 28 additions & 1 deletion redisson/src/main/java/org/redisson/RedissonLexSortedSet.java
Expand Up @@ -17,7 +17,9 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.SortedSet;

import org.redisson.api.RFuture;
import org.redisson.api.RLexSortedSet;
Expand Down Expand Up @@ -233,5 +235,30 @@ public Collection<String> range(int startIndex, int endIndex) {
public RFuture<Collection<String>> rangeAsync(int startIndex, int endIndex) {
return valueRangeAsync(startIndex, endIndex);
}


@Override
public boolean trySetComparator(Comparator<? super String> comparator) {
throw new UnsupportedOperationException();
}

@Override
public Comparator<? super String> comparator() {
return null;
}

@Override
public SortedSet<String> subSet(String fromElement, String toElement) {
throw new UnsupportedOperationException();
}

@Override
public SortedSet<String> headSet(String toElement) {
return subSet(null, toElement);
}

@Override
public SortedSet<String> tailSet(String fromElement) {
return subSet(fromElement, null);
}

}
6 changes: 3 additions & 3 deletions redisson/src/main/java/org/redisson/RedissonSortedSet.java
Expand Up @@ -171,12 +171,12 @@ private static String calcClassSign(String name) {
}

@Override
public Set<V> readAll() {
public Collection<V> readAll() {
return get(readAllAsync());
}

@Override
public RFuture<Set<V>> readAllAsync() {
public RFuture<Collection<V>> readAllAsync() {
return commandExecutor.readAsync(getName(), codec, RedisCommands.LRANGE_SET, getName(), 0, -1);
}

Expand Down Expand Up @@ -267,7 +267,7 @@ public void run() {
}

@Override
public RFuture<Boolean> removeAsync(final V value) {
public RFuture<Boolean> removeAsync(final Object value) {
final RPromise<Boolean> promise = newPromise();
commandExecutor.getConnectionManager().getExecutor().execute(new Runnable() {
@Override
Expand Down
25 changes: 1 addition & 24 deletions redisson/src/main/java/org/redisson/api/RLexSortedSet.java
Expand Up @@ -16,35 +16,19 @@
package org.redisson.api;

import java.util.Collection;
import java.util.Set;

import org.redisson.api.mapreduce.RCollectionMapReduce;

/**
* Sorted set contained values of String type
*
* @author Nikita Koksharov
*
*/
public interface RLexSortedSet extends RLexSortedSetAsync, Set<String>, RExpirable {

/**
* Returns <code>RMapReduce</code> object associated with this object
*
* @param <KOut> output key
* @param <VOut> output value
* @return MapReduce instance
*/
<KOut, VOut> RCollectionMapReduce<String, KOut, VOut> mapReduce();
public interface RLexSortedSet extends RLexSortedSetAsync, RSortedSet<String>, RExpirable {

String pollFirst();

String pollLast();

String first();

String last();

/**
* Returns rank of value, with the scores ordered from high to low.
*
Expand All @@ -53,13 +37,6 @@ public interface RLexSortedSet extends RLexSortedSetAsync, Set<String>, RExpirab
*/
Integer revRank(String o);

/**
* Read all values at once.
*
* @return collection of values
*/
Collection<String> readAll();

int removeRangeTail(String fromElement, boolean fromInclusive);

int removeRangeHead(String toElement, boolean toInclusive);
Expand Down
8 changes: 4 additions & 4 deletions redisson/src/main/java/org/redisson/api/RSortedSet.java
Expand Up @@ -15,8 +15,8 @@
*/
package org.redisson.api;

import java.util.Collection;
import java.util.Comparator;
import java.util.Set;
import java.util.SortedSet;

import org.redisson.api.mapreduce.RCollectionMapReduce;
Expand All @@ -38,13 +38,13 @@ public interface RSortedSet<V> extends SortedSet<V>, RObject {
*/
<KOut, VOut> RCollectionMapReduce<V, KOut, VOut> mapReduce();

Set<V> readAll();
Collection<V> readAll();

RFuture<Set<V>> readAllAsync();
RFuture<Collection<V>> readAllAsync();

RFuture<Boolean> addAsync(V value);

RFuture<Boolean> removeAsync(V value);
RFuture<Boolean> removeAsync(Object value);

/**
* Sets new comparator only if current set is empty
Expand Down

0 comments on commit 96a62e6

Please sign in to comment.