Mercurial > hg > Members > nobuyasu > TestNeo4j
comparison src/howtouse/CharReader.java @ 17:e30f2714686b draft
fix CharReader.java
author | one |
---|---|
date | Thu, 23 Aug 2012 17:36:46 +0900 |
parents | bf7863a55cd6 |
children | 2c3a10047ec6 |
comparison
equal
deleted
inserted
replaced
16:5c8c554ee3ac | 17:e30f2714686b |
---|---|
10 private int index; | 10 private int index; |
11 | 11 |
12 private final char LBRANK = '['; | 12 private final char LBRANK = '['; |
13 private final char RBRANK = ']'; | 13 private final char RBRANK = ']'; |
14 private final char VERBAR = '|'; | 14 private final char VERBAR = '|'; |
15 private final char COLON= ':'; | |
15 | 16 |
16 private final static int LETTER = 1; | |
17 private final static int[] charKindT = new int[0x10000]; | |
18 static { | |
19 for (int i = 0; i < 'A'; i++) | |
20 charKindT[i] = 0; | |
21 for (int i = 'A'; i <= 'Z'; i++) | |
22 charKindT[i] = LETTER; | |
23 | |
24 } | |
25 | 17 |
26 CharReader() { | 18 CharReader() { |
27 } | 19 } |
28 | 20 |
29 public void setText(String str) { | 21 public void setText(String str) { |
65 case 3: | 57 case 3: |
66 if (ch == RBRANK) { | 58 if (ch == RBRANK) { |
67 nextState = 4; | 59 nextState = 4; |
68 } else if (ch == VERBAR) { | 60 } else if (ch == VERBAR) { |
69 index = buf.length(); | 61 index = buf.length(); |
70 buf.append(ch); | 62 buf.append(ch); |
71 // buf.delete(0,buf.length()); | 63 return buf.substring(0,index); |
64 } else if (ch == COLON) { | |
65 index = 0; | |
66 buf.delete(0,buf.length()); | |
72 } else { | 67 } else { |
73 buf.append(ch); | 68 buf.append(ch); |
74 } | 69 } |
75 break; | 70 break; |
76 case 4: | 71 case 4: |