org.ahmadsoft.ropes.impl
Class ConcatenationRopeIteratorImpl
java.lang.Object
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
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConcatenationRopeIteratorImpl
public ConcatenationRopeIteratorImpl(Rope rope)
ConcatenationRopeIteratorImpl
public ConcatenationRopeIteratorImpl(Rope rope,
int start)
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.