org.elasticsearch.cluster.routing
Class PlainShardsIterator

java.lang.Object
  extended by org.elasticsearch.cluster.routing.PlainShardsIterator
All Implemented Interfaces:
java.lang.Iterable<ShardRouting>, java.util.Iterator<ShardRouting>, ShardsIterator
Direct Known Subclasses:
PlainShardIterator

public class PlainShardsIterator
extends java.lang.Object
implements ShardsIterator


Field Summary
protected  java.util.List<ShardRouting> shards
           
 
Constructor Summary
PlainShardsIterator(java.util.List<ShardRouting> shards)
           
PlainShardsIterator(java.util.List<ShardRouting> shards, int index)
           
 
Method Summary
 boolean hasNext()
           
 boolean hasNextActive()
          Is there an active shard we can iterate to.
 boolean hasNextAssigned()
          Is there an assigned shard we can iterate to.
 java.util.Iterator<ShardRouting> iterator()
           
 ShardRouting next()
           
 ShardRouting nextActive()
          Returns the next active shard, or throws NoSuchElementException.
 ShardRouting nextActiveOrNull()
          Returns the next active shard, or null.
 ShardRouting nextAssigned()
          Returns the next assigned shard, or throws NoSuchElementException.
 ShardRouting nextAssignedOrNull()
          Returns the next assigned shard, or null.
 void remove()
           
 ShardsIterator reset()
          Resets the iterator.
 int size()
          The number of shard routing instances.
 int sizeActive()
          The number of active shard routing instances.
 int sizeAssigned()
          The number of assigned shard routing instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.elasticsearch.cluster.routing.ShardsIterator
equals, hashCode
 

Field Detail

shards

protected final java.util.List<ShardRouting> shards
Constructor Detail

PlainShardsIterator

public PlainShardsIterator(java.util.List<ShardRouting> shards)

PlainShardsIterator

public PlainShardsIterator(java.util.List<ShardRouting> shards,
                           int index)
Method Detail

iterator

public java.util.Iterator<ShardRouting> iterator()
Specified by:
iterator in interface java.lang.Iterable<ShardRouting>

reset

public ShardsIterator reset()
Description copied from interface: ShardsIterator
Resets the iterator.

Specified by:
reset in interface ShardsIterator

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<ShardRouting>

next

public ShardRouting next()
                  throws java.util.NoSuchElementException
Specified by:
next in interface java.util.Iterator<ShardRouting>
Throws:
java.util.NoSuchElementException

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<ShardRouting>

size

public int size()
Description copied from interface: ShardsIterator
The number of shard routing instances.

Specified by:
size in interface ShardsIterator

sizeActive

public int sizeActive()
Description copied from interface: ShardsIterator
The number of active shard routing instances.

Specified by:
sizeActive in interface ShardsIterator
See Also:
ShardRouting.active()

hasNextActive

public boolean hasNextActive()
Description copied from interface: ShardsIterator
Is there an active shard we can iterate to.

Specified by:
hasNextActive in interface ShardsIterator
See Also:
ShardRouting.active()

nextActive

public ShardRouting nextActive()
                        throws java.util.NoSuchElementException
Description copied from interface: ShardsIterator
Returns the next active shard, or throws NoSuchElementException.

Specified by:
nextActive in interface ShardsIterator
Throws:
java.util.NoSuchElementException
See Also:
ShardRouting.active()

nextActiveOrNull

public ShardRouting nextActiveOrNull()
                              throws java.util.NoSuchElementException
Description copied from interface: ShardsIterator
Returns the next active shard, or null.

Specified by:
nextActiveOrNull in interface ShardsIterator
Throws:
java.util.NoSuchElementException
See Also:
ShardRouting.active()

sizeAssigned

public int sizeAssigned()
Description copied from interface: ShardsIterator
The number of assigned shard routing instances.

Specified by:
sizeAssigned in interface ShardsIterator
See Also:
ShardRouting.assignedToNode()

hasNextAssigned

public boolean hasNextAssigned()
Description copied from interface: ShardsIterator
Is there an assigned shard we can iterate to.

Specified by:
hasNextAssigned in interface ShardsIterator
See Also:
ShardRouting.assignedToNode()

nextAssigned

public ShardRouting nextAssigned()
                          throws java.util.NoSuchElementException
Description copied from interface: ShardsIterator
Returns the next assigned shard, or throws NoSuchElementException.

Specified by:
nextAssigned in interface ShardsIterator
Throws:
java.util.NoSuchElementException
See Also:
ShardRouting.assignedToNode()

nextAssignedOrNull

public ShardRouting nextAssignedOrNull()
Description copied from interface: ShardsIterator
Returns the next assigned shard, or null.

Specified by:
nextAssignedOrNull in interface ShardsIterator
See Also:
ShardRouting.assignedToNode()