Revision 26245 trunk/libraries/libGeocoding/src/org/gvsig/normalization/operations/AbstractNormalization.java
AbstractNormalization.java | ||
---|---|---|
59 | 59 |
ChangeListener { |
60 | 60 |
|
61 | 61 |
@SuppressWarnings("unchecked") |
62 |
private List listeners = new ArrayList(); |
|
63 |
|
|
64 |
// ATTRIBUTES |
|
65 |
protected NormAlgorithm nAlgorithm; |
|
66 |
|
|
67 |
// Pattern |
|
62 |
private List listeners = new ArrayList(); |
|
63 |
protected NormAlgorithm nAlgorithm; |
|
68 | 64 |
protected Patternnormalization pattern; |
69 |
|
|
70 | 65 |
protected String[] nameNewFields; |
71 | 66 |
protected int[] posNameNewFields; |
72 | 67 |
|
... | ... | |
110 | 105 |
* @throws ParseException |
111 | 106 |
*/ |
112 | 107 |
public Value formatDates(String date, String pattern) throws ParseException { |
108 |
|
|
113 | 109 |
Value result = ValueFactory.createNullValue(); |
114 |
|
|
115 |
Date fecha = null; |
|
116 |
|
|
117 | 110 |
SimpleDateFormat sdf = new SimpleDateFormat(pattern); |
118 |
fecha = sdf.parse(date); |
|
111 |
Date fecha = sdf.parse(date);
|
|
119 | 112 |
result = ValueFactory.createValue(fecha); |
120 |
|
|
121 | 113 |
return result; |
122 | 114 |
} |
123 | 115 |
|
... | ... | |
155 | 147 |
* @return number of imported fields |
156 | 148 |
*/ |
157 | 149 |
public int numNewImportedFields() { |
150 |
|
|
158 | 151 |
int contImported = 0; |
159 | 152 |
int contTotal = this.pattern.getElements().size(); |
160 |
|
|
153 |
|
|
161 | 154 |
for (int i = 0; i < contTotal; i++) { |
162 | 155 |
if (((Element) this.pattern.getElements().get(i)).getImportfield()) { |
163 | 156 |
contImported++; |
... | ... | |
188 | 181 |
} |
189 | 182 |
|
190 | 183 |
/** |
191 |
* Renove all listeners
|
|
184 |
* Remove all listeners
|
|
192 | 185 |
*/ |
193 | 186 |
public void removeAllListeners() { |
194 | 187 |
this.nAlgorithm.removeAllListeners(); |
... | ... | |
196 | 189 |
} |
197 | 190 |
|
198 | 191 |
/** |
199 |
* |
|
192 |
* Update the list listeners
|
|
200 | 193 |
* @param evt |
201 | 194 |
*/ |
202 | 195 |
public void update(ChangeEvent evt) { |
... | ... | |
237 | 230 |
*/ |
238 | 231 |
@SuppressWarnings("unchecked") |
239 | 232 |
protected void loadNamesNewFields() { |
233 |
|
|
240 | 234 |
int co = pattern.getElements().size(); |
241 |
ArrayList eles = new ArrayList(); |
|
235 |
ArrayList elems = new ArrayList();
|
|
242 | 236 |
ArrayList pos = new ArrayList(); |
243 | 237 |
for (int i = 0; i < co; i++) { |
244 |
Element ade = (Element) pattern.getElements().get(i);
|
|
245 |
if (ade.getImportfield()) {
|
|
246 |
eles.add(ade.getFieldname());
|
|
238 |
Element elem = (Element) pattern.getElements().get(i);
|
|
239 |
if (elem.getImportfield()) {
|
|
240 |
elems.add(elem.getFieldname());
|
|
247 | 241 |
pos.add(new Integer(i)); |
248 | 242 |
} |
249 | 243 |
} |
250 |
int cou = eles.size(); |
|
244 |
int cou = elems.size();
|
|
251 | 245 |
|
252 | 246 |
nameNewFields = new String[cou]; |
253 | 247 |
posNameNewFields = new int[cou]; |
254 | 248 |
String aux; |
255 | 249 |
int auxint; |
256 | 250 |
for (int i = 0; i < cou; i++) { |
257 |
aux = (String) eles.get(i); |
|
251 |
aux = (String) elems.get(i);
|
|
258 | 252 |
auxint = ((Integer) pos.get(i)).intValue(); |
259 | 253 |
nameNewFields[i] = aux; |
260 | 254 |
posNameNewFields[i] = auxint; |
... | ... | |
318 | 312 |
return fd; |
319 | 313 |
} |
320 | 314 |
|
315 |
/** |
|
316 |
* Create a new value |
|
317 |
* @param row |
|
318 |
* @param tipoCampo |
|
319 |
* @param posi |
|
320 |
* @param cadena |
|
321 |
* @return |
|
322 |
*/ |
|
321 | 323 |
protected Value createValue(int row, int tipoCampo, int posi, String cadena) { |
322 | 324 |
Value val = ValueFactory.createNullValue(); |
323 | 325 |
// DATE |
Also available in: Unified diff