Revision 29125
branches/v2_0_0_prep/libraries/libGeocoding/src/org/gvsig/normalization/pattern/Fieldseparator.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Prodevelop S.L. main development |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.normalization.pattern; |
|
29 |
|
|
30 |
import org.gvsig.tools.storage.IStorable; |
|
31 |
import org.gvsig.tools.storage.IStorage; |
|
32 |
import org.htmlparser.util.Translate; |
|
33 |
|
|
34 |
/** |
|
35 |
* |
|
36 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a> |
|
37 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a> |
|
38 |
* |
|
39 |
*/ |
|
40 |
|
|
41 |
/** |
|
42 |
* Class Fieldseparator. |
|
43 |
* |
|
44 |
* This class has the separators between two fields and they are necessary for |
|
45 |
* the split string process |
|
46 |
*/ |
|
47 |
public class Fieldseparator implements IStorable { |
|
48 |
|
|
49 |
/** |
|
50 |
* Split string by tab |
|
51 |
*/ |
|
52 |
private boolean _tabsep; |
|
53 |
|
|
54 |
/** |
|
55 |
* Split string by one space |
|
56 |
*/ |
|
57 |
private boolean _spacesep; |
|
58 |
|
|
59 |
/** |
|
60 |
* Split string by colon |
|
61 |
*/ |
|
62 |
private boolean _colonsep; |
|
63 |
|
|
64 |
/** |
|
65 |
* Split string by semicolon |
|
66 |
*/ |
|
67 |
private boolean _semicolonsep; |
|
68 |
|
|
69 |
/** |
|
70 |
* Other characters to split strings |
|
71 |
*/ |
|
72 |
private String _othersep; |
|
73 |
|
|
74 |
/** |
|
75 |
* Take consecutive separators like one |
|
76 |
*/ |
|
77 |
private boolean _joinsep; |
|
78 |
|
|
79 |
/** |
|
80 |
* Constructor |
|
81 |
*/ |
|
82 |
public Fieldseparator() { |
|
83 |
super(); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* Returns the value of field 'colonsep'. |
|
88 |
* |
|
89 |
* @return the value of field 'colonsep'. |
|
90 |
*/ |
|
91 |
public boolean getColonsep() { |
|
92 |
return this._colonsep; |
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* Returns the value of field 'joinsep'. |
|
97 |
* |
|
98 |
* @return the value of field 'joinsep'. |
|
99 |
*/ |
|
100 |
public boolean getJoinsep() { |
|
101 |
return this._joinsep; |
|
102 |
} |
|
103 |
|
|
104 |
/** |
|
105 |
* Returns the value of field 'othersep'. |
|
106 |
* |
|
107 |
* @return the value of field 'othersep'. |
|
108 |
*/ |
|
109 |
public java.lang.String getOthersep() { |
|
110 |
return this._othersep; |
|
111 |
} |
|
112 |
|
|
113 |
/** |
|
114 |
* Returns the value of field 'semicolonsep'. |
|
115 |
* |
|
116 |
* @return the value of field 'semicolonsep'. |
|
117 |
*/ |
|
118 |
public boolean getSemicolonsep() { |
|
119 |
return this._semicolonsep; |
|
120 |
} |
|
121 |
|
|
122 |
/** |
|
123 |
* Returns the value of field 'spacesep'. |
|
124 |
* |
|
125 |
* @return the value of field 'spacesep'. |
|
126 |
*/ |
|
127 |
public boolean getSpacesep() { |
|
128 |
return this._spacesep; |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* Returns the value of field 'tabsep'. |
|
133 |
* |
|
134 |
* @return the value of field 'tabsep'. |
|
135 |
*/ |
|
136 |
public boolean getTabsep() { |
|
137 |
return this._tabsep; |
|
138 |
} |
|
139 |
|
|
140 |
/** |
|
141 |
* Sets the value of field 'colonsep'. |
|
142 |
* |
|
143 |
* @param colonsep |
|
144 |
* the value of field 'colonsep'. |
|
145 |
*/ |
|
146 |
public void setColonsep(boolean colonsep) { |
|
147 |
this._colonsep = colonsep; |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* Sets the value of field 'joinsep'. |
|
152 |
* |
|
153 |
* @param joinsep |
|
154 |
* the value of field 'joinsep'. |
|
155 |
*/ |
|
156 |
public void setJoinsep(boolean joinsep) { |
|
157 |
this._joinsep = joinsep; |
|
158 |
} |
|
159 |
|
|
160 |
/** |
|
161 |
* Sets the value of field 'othersep'. |
|
162 |
* |
|
163 |
* @param othersep |
|
164 |
* the value of field 'othersep'. |
|
165 |
*/ |
|
166 |
public void setOthersep(java.lang.String othersep) { |
|
167 |
this._othersep = othersep; |
|
168 |
} |
|
169 |
|
|
170 |
/** |
|
171 |
* Sets the value of field 'semicolonsep'. |
|
172 |
* |
|
173 |
* @param semicolonsep |
|
174 |
* the value of field 'semicolonsep'. |
|
175 |
*/ |
|
176 |
public void setSemicolonsep(boolean semicolonsep) { |
|
177 |
this._semicolonsep = semicolonsep; |
|
178 |
} |
|
179 |
|
|
180 |
/** |
|
181 |
* Sets the value of field 'spacesep'. |
|
182 |
* |
|
183 |
* @param spacesep |
|
184 |
* the value of field 'spacesep'. |
|
185 |
*/ |
|
186 |
public void setSpacesep(boolean spacesep) { |
|
187 |
this._spacesep = spacesep; |
|
188 |
} |
|
189 |
|
|
190 |
/** |
|
191 |
* Sets the value of field 'tabsep'. |
|
192 |
* |
|
193 |
* @param tabsep |
|
194 |
* the value of field 'tabsep'. |
|
195 |
*/ |
|
196 |
public void setTabsep(boolean tabsep) { |
|
197 |
this._tabsep = tabsep; |
|
198 |
} |
|
199 |
|
|
200 |
/** |
|
201 |
* This method serializes the fieldseparator object |
|
202 |
* |
|
203 |
* @param state |
|
204 |
*/ |
|
205 |
public void getstate(IStorage state) { |
|
206 |
state.setTheClass(this); |
|
207 |
state.put("tabsep", this._tabsep ? "true" : "false"); |
|
208 |
state.put("spacesep", this._spacesep ? "true" : "false"); |
|
209 |
state.put("colonsep", this._colonsep ? "true" : "false"); |
|
210 |
state.put("semicolonsep", this._semicolonsep ? "true" : "false"); |
|
211 |
String ot = (String) this._othersep; |
|
212 |
if(ot != null){ |
|
213 |
String oth = Translate.encode(ot); |
|
214 |
state.put("othersep", oth); |
|
215 |
}else{ |
|
216 |
state.put("othersep", ""); |
|
217 |
} |
|
218 |
|
|
219 |
state.put("joinsep", this._joinsep ? "true" : "false"); |
|
220 |
|
|
221 |
} |
|
222 |
|
|
223 |
/** |
|
224 |
* This method parses the fieldseparator object |
|
225 |
* |
|
226 |
* @param state |
|
227 |
*/ |
|
228 |
public void setstate(IStorage state) { |
|
229 |
this._tabsep = ((String) state.get("tabsep")).compareTo("true") == 0 ? true |
|
230 |
: false; |
|
231 |
this._spacesep = ((String) state.get("spacesep")).compareTo("true") == 0 ? true |
|
232 |
: false; |
|
233 |
this._colonsep = ((String) state.get("colonsep")).compareTo("true") == 0 ? true |
|
234 |
: false; |
|
235 |
this._semicolonsep = ((String) state.get("semicolonsep")) |
|
236 |
.compareTo("true") == 0 ? true : false; |
|
237 |
this._othersep = null; |
|
238 |
String ot = (String) state.get("othersep"); |
|
239 |
if (ot != null) { |
|
240 |
String oth = Translate.decode(ot); |
|
241 |
this._othersep = oth; |
|
242 |
} |
|
243 |
|
|
244 |
this._joinsep = ((String) state.get("joinsep")).compareTo("true") == 0 ? true |
|
245 |
: false; |
|
246 |
} |
|
247 |
} |
branches/v2_0_0_prep/libraries/libGeocoding/src/org/gvsig/normalization/pattern/Patternnormalization.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Prodevelop S.L. main development |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.normalization.pattern; |
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a> |
|
33 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a> |
|
34 |
* |
|
35 |
*/ |
|
36 |
|
|
37 |
import java.util.ArrayList; |
|
38 |
import java.util.List; |
|
39 |
|
|
40 |
|
|
41 |
/** |
|
42 |
* Class Patternnormalization. |
|
43 |
* |
|
44 |
* This class is the normalization pattern. This pattern has your name |
|
45 |
* (_patternname), your xml file path (_patternurl), the attribute |
|
46 |
* (_nofirstrows) that says the number of the rows in the text file that will |
|
47 |
* not be normalized and the list of elements (_elements) that make the pattern |
|
48 |
*/ |
|
49 |
public class Patternnormalization implements Persistent { |
|
50 |
|
|
51 |
/** |
|
52 |
* Pattern name |
|
53 |
*/ |
|
54 |
private String _patternname; |
|
55 |
|
|
56 |
|
|
57 |
/** |
|
58 |
* number of file rows that they will not be normalized |
|
59 |
*/ |
|
60 |
private int _nofirstrows; |
|
61 |
|
|
62 |
/** |
|
63 |
* List of elements. Each element is one new field. One element has |
|
64 |
* attributes that they define the new field and split strings process. |
|
65 |
*/ |
|
66 |
private List _elements; |
|
67 |
|
|
68 |
/** |
|
69 |
* Constructor |
|
70 |
*/ |
|
71 |
public Patternnormalization() { |
|
72 |
super(); |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* Returns the value of field 'elements'. |
|
77 |
* |
|
78 |
* @return the value of field 'elements'. |
|
79 |
*/ |
|
80 |
|
|
81 |
public List getElements() { |
|
82 |
return this._elements; |
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* Returns the value of field 'elements'. |
|
87 |
* |
|
88 |
* @return the value of field 'elements'. |
|
89 |
*/ |
|
90 |
public Element[] getArrayElements() { |
|
91 |
Element[] eles = new Element[this._elements.size()]; |
|
92 |
for (int i = 0; i < this._elements.size(); i++) { |
|
93 |
eles[i] = (Element) this._elements.get(i); |
|
94 |
} |
|
95 |
return eles; |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* Returns the value of field 'nofirstrows'. |
|
100 |
* |
|
101 |
* @return the value of field 'nofirstrows'. |
|
102 |
*/ |
|
103 |
public int getNofirstrows() { |
|
104 |
return this._nofirstrows; |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* Returns the value of field 'patternname'. |
|
109 |
* |
|
110 |
* @return the value of field 'patternname'. |
|
111 |
*/ |
|
112 |
public java.lang.String getPatternname() { |
|
113 |
return this._patternname; |
|
114 |
} |
|
115 |
|
|
116 |
|
|
117 |
/** |
|
118 |
* Sets the value of field 'elements'. |
|
119 |
* |
|
120 |
* @param elements |
|
121 |
* the value of field 'elements'. |
|
122 |
*/ |
|
123 |
|
|
124 |
public void setElements(List elements) { |
|
125 |
this._elements = elements; |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* Sets the value of field 'nofirstrows'. |
|
130 |
* |
|
131 |
* @param nofirstrows |
|
132 |
* the value of field 'nofirstrows'. |
|
133 |
*/ |
|
134 |
public void setNofirstrows(int nofirstrows) { |
|
135 |
this._nofirstrows = nofirstrows; |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* Sets the value of field 'patternname'. |
|
140 |
* |
|
141 |
* @param patternname |
|
142 |
* the value of field 'patternname'. |
|
143 |
*/ |
|
144 |
public void setPatternname(String patternname) { |
|
145 |
this._patternname = patternname; |
|
146 |
} |
|
147 |
|
|
148 |
/** |
|
149 |
* This method serializes the pattern object |
|
150 |
* |
|
151 |
* @param state |
|
152 |
*/ |
|
153 |
public void getstate(IStorage state) { |
|
154 |
state.setName("patternnormalization"); |
|
155 |
state.setTheClass(this); |
|
156 |
state.put("patternname", this._patternname); |
|
157 |
state.put("nofirstrows", this._nofirstrows); |
|
158 |
state.put("elements", "element", this._elements); |
|
159 |
} |
|
160 |
|
|
161 |
/** |
|
162 |
* This method parses the pattern object |
|
163 |
* |
|
164 |
* @param state |
|
165 |
*/ |
|
166 |
public void setstate(IStorage state) { |
|
167 |
this._patternname = ((String) state.get("patternname")).trim(); |
|
168 |
this._nofirstrows = state.getInt("nofirstrows"); |
|
169 |
try { |
|
170 |
StorageCollection sto = (StorageCollection) state |
|
171 |
.getObject("elements"); |
|
172 |
this._elements = new ArrayList(); |
|
173 |
for (int i = 0; i < sto.size(); i++) { |
|
174 |
Element elem = (Element) sto.get(i); |
|
175 |
this._elements.add(elem); |
|
176 |
} |
|
177 |
} catch (Exception e) { |
|
178 |
log.error("parsing pattern", e); |
|
179 |
} |
|
180 |
} |
|
181 |
|
|
182 |
} |
branches/v2_0_0_prep/libraries/libGeocoding/src/org/gvsig/normalization/pattern/Fieldtype.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Prodevelop S.L. main development |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.normalization.pattern; |
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a> |
|
33 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a> |
|
34 |
* |
|
35 |
*/ |
|
36 |
|
|
37 |
import org.apache.log4j.Logger; |
|
38 |
import org.gvsig.tools.storage.IStorable; |
|
39 |
import org.gvsig.tools.storage.IStorage; |
|
40 |
|
|
41 |
/** |
|
42 |
* Class Fieldtype. |
|
43 |
* |
|
44 |
* This class defines the type of the one new field |
|
45 |
*/ |
|
46 |
public class Fieldtype implements IStorable { |
|
47 |
|
|
48 |
private static final Logger log = Logger |
|
49 |
.getLogger(Fieldtype.class); |
|
50 |
|
|
51 |
/** |
|
52 |
* new field of type String |
|
53 |
*/ |
|
54 |
private Stringvalue _stringvalue; |
|
55 |
|
|
56 |
/** |
|
57 |
* new field of type Date |
|
58 |
*/ |
|
59 |
private Datevalue _datevalue; |
|
60 |
|
|
61 |
/** |
|
62 |
* new field of type Decimal |
|
63 |
*/ |
|
64 |
private Decimalvalue _decimalvalue; |
|
65 |
|
|
66 |
/** |
|
67 |
* new field of type Integer |
|
68 |
*/ |
|
69 |
private Integervalue _integervalue; |
|
70 |
|
|
71 |
/** |
|
72 |
* Constructor |
|
73 |
*/ |
|
74 |
public Fieldtype() { |
|
75 |
super(); |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* Returns the value of field 'datevalue'. |
|
80 |
* |
|
81 |
* @return the value of field 'datevalue'. |
|
82 |
*/ |
|
83 |
public Datevalue getDatevalue() { |
|
84 |
return this._datevalue; |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* Returns the value of field 'decimalvalue'. |
|
89 |
* |
|
90 |
* @return the value of field 'decimalvalue'. |
|
91 |
*/ |
|
92 |
public Decimalvalue getDecimalvalue() { |
|
93 |
return this._decimalvalue; |
|
94 |
} |
|
95 |
|
|
96 |
/** |
|
97 |
* Returns the value of field 'integervalue'. |
|
98 |
* |
|
99 |
* @return the value of field 'integervalue'. |
|
100 |
*/ |
|
101 |
public Integervalue getIntegervalue() { |
|
102 |
return this._integervalue; |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* Returns the value of field 'stringvalue'. |
|
107 |
* |
|
108 |
* @return the value of field 'stringvalue'. |
|
109 |
*/ |
|
110 |
public Stringvalue getStringvalue() { |
|
111 |
return this._stringvalue; |
|
112 |
} |
|
113 |
|
|
114 |
/** |
|
115 |
* Sets the value of field 'datevalue'. |
|
116 |
* |
|
117 |
* @param datevalue |
|
118 |
* the value of field 'datevalue'. |
|
119 |
*/ |
|
120 |
public void setDatevalue(Datevalue datevalue) { |
|
121 |
this._datevalue = datevalue; |
|
122 |
} |
|
123 |
|
|
124 |
/** |
|
125 |
* Sets the value of field 'decimalvalue'. |
|
126 |
* |
|
127 |
* @param decimalvalue |
|
128 |
* the value of field 'decimalvalue'. |
|
129 |
*/ |
|
130 |
public void setDecimalvalue(Decimalvalue decimalvalue) { |
|
131 |
this._decimalvalue = decimalvalue; |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* Sets the value of field 'integervalue'. |
|
136 |
* |
|
137 |
* @param integervalue |
|
138 |
* the value of field 'integervalue'. |
|
139 |
*/ |
|
140 |
public void setIntegervalue(Integervalue integervalue) { |
|
141 |
this._integervalue = integervalue; |
|
142 |
} |
|
143 |
|
|
144 |
/** |
|
145 |
* Sets the value of field 'stringvalue'. |
|
146 |
* |
|
147 |
* @param stringvalue |
|
148 |
* the value of field 'stringvalue'. |
|
149 |
*/ |
|
150 |
public void setStringvalue(Stringvalue stringvalue) { |
|
151 |
this._stringvalue = stringvalue; |
|
152 |
} |
|
153 |
|
|
154 |
/** |
|
155 |
* This method serializes the fieldtype object |
|
156 |
* |
|
157 |
* @param state |
|
158 |
*/ |
|
159 |
public void getstate(IStorage state) { |
|
160 |
state.setTheClass(this); |
|
161 |
if (this._stringvalue != null) { |
|
162 |
state.put("stringvalue", this._stringvalue); |
|
163 |
} else if (this._datevalue != null) { |
|
164 |
state.put("datevalue", this._datevalue); |
|
165 |
} else if (this._decimalvalue != null) { |
|
166 |
state.put("decimalvalue", this._decimalvalue); |
|
167 |
} else { |
|
168 |
state.put("integervalue", this._integervalue); |
|
169 |
} |
|
170 |
} |
|
171 |
|
|
172 |
/** |
|
173 |
* This method parses the fieldtype object |
|
174 |
* |
|
175 |
* @param state |
|
176 |
*/ |
|
177 |
public void setstate(IStorage state) { |
|
178 |
try { |
|
179 |
if (state.getObject("stringvalue") != null) { |
|
180 |
this._stringvalue = (Stringvalue) state |
|
181 |
.getObject("stringvalue"); |
|
182 |
} else if (state.getObject("datevalue") != null) { |
|
183 |
this._datevalue = (Datevalue) state.getObject("datevalue"); |
|
184 |
} else if (state.getObject("decimalvalue") != null) { |
|
185 |
this._decimalvalue = (Decimalvalue) state |
|
186 |
.getObject("decimalvalue"); |
|
187 |
} else { |
|
188 |
this._integervalue = (Integervalue) state |
|
189 |
.getObject("integervalue"); |
|
190 |
} |
|
191 |
} catch (Exception e) { |
|
192 |
log.error("Error parsing the object",e); |
|
193 |
} |
|
194 |
} |
|
195 |
|
|
196 |
} |
branches/v2_0_0_prep/libraries/libGeocoding/src/org/gvsig/normalization/pattern/Element.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Prodevelop S.L. main development |
|
26 |
*/ |
|
27 |
package org.gvsig.normalization.pattern; |
|
28 |
|
|
29 |
/** |
|
30 |
* |
|
31 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a> |
|
32 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a> |
|
33 |
* |
|
34 |
*/ |
|
35 |
|
|
36 |
import org.apache.log4j.Logger; |
|
37 |
import org.gvsig.tools.storage.IStorable; |
|
38 |
import org.gvsig.tools.storage.IStorage; |
|
39 |
|
|
40 |
/** |
|
41 |
* Class Element. |
|
42 |
* |
|
43 |
* This class are the all elements that they make the pattern. Each element |
|
44 |
* defines one new field in final table. The attributes of each element are: - |
|
45 |
* (_fieldname) Name of the new field - (_fieldtype) Type of the new field |
|
46 |
* (String, Integer, Decimal or Date) - (_fieldwith) Number of position to split |
|
47 |
* the main string. If this value is zero the split process will be via |
|
48 |
* separators - (_fieldseparator) separators between fields - |
|
49 |
* (infieldseparators) special characters within one substring (thousand |
|
50 |
* character, decimal character, text characters) - (_importfield) this boolean |
|
51 |
* defines if this new field will be normalized |
|
52 |
*/ |
|
53 |
public class Element implements IStorable { |
|
54 |
|
|
55 |
Logger log = Logger.getLogger(Element.class); |
|
56 |
|
|
57 |
/** |
|
58 |
* Name of the new field |
|
59 |
*/ |
|
60 |
private String _fieldname; |
|
61 |
|
|
62 |
/** |
|
63 |
* Type of the field in the new table |
|
64 |
*/ |
|
65 |
private Fieldtype _fieldtype; |
|
66 |
|
|
67 |
/** |
|
68 |
* number of positions to split the main string |
|
69 |
*/ |
|
70 |
private int _fieldwidth; |
|
71 |
|
|
72 |
/** |
|
73 |
* separators (characters) to split the main string |
|
74 |
*/ |
|
75 |
private Fieldseparator _fieldseparator; |
|
76 |
|
|
77 |
/** |
|
78 |
* characters of thousands, decimals and text |
|
79 |
*/ |
|
80 |
private Infieldseparators _infieldseparators; |
|
81 |
|
|
82 |
/** |
|
83 |
* this value says if the new field will be normalized and it will insert in |
|
84 |
* the final table |
|
85 |
*/ |
|
86 |
private boolean _importfield; |
|
87 |
|
|
88 |
/** |
|
89 |
* Constructor |
|
90 |
*/ |
|
91 |
public Element() { |
|
92 |
super(); |
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* Returns the value of field 'fieldname'. |
|
97 |
* |
|
98 |
* @return the value of field 'fieldname'. |
|
99 |
*/ |
|
100 |
public String getFieldname() { |
|
101 |
return this._fieldname; |
|
102 |
} |
|
103 |
|
|
104 |
/** |
|
105 |
* Returns the value of field 'fieldseparator'. |
|
106 |
* |
|
107 |
* @return the value of field 'fieldseparator'. |
|
108 |
*/ |
|
109 |
public Fieldseparator getFieldseparator() { |
|
110 |
return this._fieldseparator; |
|
111 |
} |
|
112 |
|
|
113 |
/** |
|
114 |
* Returns the value of field 'fieldtype'. |
|
115 |
* |
|
116 |
* @return the value of field 'fieldtype'. |
|
117 |
*/ |
|
118 |
public Fieldtype getFieldtype() { |
|
119 |
return this._fieldtype; |
|
120 |
} |
|
121 |
|
|
122 |
/** |
|
123 |
* Returns the value of field 'fieldwidth'. |
|
124 |
* |
|
125 |
* @return the value of field 'fieldwidth'. |
|
126 |
*/ |
|
127 |
public int getFieldwidth() { |
|
128 |
return this._fieldwidth; |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* Returns the value of field 'importfield'. |
|
133 |
* |
|
134 |
* @return the value of field 'importfield'. |
|
135 |
*/ |
|
136 |
public boolean getImportfield() { |
|
137 |
return this._importfield; |
|
138 |
} |
|
139 |
|
|
140 |
/** |
|
141 |
* Returns the value of field 'infieldseparators'. |
|
142 |
* |
|
143 |
* @return the value of field 'infieldseparators'. |
|
144 |
*/ |
|
145 |
public Infieldseparators getInfieldseparators() { |
|
146 |
return this._infieldseparators; |
|
147 |
} |
|
148 |
|
|
149 |
/** |
|
150 |
* Sets the value of field 'fieldname'. |
|
151 |
* |
|
152 |
* @param fieldname |
|
153 |
* the value of field 'fieldname'. |
|
154 |
*/ |
|
155 |
public void setFieldname(String fieldname) { |
|
156 |
this._fieldname = fieldname; |
|
157 |
} |
|
158 |
|
|
159 |
/** |
|
160 |
* Sets the value of field 'fieldseparator'. |
|
161 |
* |
|
162 |
* @param fieldseparator |
|
163 |
* the value of field 'fieldseparator'. |
|
164 |
*/ |
|
165 |
public void setFieldseparator(Fieldseparator fieldseparator) { |
|
166 |
this._fieldseparator = fieldseparator; |
|
167 |
} |
|
168 |
|
|
169 |
/** |
|
170 |
* Sets the value of field 'fieldtype'. |
|
171 |
* |
|
172 |
* @param fieldtype |
|
173 |
* the value of field 'fieldtype'. |
|
174 |
*/ |
|
175 |
public void setFieldtype(Fieldtype fieldtype) { |
|
176 |
this._fieldtype = fieldtype; |
|
177 |
} |
|
178 |
|
|
179 |
/** |
|
180 |
* Sets the value of field 'fieldwidth'. |
|
181 |
* |
|
182 |
* @param fieldwidth |
|
183 |
* the value of field 'fieldwidth'. |
|
184 |
*/ |
|
185 |
public void setFieldwidth(int fieldwidth) { |
|
186 |
this._fieldwidth = fieldwidth; |
|
187 |
} |
|
188 |
|
|
189 |
/** |
|
190 |
* Sets the value of field 'importfield'. |
|
191 |
* |
|
192 |
* @param importfield |
|
193 |
* the value of field 'importfield'. |
|
194 |
*/ |
|
195 |
public void setImportfield(boolean importfield) { |
|
196 |
this._importfield = importfield; |
|
197 |
} |
|
198 |
|
|
199 |
/** |
|
200 |
* Sets the value of field 'infieldseparators'. |
|
201 |
* |
|
202 |
* @param infieldseparators |
|
203 |
* the value of field 'infieldseparators'. |
|
204 |
*/ |
|
205 |
public void setInfieldseparators(Infieldseparators infieldseparators) { |
|
206 |
this._infieldseparators = infieldseparators; |
|
207 |
} |
|
208 |
|
|
209 |
/** |
|
210 |
* This method serializes the element object |
|
211 |
* |
|
212 |
* @param state |
|
213 |
*/ |
|
214 |
public void getstate(IStorage state) { |
|
215 |
state.setName("element"); |
|
216 |
state.setTheClass(this); |
|
217 |
state.put("fieldname", this._fieldname); |
|
218 |
state.put("fieldtype", this._fieldtype); |
|
219 |
state.put("fieldwidth", this._fieldwidth); |
|
220 |
state.put("fieldseparator", this._fieldseparator); |
|
221 |
state.put("infieldseparators", this._infieldseparators); |
|
222 |
state.put("importfield", this._importfield ? "true" : "false"); |
|
223 |
} |
|
224 |
|
|
225 |
/** |
|
226 |
* This method parses the element object |
|
227 |
* |
|
228 |
* @param state |
|
229 |
*/ |
|
230 |
public void setstate(IStorage state) { |
|
231 |
this._fieldname = (String) state.get("fieldname"); |
|
232 |
this._fieldwidth = (int) state.getInt("fieldwidth"); |
|
233 |
this._importfield = ((String) state.get("importfield")) |
|
234 |
.compareTo("true") == 0 ? true : false; |
|
235 |
try { |
|
236 |
this._fieldtype = (Fieldtype) state.getObject("fieldtype"); |
|
237 |
this._fieldseparator = (Fieldseparator) state |
|
238 |
.getObject("fieldseparator"); |
|
239 |
this._infieldseparators = (Infieldseparators) state |
|
240 |
.getObject("infieldseparators"); |
|
241 |
} catch (Exception e) { |
|
242 |
log.error("Error parsing the object", e); |
|
243 |
} |
|
244 |
} |
|
245 |
/** |
|
246 |
* toString |
|
247 |
*/ |
|
248 |
public String toString(){ |
|
249 |
return this.getFieldname(); |
|
250 |
|
|
251 |
} |
|
252 |
|
|
253 |
} |
branches/v2_0_0_prep/libraries/libGeocoding/src/org/gvsig/normalization/pattern/Datevalue.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Prodevelop S.L. main development |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.normalization.pattern; |
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a> |
|
33 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a> |
|
34 |
* |
|
35 |
*/ |
|
36 |
|
|
37 |
/** |
|
38 |
* Class Datevalue. |
|
39 |
* |
|
40 |
* This class defines the new field type like Date |
|
41 |
*/ |
|
42 |
public class Datevalue implements Persistent { |
|
43 |
|
|
44 |
/** |
|
45 |
* format of the date |
|
46 |
*/ |
|
47 |
private String _datevalueformat; |
|
48 |
|
|
49 |
/** |
|
50 |
* Constructor |
|
51 |
*/ |
|
52 |
public Datevalue() { |
|
53 |
super(); |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* Returns the value of field 'datevalueformat'. |
|
58 |
* |
|
59 |
* @return the value of field 'datevalueformat'. |
|
60 |
*/ |
|
61 |
public String getDatevalueformat() { |
|
62 |
return this._datevalueformat; |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Sets the value of field 'datevalueformat'. |
|
67 |
* |
|
68 |
* @param datevalueformat |
|
69 |
* the value of field 'datevalueformat'. |
|
70 |
*/ |
|
71 |
public void setDatevalueformat(java.lang.String datevalueformat) { |
|
72 |
this._datevalueformat = datevalueformat; |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* This method serializes the datevalue object |
|
77 |
* |
|
78 |
* @param state |
|
79 |
*/ |
|
80 |
public void getstate(IStorage state) { |
|
81 |
state.setTheClass(this); |
|
82 |
state.put("datevalueformat", this._datevalueformat); |
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* This method parses the datevalue object |
|
87 |
* |
|
88 |
* @param state |
|
89 |
*/ |
|
90 |
public void setstate(IStorage state) { |
|
91 |
this._datevalueformat = (String) state.get("datevalueformat"); |
|
92 |
} |
|
93 |
|
|
94 |
} |
branches/v2_0_0_prep/libraries/libGeocoding/src/org/gvsig/normalization/pattern/Integervalue.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Prodevelop S.L. main development |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.normalization.pattern; |
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a> |
|
33 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a> |
|
34 |
* |
|
35 |
*/ |
|
36 |
|
|
37 |
import org.gvsig.tools.storage.IStorable; |
|
38 |
import org.gvsig.tools.storage.IStorage; |
|
39 |
|
|
40 |
/** |
|
41 |
* Class Integervalue. |
|
42 |
* |
|
43 |
* This class defines the new field type like Integer |
|
44 |
*/ |
|
45 |
public class Integervalue implements IStorable { |
|
46 |
|
|
47 |
/** |
|
48 |
* width of the new Integer field |
|
49 |
*/ |
|
50 |
private int _integervaluewidth; |
|
51 |
|
|
52 |
/** |
|
53 |
* Constructor |
|
54 |
*/ |
|
55 |
public Integervalue() { |
|
56 |
super(); |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* Returns the value of field 'integervaluewidth'. |
|
61 |
* |
|
62 |
* @return the value of field 'integervaluewidth'. |
|
63 |
*/ |
|
64 |
public int getIntegervaluewidth() { |
|
65 |
return this._integervaluewidth; |
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* Sets the value of field 'integervaluewidth'. |
|
70 |
* |
|
71 |
* @param integervaluewidth |
|
72 |
* the value of field 'integervaluewidth'. |
|
73 |
*/ |
|
74 |
public void setIntegervaluewidth(int integervaluewidth) { |
|
75 |
this._integervaluewidth = integervaluewidth; |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* This method serializes the integervalue object |
|
80 |
* |
|
81 |
* @param state |
|
82 |
*/ |
|
83 |
public void getstate(IStorage state) { |
|
84 |
state.setTheClass(this); |
|
85 |
state.put("integervaluewidth", this._integervaluewidth); |
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* This method parses the integervalue object |
|
90 |
* |
|
91 |
* @param state |
|
92 |
*/ |
|
93 |
public void setstate(IStorage state) { |
|
94 |
this._integervaluewidth = state.getInt("integervaluewidth"); |
|
95 |
} |
|
96 |
|
|
97 |
} |
branches/v2_0_0_prep/libraries/libGeocoding/src/org/gvsig/normalization/pattern/Decimalvalue.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Prodevelop S.L. main development |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.normalization.pattern; |
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a> |
|
33 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a> |
|
34 |
* |
|
35 |
*/ |
|
36 |
|
|
37 |
import org.gvsig.tools.storage.IStorable; |
|
38 |
import org.gvsig.tools.storage.IStorage; |
|
39 |
|
|
40 |
/** |
|
41 |
* Class Decimalvalue. |
|
42 |
* |
|
43 |
* This class defines the new field type like Decimal |
|
44 |
*/ |
|
45 |
public class Decimalvalue implements IStorable { |
|
46 |
|
|
47 |
|
|
48 |
/** |
|
49 |
* width of the integer part |
|
50 |
*/ |
|
51 |
private int _decimalvalueint; |
|
52 |
|
|
53 |
/** |
|
54 |
* width of the fractional part, precision |
|
55 |
*/ |
|
56 |
private int _decimalvaluedec; |
|
57 |
|
|
58 |
/** |
|
59 |
* Constructor |
|
60 |
*/ |
|
61 |
public Decimalvalue() { |
|
62 |
super(); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Returns the value of field 'decimalvaluedec'. |
|
67 |
* |
|
68 |
* @return the value of field 'decimalvaluedec'. |
|
69 |
*/ |
|
70 |
public int getDecimalvaluedec() { |
|
71 |
return this._decimalvaluedec; |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Returns the value of field 'decimalvalueint'. |
|
76 |
* |
|
77 |
* @return the value of field 'decimalvalueint'. |
|
78 |
*/ |
|
79 |
public int getDecimalvalueint() { |
|
80 |
return this._decimalvalueint; |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* Sets the value of field 'decimalvaluedec'. |
|
85 |
* |
|
86 |
* @param decimalvaluedec |
|
87 |
* the value of field 'decimalvaluedec'. |
|
88 |
*/ |
|
89 |
public void setDecimalvaluedec(int decimalvaluedec) { |
|
90 |
this._decimalvaluedec = decimalvaluedec; |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* Sets the value of field 'decimalvalueint'. |
|
95 |
* |
|
96 |
* @param decimalvalueint |
|
97 |
* the value of field 'decimalvalueint'. |
|
98 |
*/ |
|
99 |
public void setDecimalvalueint(int decimalvalueint) { |
|
100 |
this._decimalvalueint = decimalvalueint; |
|
101 |
} |
|
102 |
|
|
103 |
/** |
|
104 |
* This method serializes the decimalvalue object |
|
105 |
* |
|
106 |
* @param state |
|
107 |
*/ |
|
108 |
public void getstate(IStorage state) { |
|
109 |
state.setTheClass(this); |
|
110 |
state.put("decimalvalueint", this._decimalvalueint); |
|
111 |
state.put("decimalvaluedec", this._decimalvaluedec); |
|
112 |
} |
|
113 |
|
|
114 |
/** |
|
115 |
* This method parses the decimalvalue object |
|
116 |
* |
|
117 |
* @param state |
|
118 |
*/ |
|
119 |
public void setstate(IStorage state) { |
|
120 |
this._decimalvalueint = state.getInt("decimalvalueint"); |
|
121 |
this._decimalvaluedec = state.getInt("decimalvaluedec"); |
|
122 |
} |
|
123 |
|
|
124 |
} |
branches/v2_0_0_prep/libraries/libGeocoding/src/org/gvsig/normalization/pattern/Infieldseparators.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Prodevelop S.L. main development |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.normalization.pattern; |
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a> |
|
33 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a> |
|
34 |
* |
|
35 |
*/ |
|
36 |
|
|
37 |
import org.gvsig.tools.storage.IStorable; |
|
38 |
import org.gvsig.tools.storage.IStorage; |
|
39 |
|
|
40 |
/** |
|
41 |
* Class Infieldseparators. |
|
42 |
* |
|
43 |
* This class has the characters that they define in one number the thousand |
|
44 |
* separator, the decimal separator and the text separator |
|
45 |
* |
|
46 |
*/ |
|
47 |
public class Infieldseparators implements IStorable { |
|
48 |
|
|
49 |
/** |
|
50 |
* Thousand separator |
|
51 |
*/ |
|
52 |
private String _thousandseparator; |
|
53 |
|
|
54 |
/** |
|
55 |
* decimal separator |
|
56 |
*/ |
|
57 |
private String _decimalseparator; |
|
58 |
|
|
59 |
/** |
|
60 |
* text separator |
|
61 |
*/ |
|
62 |
private String _textseparator; |
|
63 |
|
|
64 |
/** |
|
65 |
* Constructor |
|
66 |
*/ |
|
67 |
public Infieldseparators() { |
|
68 |
super(); |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* Returns the value of field 'decimalseparator'. |
|
73 |
* |
|
74 |
* @return the value of field 'decimalseparator'. |
|
75 |
*/ |
|
76 |
public String getDecimalseparator() { |
|
77 |
return this._decimalseparator; |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Returns the value of field 'textseparator'. |
|
82 |
* |
|
83 |
* @return the value of field 'textseparator'. |
|
84 |
*/ |
|
85 |
public String getTextseparator() { |
|
86 |
return this._textseparator; |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Returns the value of field 'thousandseparator'. |
|
91 |
* |
|
92 |
* @return the value of field 'thousandseparator'. |
|
93 |
*/ |
|
94 |
public String getThousandseparator() { |
|
95 |
return this._thousandseparator; |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* Sets the value of field 'decimalseparator'. |
|
100 |
* |
|
101 |
* @param decimalseparator |
|
102 |
* the value of field 'decimalseparator' |
|
103 |
*/ |
|
104 |
public void setDecimalseparator(String decimalseparator) { |
|
105 |
this._decimalseparator = decimalseparator; |
|
106 |
} |
|
107 |
|
|
108 |
/** |
|
109 |
* Sets the value of field 'textseparator'. |
|
110 |
* |
|
111 |
* @param textseparator |
|
112 |
* the value of field 'textseparator'. |
|
113 |
*/ |
|
114 |
public void setTextseparator(String textseparator) { |
|
115 |
this._textseparator = textseparator; |
|
116 |
} |
|
117 |
|
|
118 |
/** |
|
119 |
* Sets the value of field 'thousandseparator'. |
|
120 |
* |
|
121 |
* @param thousandseparator |
|
122 |
* the value of field 'thousandseparator'. |
|
123 |
*/ |
|
124 |
public void setThousandseparator(String thousandseparator) { |
|
125 |
this._thousandseparator = thousandseparator; |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* This method serializes the infieldseparators object |
|
130 |
* |
|
131 |
* @param state |
|
132 |
*/ |
|
133 |
public void getstate(IStorage state) { |
|
134 |
state.setTheClass(this); |
|
135 |
state.put("thousandseparator", this._thousandseparator); |
|
136 |
state.put("decimalseparator", this._decimalseparator); |
|
137 |
state.put("textseparator", this._textseparator); |
|
138 |
} |
|
139 |
|
|
140 |
/** |
|
141 |
* This method parses the infieldseparators object |
|
142 |
* |
|
143 |
* @param state |
|
144 |
*/ |
|
145 |
public void setstate(IStorage state) { |
|
146 |
this._thousandseparator = (String) state.get("thousandseparator"); |
|
147 |
this._decimalseparator = (String) state.get("decimalseparator"); |
|
148 |
this._textseparator = (String) state.get("textseparator"); |
|
149 |
} |
|
150 |
|
|
151 |
} |
branches/v2_0_0_prep/libraries/libGeocoding/src/org/gvsig/normalization/pattern/Stringvalue.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Prodevelop S.L. main development |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.normalization.pattern; |
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a> |
|
33 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a> |
|
34 |
* |
|
35 |
*/ |
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
/** |
|
40 |
* Class Stringvalue. |
|
41 |
* |
|
42 |
* This class defines the new field type like String |
|
43 |
*/ |
|
44 |
public class Stringvalue implements IStorable { |
|
45 |
|
|
46 |
/** |
|
47 |
* Width of the new String field |
|
48 |
*/ |
|
49 |
private int _stringvaluewidth; |
|
50 |
|
|
51 |
/** |
|
52 |
* Constructor |
|
53 |
*/ |
|
54 |
public Stringvalue() { |
|
55 |
super(); |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* Returns the value of field 'stringvaluewidth'. |
|
60 |
* |
|
61 |
* @return the value of field 'stringvaluewidth'. |
|
62 |
*/ |
|
63 |
public int getStringvaluewidth() { |
|
64 |
return this._stringvaluewidth; |
|
65 |
} |
|
66 |
|
|
67 |
/** |
|
68 |
* Sets the value of field 'stringvaluewidth'. |
|
69 |
* |
|
70 |
* @param stringvaluewidth |
|
71 |
* the value of field 'stringvaluewidth' |
|
72 |
*/ |
|
73 |
public void setStringvaluewidth(int stringvaluewidth) { |
|
74 |
this._stringvaluewidth = stringvaluewidth; |
|
75 |
} |
|
76 |
|
|
77 |
/** |
|
78 |
* This method serializes the stringvalue object |
|
79 |
* |
|
80 |
* @param state |
|
81 |
*/ |
|
82 |
public void getstate(IStorage state) { |
|
83 |
state.setTheClass(this); |
|
84 |
state.put("stringvaluewidth", this._stringvaluewidth); |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* This method parses the stringvalue object |
|
89 |
* |
|
90 |
* @param state |
|
91 |
*/ |
|
92 |
public void setstate(IStorage state) { |
|
93 |
this._stringvaluewidth = state.getInt("stringvaluewidth"); |
|
94 |
|
|
95 |
} |
|
96 |
|
|
97 |
} |
branches/v2_0_0_prep/libraries/libGeocoding/src/org/gvsig/normalization/operations/StringListNormalization.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
Also available in: Unified diff