randoop.util
Class StringLineIterator

Object
  extended by StringLineIterator

public class StringLineIterator
extends Object

Given a string consisting of words separated by white space, lets the user ask for the words as lines of text of a desired length, until there are no more words.


Constructor Summary
Constructor and Description
StringLineIterator(String words)
           
 
Method Summary
Modifier and Type Method and Description
 boolean hasMoreWords()
          True if there are more words remaining.
 String nextLine(int length)
          Returns a line of words, ensuring that the length of the line is no greater than the given length.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringLineIterator

public StringLineIterator(String words)
Method Detail

hasMoreWords

public boolean hasMoreWords()
True if there are more words remaining.


nextLine

public String nextLine(int length)
Returns a line of words, ensuring that the length of the line is no greater than the given length. If such a line is not possible, returns an empty String. Note that if length is always too small for the iterator to make progress by returning non-empty lines, the iterator will not terminate.