pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util
Class StringUtils.StringElementIterator

java.lang.Object
  extended by org.torweg.pulse.util.StringUtils.StringElementIterator
All Implemented Interfaces:
java.lang.Iterable<java.lang.String>, java.util.Iterator<java.lang.String>, java.util.ListIterator<java.lang.String>
Enclosing class:
StringUtils

public static class StringUtils.StringElementIterator
extends java.lang.Object
implements java.util.ListIterator<java.lang.String>, java.lang.Iterable<java.lang.String>

Simple ListIterator&lt;String&gt; that operates on a String split by a regex.

Version:
$Revision: 2022 $
Author:
Daniel Dietz

Constructor Summary
StringUtils.StringElementIterator(java.lang.String[] stringArray)
          Creates a new StringElementIterator which iterates over the given string array.
StringUtils.StringElementIterator(java.lang.String string, java.lang.String regex)
          Creates a new StringElementIterator for the given String and regex.
StringUtils.StringElementIterator(java.lang.String string, java.lang.String regex, boolean reverse)
          Creates a new reversed StringElementIterator for the given String and regex.
 
Method Summary
 void add(java.lang.String o)
          Not implemented.
 boolean hasNext()
          Returns whether the StringElementIterator has more elements.
 boolean hasPrevious()
          Returns whether the StringElementIterator has an element prior to the current element.
 java.util.Iterator<java.lang.String> iterator()
          Returns a new StringElementIterator operating on a new instance of the internal list.
 java.lang.String next()
          Returns the next element.
 int nextIndex()
          Returns the next index.
 java.lang.String previous()
          Returns the previous element.
 int previousIndex()
          Returns the previous index.
 void remove()
          Not implemented.
 void set(java.lang.String o)
          Not implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtils.StringElementIterator

public StringUtils.StringElementIterator(java.lang.String string,
                                         java.lang.String regex)
Creates a new StringElementIterator for the given String and regex.

Parameters:
string - the String
regex - the regex for the split

StringUtils.StringElementIterator

public StringUtils.StringElementIterator(java.lang.String string,
                                         java.lang.String regex,
                                         boolean reverse)
Creates a new reversed StringElementIterator for the given String and regex.

Parameters:
string - the String
regex - the regex for the split
reverse - flag, indicating whether the iterator shall process the split String in reverse order ( true)

StringUtils.StringElementIterator

public StringUtils.StringElementIterator(java.lang.String[] stringArray)
Creates a new StringElementIterator which iterates over the given string array.

Parameters:
stringArray - the String[]
Method Detail

add

public final void add(java.lang.String o)
               throws java.lang.UnsupportedOperationException
Not implemented.

Specified by:
add in interface java.util.ListIterator<java.lang.String>
Parameters:
o - unused
Throws:
java.lang.UnsupportedOperationException - always
See Also:
ListIterator.add(java.lang.Object)

hasNext

public final boolean hasNext()
Returns whether the StringElementIterator has more elements.

Specified by:
hasNext in interface java.util.Iterator<java.lang.String>
Specified by:
hasNext in interface java.util.ListIterator<java.lang.String>
Returns:
true if the Iterator has more elements, false otherwise
See Also:
ListIterator.hasNext()

hasPrevious

public final boolean hasPrevious()
Returns whether the StringElementIterator has an element prior to the current element.

Specified by:
hasPrevious in interface java.util.ListIterator<java.lang.String>
Returns:
true if the Iterator has previous elements, false otherwise
See Also:
ListIterator.hasPrevious()

next

public final java.lang.String next()
Returns the next element.

Specified by:
next in interface java.util.Iterator<java.lang.String>
Specified by:
next in interface java.util.ListIterator<java.lang.String>
Returns:
the next element
See Also:
ListIterator.next()

nextIndex

public final int nextIndex()
Returns the next index.

Specified by:
nextIndex in interface java.util.ListIterator<java.lang.String>
Returns:
the next index
See Also:
ListIterator.nextIndex()

previous

public final java.lang.String previous()
Returns the previous element.

Specified by:
previous in interface java.util.ListIterator<java.lang.String>
Returns:
the previous element
See Also:
ListIterator.previous()

previousIndex

public final int previousIndex()
Returns the previous index.

Specified by:
previousIndex in interface java.util.ListIterator<java.lang.String>
Returns:
the previous index
See Also:
ListIterator.previousIndex()

remove

public final void remove()
                  throws java.lang.UnsupportedOperationException
Not implemented.

Specified by:
remove in interface java.util.Iterator<java.lang.String>
Specified by:
remove in interface java.util.ListIterator<java.lang.String>
Throws:
java.lang.UnsupportedOperationException - always
See Also:
ListIterator.remove()

set

public final void set(java.lang.String o)
               throws java.lang.UnsupportedOperationException
Not implemented.

Specified by:
set in interface java.util.ListIterator<java.lang.String>
Parameters:
o - unused
Throws:
java.lang.UnsupportedOperationException - always
See Also:
ListIterator.set(java.lang.Object)

iterator

public final java.util.Iterator<java.lang.String> iterator()
Returns a new StringElementIterator operating on a new instance of the internal list.

Specified by:
iterator in interface java.lang.Iterable<java.lang.String>
Returns:
this StringElementIterator
See Also:
Iterable.iterator()