Statistics
| Revision:

root / trunk / extensions / extNormalization / src / org / gvsig / patterns / normalization / Element.java @ 22976

History | View | Annotate | Download (5.72 KB)

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.patterns.normalization;
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.gvsig.tools.storage.IStorable;
37
import org.gvsig.tools.storage.IStorage;
38

    
39
/**
40
 * Class Element.
41
 * 
42
 * @version $Revision$ $Date$
43
 */
44
public class Element implements IStorable {
45

    
46
        // --------------------------/
47
        // - Class/Member Variables -/
48
        // --------------------------/
49

    
50
        /**
51
         * Field _fieldname
52
         */
53
        private String _fieldname;
54

    
55
        /**
56
         * Field _fieldtype
57
         */
58
        private Fieldtype _fieldtype;
59

    
60
        /**
61
         * Field _fieldwidth
62
         */
63
        private int _fieldwidth;
64

    
65
        /**
66
         * Field _fieldseparator
67
         */
68
        private Fieldseparator _fieldseparator;
69

    
70
        /**
71
         * Field _infieldseparators
72
         */
73
        private Infieldseparators _infieldseparators;
74

    
75
        /**
76
         * Field _importfield
77
         */
78
        private boolean _importfield;
79

    
80
        // ----------------/
81
        // - Constructors -/
82
        // ----------------/
83

    
84
        public Element() {
85
                super();
86
        }
87

    
88
        // -----------/
89
        // - Methods -/
90
        // -----------/
91

    
92
        /**
93
         * Returns the value of field 'fieldname'.
94
         * 
95
         * @return the value of field 'fieldname'.
96
         */
97
        public String getFieldname() {
98
                return this._fieldname;
99
        }
100

    
101
        /**
102
         * Returns the value of field 'fieldseparator'.
103
         * 
104
         * @return the value of field 'fieldseparator'.
105
         */
106
        public Fieldseparator getFieldseparator() {
107
                return this._fieldseparator;
108
        }
109

    
110
        /**
111
         * Returns the value of field 'fieldtype'.
112
         * 
113
         * @return the value of field 'fieldtype'.
114
         */
115
        public Fieldtype getFieldtype() {
116
                return this._fieldtype;
117
        }
118

    
119
        /**
120
         * Returns the value of field 'fieldwidth'.
121
         * 
122
         * @return the value of field 'fieldwidth'.
123
         */
124
        public int getFieldwidth() {
125
                return this._fieldwidth;
126
        }
127

    
128
        /**
129
         * Returns the value of field 'importfield'.
130
         * 
131
         * @return the value of field 'importfield'.
132
         */
133
        public boolean getImportfield() {
134
                return this._importfield;
135
        }
136

    
137
        /**
138
         * Returns the value of field 'infieldseparators'.
139
         * 
140
         * @return the value of field 'infieldseparators'.
141
         */
142
        public Infieldseparators getInfieldseparators() {
143
                return this._infieldseparators;
144
        }
145

    
146
        /**
147
         * Sets the value of field 'fieldname'.
148
         * 
149
         * @param fieldname
150
         *            the value of field 'fieldname'.
151
         */
152
        public void setFieldname(String fieldname) {
153
                this._fieldname = fieldname;
154
        }
155

    
156
        /**
157
         * Sets the value of field 'fieldseparator'.
158
         * 
159
         * @param fieldseparator
160
         *            the value of field 'fieldseparator'.
161
         */
162
        public void setFieldseparator(Fieldseparator fieldseparator) {
163
                this._fieldseparator = fieldseparator;
164
        }
165

    
166
        /**
167
         * Sets the value of field 'fieldtype'.
168
         * 
169
         * @param fieldtype
170
         *            the value of field 'fieldtype'.
171
         */
172
        public void setFieldtype(Fieldtype fieldtype) {
173
                this._fieldtype = fieldtype;
174
        }
175

    
176
        /**
177
         * Sets the value of field 'fieldwidth'.
178
         * 
179
         * @param fieldwidth
180
         *            the value of field 'fieldwidth'.
181
         */
182
        public void setFieldwidth(int fieldwidth) {
183
                this._fieldwidth = fieldwidth;
184
        }
185

    
186
        /**
187
         * Sets the value of field 'importfield'.
188
         * 
189
         * @param importfield
190
         *            the value of field 'importfield'.
191
         */
192
        public void setImportfield(boolean importfield) {
193
                this._importfield = importfield;
194
        }
195

    
196
        /**
197
         * Sets the value of field 'infieldseparators'.
198
         * 
199
         * @param infieldseparators
200
         *            the value of field 'infieldseparators'.
201
         */
202
        public void setInfieldseparators(Infieldseparators infieldseparators) {
203
                this._infieldseparators = infieldseparators;
204
        }
205

    
206
        public void getstate(IStorage state) {
207
                state.setName("element");
208
                state.setTheClass(this);
209
                state.put("fieldname", this._fieldname);
210
                state.put("fieldtype", this._fieldtype);
211
                state.put("fieldwidth", this._fieldwidth);
212
                state.put("fieldseparator", this._fieldseparator);
213
                state.put("infieldseparators", this._infieldseparators);
214
                state.put("importfield", this._importfield ? "true" : "false");
215
        }
216

    
217
        public void setstate(IStorage state) {
218
                this._fieldname = (String) state.get("fieldname");
219
                this._fieldwidth = (int) state.getInt("fieldwidth");
220
                this._importfield = ((String) state.get("importfield"))
221
                                .compareTo("true") == 0 ? true : false;
222
                try {
223
                        this._fieldtype = (Fieldtype) state.getObject("fieldtype");
224
                        this._fieldseparator = (Fieldseparator) state
225
                                        .getObject("fieldseparator");
226
                        this._infieldseparators = (Infieldseparators) state
227
                                        .getObject("infieldseparators");
228
                } catch (InstantiationException e) {
229
                        // TODO Auto-generated catch block
230
                        e.printStackTrace();
231
                } catch (IllegalAccessException e) {
232
                        // TODO Auto-generated catch block
233
                        e.printStackTrace();
234
                }
235
        }
236

    
237
}