From 13845e47d6ad44f63ba93383701f7bb0f4128bc3 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Thu, 1 Aug 2013 13:23:39 +0200 Subject: [PATCH] cleamup ShardIter#reset method don't have teh reset method return an instance, as it might confuse usage into thinking it might be a different instance --- .../cluster/routing/PlainShardIterator.java | 20 +++++++------------ .../cluster/routing/PlainShardsIterator.java | 3 +-- .../cluster/routing/ShardIterator.java | 2 +- .../cluster/routing/ShardsIterator.java | 7 +++++-- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/elasticsearch/cluster/routing/PlainShardIterator.java b/src/main/java/org/elasticsearch/cluster/routing/PlainShardIterator.java index 74febde90e8..0e0ae85f0ce 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/PlainShardIterator.java +++ b/src/main/java/org/elasticsearch/cluster/routing/PlainShardIterator.java @@ -34,9 +34,9 @@ public class PlainShardIterator extends PlainShardsIterator implements ShardIter /** * Creates a {@link PlainShardIterator} instance that iterates over a subset of the given shards * this the a given shardId. - * - * @param shardId shard id of the group - * @param shards shards to iterate + * + * @param shardId shard id of the group + * @param shards shards to iterate */ public PlainShardIterator(ShardId shardId, List shards) { super(shards); @@ -46,22 +46,16 @@ public class PlainShardIterator extends PlainShardsIterator implements ShardIter /** * Creates a {@link PlainShardIterator} instance that iterates over a subset of the given shards * this the a given shardId. - * - * @param shardId shard id of the group - * @param shards shards to iterate - * @param index the offset in the shards list to start the iteration from + * + * @param shardId shard id of the group + * @param shards shards to iterate + * @param index the offset in the shards list to start the iteration from */ public PlainShardIterator(ShardId shardId, List shards, int index) { super(shards, index); this.shardId = shardId; } - @Override - public ShardIterator reset() { - super.reset(); - return this; - } - @Override public ShardId shardId() { return this.shardId; diff --git a/src/main/java/org/elasticsearch/cluster/routing/PlainShardsIterator.java b/src/main/java/org/elasticsearch/cluster/routing/PlainShardsIterator.java index 62a15774b54..f6a62aebbd9 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/PlainShardsIterator.java +++ b/src/main/java/org/elasticsearch/cluster/routing/PlainShardsIterator.java @@ -54,9 +54,8 @@ public class PlainShardsIterator implements ShardsIterator { } @Override - public ShardsIterator reset() { + public void reset() { this.counter = this.index; - return this; } @Override diff --git a/src/main/java/org/elasticsearch/cluster/routing/ShardIterator.java b/src/main/java/org/elasticsearch/cluster/routing/ShardIterator.java index d1de327d072..1af84e6a99a 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/ShardIterator.java +++ b/src/main/java/org/elasticsearch/cluster/routing/ShardIterator.java @@ -34,5 +34,5 @@ public interface ShardIterator extends ShardsIterator { /** * Resets the iterator. */ - ShardIterator reset(); + void reset(); } diff --git a/src/main/java/org/elasticsearch/cluster/routing/ShardsIterator.java b/src/main/java/org/elasticsearch/cluster/routing/ShardsIterator.java index 13af41c789f..b36d358b752 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/ShardsIterator.java +++ b/src/main/java/org/elasticsearch/cluster/routing/ShardsIterator.java @@ -27,16 +27,18 @@ public interface ShardsIterator { /** * Resets the iterator to its initial state. */ - ShardsIterator reset(); + void reset(); /** * The number of shard routing instances. - * @return number of shard routing instances in this iterator + * + * @return number of shard routing instances in this iterator */ int size(); /** * The number of active shard routing instances + * * @return number of active shard routing instances */ int sizeActive(); @@ -63,6 +65,7 @@ public interface ShardsIterator { /** * Return the number of shards remaining in this {@link ShardsIterator} + * * @return number of shard remaining */ int remaining();