home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / util / regexpr / CharPatternInput.class (.txt) next >
Encoding:
Java Class File  |  2000-06-30  |  934 b   |  38 lines

  1. package com.extensibility.util.regexpr;
  2.  
  3. class CharPatternInput implements PatternInput {
  4.    protected String text;
  5.    protected int position;
  6.    protected String nextChar;
  7.    protected boolean escaped;
  8.  
  9.    CharPatternInput(String var1) {
  10.       this.text = var1;
  11.       this.position = 0;
  12.       this.figureNextChar();
  13.    }
  14.  
  15.    protected void figureNextChar() {
  16.       this.escaped = false;
  17.       if (this.position < this.text.length()) {
  18.          this.nextChar = this.text.substring(this.position, this.position + 1);
  19.       }
  20.  
  21.    }
  22.  
  23.    public String peekNext() {
  24.       return this.nextChar;
  25.    }
  26.  
  27.    public String next() {
  28.       String var1 = this.nextChar;
  29.       this.position += this.escaped ? 2 : 1;
  30.       this.figureNextChar();
  31.       return var1;
  32.    }
  33.  
  34.    public boolean hasNext() {
  35.       return this.position < this.text.length();
  36.    }
  37. }
  38.