root / branches / v2_0_0_prep / libraries / org.gvsig.geocoding / src / org / gvsig / normalization / pattern / impl / DefaultDecimalvalue.java @ 32474
History | View | Annotate | Download (4.02 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.normalization.pattern.impl; |
29 |
|
30 |
import org.gvsig.geocoding.GeocodingTags; |
31 |
import org.gvsig.normalization.pattern.Decimalvalue; |
32 |
import org.gvsig.utils.XMLEntity; |
33 |
import org.gvsig.utils.XMLException; |
34 |
|
35 |
/**
|
36 |
* Class Decimalvalue.
|
37 |
*
|
38 |
* This class defines the new field type like Decimal
|
39 |
*
|
40 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
|
41 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
|
42 |
*/
|
43 |
public class DefaultDecimalvalue implements Decimalvalue { |
44 |
|
45 |
/**
|
46 |
* width of the integer part
|
47 |
*/
|
48 |
private int _decimalvalueint; |
49 |
|
50 |
/**
|
51 |
* width of the fractional part, precision
|
52 |
*/
|
53 |
private int _decimalvaluedec; |
54 |
|
55 |
/**
|
56 |
* Constructor
|
57 |
*/
|
58 |
public DefaultDecimalvalue() {
|
59 |
super();
|
60 |
} |
61 |
|
62 |
/**
|
63 |
* Returns the value of field 'decimalvaluedec'.
|
64 |
*
|
65 |
* @return the value of field 'decimalvaluedec'.
|
66 |
*/
|
67 |
public int getDecimalvaluedec() { |
68 |
return this._decimalvaluedec; |
69 |
} |
70 |
|
71 |
/**
|
72 |
* Returns the value of field 'decimalvalueint'.
|
73 |
*
|
74 |
* @return the value of field 'decimalvalueint'.
|
75 |
*/
|
76 |
public int getDecimalvalueint() { |
77 |
return this._decimalvalueint; |
78 |
} |
79 |
|
80 |
/**
|
81 |
* Sets the value of field 'decimalvaluedec'.
|
82 |
*
|
83 |
* @param decimalvaluedec
|
84 |
* the value of field 'decimalvaluedec'.
|
85 |
*/
|
86 |
public void setDecimalvaluedec(int decimalvaluedec) { |
87 |
this._decimalvaluedec = decimalvaluedec;
|
88 |
} |
89 |
|
90 |
/**
|
91 |
* Sets the value of field 'decimalvalueint'.
|
92 |
*
|
93 |
* @param decimalvalueint
|
94 |
* the value of field 'decimalvalueint'.
|
95 |
*/
|
96 |
public void setDecimalvalueint(int decimalvalueint) { |
97 |
this._decimalvalueint = decimalvalueint;
|
98 |
} |
99 |
|
100 |
// /**
|
101 |
// * Saves the internal state of the object on the provided
|
102 |
// * PersistentState object.
|
103 |
// *
|
104 |
// * @param state
|
105 |
// */
|
106 |
// public void saveToState(PersistentState state) throws
|
107 |
// PersistenceException{
|
108 |
// state.set("decimalvalueint", this._decimalvalueint);
|
109 |
// state.set("decimalvaluedec", this._decimalvaluedec);
|
110 |
// }
|
111 |
//
|
112 |
// /**
|
113 |
// * Set the state of the object from the state passed as parameter.
|
114 |
// *
|
115 |
// * @param state
|
116 |
// */
|
117 |
// public void loadFromState(PersistentState state) throws
|
118 |
// PersistenceException{
|
119 |
// this._decimalvalueint = state.getInt("decimalvalueint");
|
120 |
// this._decimalvaluedec = state.getInt("decimalvaluedec");
|
121 |
// }
|
122 |
|
123 |
/**
|
124 |
* Get class name
|
125 |
*/
|
126 |
public String getClassName() { |
127 |
return this.getClass().getName(); |
128 |
} |
129 |
|
130 |
/**
|
131 |
* Persist object
|
132 |
*/
|
133 |
public XMLEntity getXMLEntity() throws XMLException { |
134 |
XMLEntity xml = new XMLEntity();
|
135 |
xml.setName(GeocodingTags.DECIMALVALUE); |
136 |
xml.putProperty(GeocodingTags.DECIMALVALUEINT, this._decimalvalueint);
|
137 |
xml.putProperty(GeocodingTags.DECIMALVALUEDEC, this._decimalvaluedec);
|
138 |
return xml;
|
139 |
} |
140 |
|
141 |
/**
|
142 |
* Load object
|
143 |
*/
|
144 |
public void setXMLEntity(XMLEntity xml) throws XMLException { |
145 |
this._decimalvalueint = xml
|
146 |
.getIntProperty(GeocodingTags.DECIMALVALUEINT); |
147 |
this._decimalvaluedec = xml
|
148 |
.getIntProperty(GeocodingTags.DECIMALVALUEDEC); |
149 |
} |
150 |
|
151 |
} |