| Class | Line # | Actions | |||
|---|---|---|---|---|---|
| RBuffer | 13 | 8 | 6 |
| 1 | // | |
| 2 | // This software is now distributed according to | |
| 3 | // the Lesser Gnu Public License. Please see | |
| 4 | // http://www.gnu.org/copyleft/lesser.txt for | |
| 5 | // the details. | |
| 6 | // -- Happy Computing! | |
| 7 | // | |
| 8 | package com.stevesoft.pat; | |
| 9 | ||
| 10 | /** | |
| 11 | * This class is used internally by RegexReader to store blocks of data. | |
| 12 | */ | |
| 13 | class RBuffer | |
| 14 | { | |
| 15 | boolean done = false; | |
| 16 | ||
| 17 | StringBuffer sb; | |
| 18 | ||
| 19 | int pos, epos; | |
| 20 | ||
| 21 | RBuffer next; | |
| 22 | ||
| 23 | 0 | RBuffer() |
| 24 | { | |
| 25 | } | |
| 26 | ||
| 27 | 0 | RBuffer(StringBuffer sb) |
| 28 | { | |
| 29 | 0 | this.sb = sb; |
| 30 | } | |
| 31 | ||
| 32 | 0 | public String toString() |
| 33 | { | |
| 34 | 0 | return "sb=" + sb.toString().replace('\n', ' ') + " pos=" + pos |
| 35 | + " epos=" + epos + " sb.length()=" + sb.length() + "\n" | |
| 36 | + sp(pos + 3) + "^" + sp(epos - pos - 1) + "^"; | |
| 37 | } | |
| 38 | ||
| 39 | 0 | String sp(int n) |
| 40 | { | |
| 41 | 0 | if (n <= 0) |
| 42 | { | |
| 43 | 0 | return ""; |
| 44 | } | |
| 45 | 0 | StringBuffer sb = new StringBuffer(n); |
| 46 | 0 | for (int i = 0; i < n; i++) |
| 47 | { | |
| 48 | 0 | sb.append(' '); |
| 49 | } | |
| 50 | 0 | return sb.toString(); |
| 51 | } | |
| 52 | } |