KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > olap > StringScanner


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/olap/StringScanner.java#5 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 1998-2002 Kana Software, Inc.
7 // Copyright (C) 2001-2005 Julian Hyde and others
8 // All Rights Reserved.
9 // You must accept the terms of that agreement to use this software.
10 //
11 // jhyde, 20 January, 1999
12 */

13
14 package mondrian.olap;
15
16
17 /**
18  * Lexical analyzer whose input is a string.
19  */

20 public class StringScanner extends Scanner {
21     private final String JavaDoc s;
22     private int i;
23
24     public StringScanner(String JavaDoc s, boolean debug) {
25         super(debug);
26         this.s = s;
27         i = 0;
28     }
29
30     // Override Scanner.getChar().
31
protected int getChar() {
32         return (i >= s.length())
33             ? -1
34             : s.charAt(i++);
35     }
36 }
37
38 // End StringScanner.java
39
Popular Tags