All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.agimatec.sql.meta.script.RevertableStringTokenizer Maven / Gradle / Ivy

There is a newer version: 2.5.27
Show newest version
package com.agimatec.sql.meta.script;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.StringTokenizer;

/**
 * Description: 
* User: roman.stumm
* Date: 17.12.2007
* Time: 15:20:37
* Copyright: Agimatec GmbH */ public class RevertableStringTokenizer implements Enumeration { private List tokens = new ArrayList(); private final StringTokenizer original; int position = -1; public RevertableStringTokenizer(StringTokenizer original) { this.original = original; } public boolean hasMoreElements() { return original.hasMoreElements(); } public Object nextElement() { return nextToken(); } public String nextToken() { if (position < 0 || position >= tokens.size()) { position = -1; String next = original.nextToken(); tokens.add(next); return next; } else { return tokens.get(position++); } } public boolean hasMoreTokens() { return !(position < 0 || position >= tokens.size()) || original.hasMoreTokens(); } public int getPosition() { if (position < 0 || position >= tokens.size()) { return tokens.size(); } else { return position; } } public void setPosition(int index) { position = index; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy