Mercurial > dive4elements > river
annotate flys-aft/src/main/java/de/intevation/db/SymbolicStatement.java @ 4073:2c70fae83d0c
start syncing at river level.
flys-aft/trunk@3406 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 13 Dec 2011 13:41:43 +0000 |
parents | |
children | dbd0b3b1b8b8 |
rev | line source |
---|---|
4073
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.db; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 import java.util.ArrayList; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import java.util.Map; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 import java.util.HashMap; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 import java.util.regex.Matcher; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import java.util.regex.Pattern; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import java.sql.Connection; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 import java.sql.SQLException; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import java.sql.PreparedStatement; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 import java.sql.Timestamp; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import org.apache.log4j.Logger; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 public class SymbolicStatement { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 private static Logger log = Logger.getLogger(SymbolicStatement.class); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 public static final Pattern VAR = Pattern.compile(":([a-zA-Z0-9_]+)"); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 protected String statement; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 protected String compiled; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 protected Map<String, List<Integer>> positions; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 public class Instance { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 /** TODO: Support more types. */ |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 protected PreparedStatement stmnt; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 public Instance(Connection connection) throws SQLException { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 stmnt = connection.prepareStatement(compiled); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 public void close() { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 try { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 stmnt.close(); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 catch (SQLException sqle) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 log.error("cannot close statement", sqle); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 public void setInt(String key, int value) |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 throws SQLException |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 List<Integer> pos = positions.get(key.toLowerCase()); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 if (pos != null) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 for (Integer p: pos) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 stmnt.setInt(p, value); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 public void setString(String key, String value) |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 throws SQLException |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 List<Integer> pos = positions.get(key.toLowerCase()); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 if (pos != null) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 for (Integer p: pos) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 stmnt.setString(p, value); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 public void setObject(String key, Object value) |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 throws SQLException |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 List<Integer> pos = positions.get(key.toLowerCase()); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 if (pos != null) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 for (Integer p: pos) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 stmnt.setObject(p, value); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 public void setTimestamp(String key, Timestamp value) |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 throws SQLException |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 List<Integer> pos = positions.get(key.toLowerCase()); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 if (pos != null) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 for (Integer p: pos) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 stmnt.setTimestamp(p, value); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 public void setDouble(String key, int value) |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 throws SQLException |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 List<Integer> pos = positions.get(key.toLowerCase()); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 if (pos != null) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 for (Integer p: pos) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 stmnt.setDouble(p, value); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 public void setNull(String key, int sqlType) |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 throws SQLException |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 List<Integer> pos = positions.get(key.toLowerCase()); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 if (pos != null) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 for (Integer p: pos) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 stmnt.setNull(p, sqlType); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 public void set(Map<String, Object> map) throws SQLException { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 for (Map.Entry<String, Object> entry: map.entrySet()) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 setObject(entry.getKey(), entry.getValue()); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 public void clearParameters() throws SQLException { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 stmnt.clearParameters(); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 } // class Instance |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 public SymbolicStatement(String statement) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 this.statement = statement; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 compile(); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 public String getStatement() { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 return statement; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 protected void compile() { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 positions = new HashMap<String, List<Integer>>(); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 StringBuffer sb = new StringBuffer(); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 Matcher m = VAR.matcher(statement); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 int index = 1; |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 while (m.find()) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 String key = m.group(1).toLowerCase(); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
142 List<Integer> list = positions.get(key); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
143 if (list == null) { |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 list = new ArrayList<Integer>(); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
145 positions.put(key, list); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
147 list.add(index++); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
148 m.appendReplacement(sb, "?"); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 m.appendTail(sb); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 compiled = sb.toString(); |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
152 } |
2c70fae83d0c
start syncing at river level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
153 } // class SymbolicStatement |