View Javadoc

1   package net.sf.morph.util;
2   
3   import java.util.StringTokenizer;
4   
5   /**
6    * Same as a regular StringTokenizer, but with a legible {@link #toString()}
7    * method.
8    * 
9    * @author Matt Sgarlata
10   * @since Apr 9, 2007
11   */
12  public class MorphStringTokenizer extends StringTokenizer {
13  	
14  	// have to redeclare these since they are private in the superclass
15  	protected String str;
16  	protected String delim;
17  
18  	public MorphStringTokenizer(String str, String delim, boolean returnDelims) {
19  	    super(str, delim, returnDelims);
20  	    this.str = str;
21  	    this.delim = delim;
22  	}
23  
24  	public MorphStringTokenizer(String str, String delim) {
25  	    super(str, delim);
26  	    this.str = str;
27  	    this.delim = delim;
28      }
29  
30  	public MorphStringTokenizer(String str) {
31  	    super(str);
32  	    this.str = str;
33  	    // copied from implementation of this method in superclass
34  	    this.delim = " \t\n\r\f";
35      }
36  
37  	public String toString() {
38  		return "MorphStringTokenizer[str=\"" + str + "\",delims=\"" + delim + "\"]";
39  	}
40  	
41  }