Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * Copyright 2014 Christophe Pollet
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
 package net.cpollet.jixture.fixtures.generator.field;
 public class SimpleStringSequence extends BaseFieldGenerator<String> {
 	private String format;
 	private String current;
Generates a

format the format to use. Must be compliant with java.lang.String.format(java.lang.String,java.lang.Object[]).
generator the generator to use. The generated values are be included in the format
code String} based on a format and a generator.
 	public SimpleStringSequence(String formatFieldGenerator generator) {
 		this. = format;
 		this. = generator;

Resets the SimpleStringSequence. After this method is called, the following next() or current call returns the first generated value.
 	public void reset() {

Returns true if the generator has more value to generate (In other words, returns true if next() would return a value rather than throwing an exception.)

true if the iteration has more value.
 	public boolean hasNext() {
 		return .hasNext();

Returns the next generated value.

the next generated value.
java.util.NoSuchElementException if the iteration has no more value.
 	public String next() {
 		if (!hasNext()) {
 			throw new NoSuchElementException(toString() + " ended");
 		 = String.format(.next());
 		return current();

Returns the current sequence value. Implicitly calls next() if next was never called before since creation of last reset().

the current sequence value.
 	public String current() {
 		if ( == null) {
 			return next();
 		return ;
 	public String toString() {
		return "SimpleStringSequence{'" +  + "';" +  + '}';
New to GrepCode? Check out our FAQ X