Statistics
| Revision:

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

History | View | Annotate | Download (4.96 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

    
28
package org.gvsig.patterns.normalization;
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
import org.gvsig.tools.storage.IStorable;
41
import org.gvsig.tools.storage.IStorage;
42
import org.gvsig.tools.storage.StorageCollection;
43

    
44
/**
45
 * Class Patternnormalization.
46
 * 
47
 * @version $Revision$ $Date$
48
 */
49
public class Patternnormalization implements IStorable {
50

    
51
        // --------------------------/
52
        // - Class/Member Variables -/
53
        // --------------------------/
54

    
55
        /**
56
         * Field _patternname
57
         */
58
        private String _patternname;
59

    
60
        /**
61
         * Field _patternurl
62
         */
63
        private String _patternurl;
64

    
65
        /**
66
         * Field _nofirstrows
67
         */
68
        private int _nofirstrows;
69

    
70
        /**
71
         * Field _elements
72
         */
73
        private List _elements;
74

    
75
        // ----------------/
76
        // - Constructors -/
77
        // ----------------/
78

    
79
        public Patternnormalization() {
80
                super();
81
        }
82

    
83
        // -----------/
84
        // - Methods -/
85
        // -----------/
86

    
87
        /**
88
         * Returns the value of field 'elements'.
89
         * 
90
         * @return the value of field 'elements'.
91
         */
92
        public List getElements() {
93
                return this._elements;
94
        }
95
        
96
        /**
97
         * Returns the value of field 'elements'.
98
         * 
99
         * @return the value of field 'elements'.
100
         */
101
        public Element[] getArrayElements() {
102
                Element[] eles = new Element [this._elements.size()];
103
                for (int i = 0; i < this._elements.size(); i++) {
104
                        eles[i]=(Element)this._elements.get(i);
105
                }
106
                return eles;
107
        }
108

    
109
        /**
110
         * Returns the value of field 'nofirstrows'.
111
         * 
112
         * @return the value of field 'nofirstrows'.
113
         */
114
        public int getNofirstrows() {
115
                return this._nofirstrows;
116
        }
117

    
118
        /**
119
         * Returns the value of field 'patternname'.
120
         * 
121
         * @return the value of field 'patternname'.
122
         */
123
        public java.lang.String getPatternname() {
124
                return this._patternname;
125
        }
126

    
127
        /**
128
         * Returns the value of field 'patternurl'.
129
         * 
130
         * @return the value of field 'patternurl'.
131
         */
132
        public java.lang.String getPatternurl() {
133
                return this._patternurl;
134
        }
135

    
136
        /**
137
         * Sets the value of field 'elements'.
138
         * 
139
         * @param elements
140
         *            the value of field 'elements'.
141
         */
142
        public void setElements(List elements) {
143
                this._elements = elements;
144
        }
145

    
146
        /**
147
         * Sets the value of field 'nofirstrows'.
148
         * 
149
         * @param nofirstrows
150
         *            the value of field 'nofirstrows'.
151
         */
152
        public void setNofirstrows(int nofirstrows) {
153
                this._nofirstrows = nofirstrows;
154
        }
155

    
156
        /**
157
         * Sets the value of field 'patternname'.
158
         * 
159
         * @param patternname
160
         *            the value of field 'patternname'.
161
         */
162
        public void setPatternname(String patternname) {
163
                this._patternname = patternname;
164
        }
165

    
166
        /**
167
         * Sets the value of field 'patternurl'.
168
         * 
169
         * @param patternurl
170
         *            the value of field 'patternurl'.
171
         */
172
        public void setPatternurl(String patternurl) {
173
                this._patternurl = patternurl;
174
        }
175

    
176
        public void getstate(IStorage state) {
177
                state.setName("patternnormalization");
178
                state.setTheClass(this);
179
                state.put("patternname", this._patternname);
180
                state.put("patternurl", this._patternurl);
181
                state.put("nofirstrows", this._nofirstrows);
182
                state.put("elements","element", this._elements);
183
        }
184

    
185
        public void setstate(IStorage state) {
186
                this._patternname = ((String) state.get("patternname")).trim();
187
                this._patternurl = ((String) state.get("patternurl")).trim();
188
                this._nofirstrows = state.getInt("nofirstrows");
189
                try {
190
                        StorageCollection sto = (StorageCollection) state
191
                                        .getObject("elements");
192
                        this._elements = new ArrayList();
193
                        for (int i = 0; i < sto.size(); i++) {
194
                                Element elem = (Element)  sto.get(i);
195
                                this._elements.add(elem);
196

    
197
                        }
198
                } catch (InstantiationException e) {
199
                        // TODO Auto-generated catch block
200
                        e.printStackTrace();
201
                } catch (IllegalAccessException e) {
202
                        // TODO Auto-generated catch block
203
                        e.printStackTrace();
204
                }
205
        }
206

    
207
}