diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/DefaultRedisSortedSet.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/DefaultRedisSortedSet.java new file mode 100644 index 000000000..8822b0b18 --- /dev/null +++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/DefaultRedisSortedSet.java @@ -0,0 +1,177 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.datastore.redis.util; + +import java.util.Collection; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.SortedSet; + +import org.springframework.datastore.redis.connection.RedisCommands; + +/** + * Default implementation for {@link RedisSortedSet}. + * + * @author Costin Leau + */ +class DefaultRedisSortedSet extends AbstractRedisCollection implements RedisSortedSet { + + private class DefaultRedisSortedSetIterator extends RedisIterator { + + public DefaultRedisSortedSetIterator(Iterator delegate) { + super(delegate); + } + + @Override + protected void removeFromRedisStorage(String item) { + DefaultRedisSortedSet.this.remove(item); + } + } + + public DefaultRedisSortedSet(String key, RedisCommands commands) { + super(key, commands); + } + + @Override + public RedisSortedSet intersectAndStore(String destKey, RedisSet... sets) { + return null; + } + + @Override + public List range(int start, int end) { + return null; + } + + @Override + public List rangeByScore(int start, int end) { + return null; + } + + @Override + public RedisSortedSet trim(int start, int end) { + return null; + } + + @Override + public RedisSortedSet trimByScore(int start, int end) { + return null; + } + + @Override + public RedisSortedSet unionAndStore(String destKey, RedisSet... sets) { + return null; + } + + @Override + public String getKey() { + return null; + } + + @Override + public boolean add(String e) { + return false; + } + + @Override + public boolean addAll(Collection c) { + return false; + } + + @Override + public void clear() { + } + + @Override + public boolean contains(Object o) { + return false; + } + + @Override + public boolean containsAll(Collection c) { + return false; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public boolean remove(Object o) { + return false; + } + + @Override + public boolean removeAll(Collection c) { + return false; + } + + @Override + public boolean retainAll(Collection c) { + return false; + } + + @Override + public int size() { + return 0; + } + + @Override + public Object[] toArray() { + return null; + } + + @Override + public T[] toArray(T[] a) { + return null; + } + + @Override + public Comparator comparator() { + return null; + } + + @Override + public String first() { + return null; + } + + @Override + public SortedSet headSet(String toElement) { + return null; + } + + @Override + public String last() { + return null; + } + + @Override + public SortedSet subSet(String fromElement, String toElement) { + return null; + } + + @Override + public SortedSet tailSet(String fromElement) { + return null; + } +} \ No newline at end of file diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisSortedSet.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisSortedSet.java new file mode 100644 index 000000000..beb370a8a --- /dev/null +++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisSortedSet.java @@ -0,0 +1,40 @@ +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.datastore.redis.util; + +import java.util.List; +import java.util.SortedSet; + +/** + * Redis extension for the {@link SortedSet} contract. Supports {@link SortedSet} specific + * operations backed by Redis commands. + * + * @author Costin Leau + */ +public interface RedisSortedSet extends RedisCollection, SortedSet { + + RedisSortedSet intersectAndStore(String destKey, RedisSet... sets); + + RedisSortedSet unionAndStore(String destKey, RedisSet... sets); + + List range(int start, int end); + + List rangeByScore(int start, int end); + + RedisSortedSet trim(int start, int end); + + RedisSortedSet trimByScore(int start, int end); +}