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

public class PlainShardsIterator
extends java.lang.Object
implements ShardsIterator


Constructor Summary
PlainShardsIterator(ShardId shardId, java.util.List<ShardRouting> shards)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 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.
 ShardId shardId()
          The shard id this group relates to.
 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, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlainShardsIterator

public PlainShardsIterator(ShardId shardId,
                           java.util.List<ShardRouting> shards)
Method Detail

reset

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

Specified by:
reset in interface ShardsIterator

size

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

Specified by:
size in interface ShardsIterator

shardId

public ShardId shardId()
Description copied from interface: ShardsIterator
The shard id this group relates to.

Specified by:
shardId in interface ShardsIterator

iterator

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

hasNext

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

next

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

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()

remove

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

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface ShardsIterator
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface ShardsIterator
Overrides:
hashCode in class java.lang.Object