v4: Clean up impl with generic List<T> field

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9338]
This commit is contained in:
sharwell 2011-11-17 16:48:30 -08:00
parent 421a261ddb
commit f9396907bd
1 changed files with 5 additions and 5 deletions

View File

@ -58,7 +58,7 @@ public class ANTLRStringStream implements CharStream {
* move through the input stream. Indexed from 1..markDepth.
* A null is kept @ index 0. Create upon first call to mark().
*/
protected List markers;
protected List<CharStreamState> markers;
/** Track the last mark() call result value for use in rewind(). */
protected int lastMarker;
@ -149,17 +149,17 @@ public class ANTLRStringStream implements CharStream {
public int mark() {
if ( markers==null ) {
markers = new ArrayList();
markers = new ArrayList<CharStreamState>();
markers.add(null); // depth 0
}
markDepth++;
CharStreamState state = null;
CharStreamState state;
if ( markDepth>=markers.size() ) {
state = new CharStreamState();
markers.add(state);
}
else {
state = (CharStreamState)markers.get(markDepth);
state = markers.get(markDepth);
}
state.p = p;
state.line = line;
@ -169,7 +169,7 @@ public class ANTLRStringStream implements CharStream {
}
public void rewind(int m) {
CharStreamState state = (CharStreamState)markers.get(m);
CharStreamState state = markers.get(m);
// restore stream state
seek(state.p);
line = state.line;