org.ahmadsoft.ropes.impl
Class ConcatenationRopeIteratorImpl

java.lang.Object
  extended by org.ahmadsoft.ropes.impl.ConcatenationRopeIteratorImpl
All Implemented Interfaces:
java.util.Iterator<java.lang.Character>

public class ConcatenationRopeIteratorImpl
extends java.lang.Object
implements java.util.Iterator<java.lang.Character>

A fast iterator for concatenated ropes. Iterating over a complex rope structure is guaranteed to be O(n) so long as it is reasonably well-balanced. Compare this to O(nlogn) for iteration using charAt.

Author:
aahmad

Constructor Summary
ConcatenationRopeIteratorImpl(Rope rope)
           
ConcatenationRopeIteratorImpl(Rope rope, int start)
           
 
Method Summary
 boolean canMoveBackwards(int amount)
           
 int getPos()
           
 boolean hasNext()
           
 void moveBackwards(int amount)
           
 void moveForward(int amount)
           
 java.lang.Character next()
           
 void remove()
           
 void skip(int skip)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcatenationRopeIteratorImpl

public ConcatenationRopeIteratorImpl(Rope rope)

ConcatenationRopeIteratorImpl

public ConcatenationRopeIteratorImpl(Rope rope,
                                     int start)
Method Detail

canMoveBackwards

public boolean canMoveBackwards(int amount)

getPos

public int getPos()

hasNext

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

moveBackwards

public void moveBackwards(int amount)

moveForward

public void moveForward(int amount)

next

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

remove

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

skip

public void skip(int skip)


Copyright © 2007 Amin Ahmad. All Rights Reserved.