Revision 2087
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataTypesManager.java | ||
---|---|---|
65 | 65 |
|
66 | 66 |
public int addtype(int type, String subtype, String name, |
67 | 67 |
Class defaultClass, Coercion coercion, String iconName, |
68 |
boolean fixedPrecision, int max_precision,
|
|
68 |
boolean predefinedPrecision, int max_precision,
|
|
69 | 69 |
int default_precision, int default_scale); |
70 | 70 |
|
71 | 71 |
public Coercion getCoercion(int type); |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/DataType.java | ||
---|---|---|
104 | 104 |
|
105 | 105 |
public int getDefaultScale(); |
106 | 106 |
|
107 |
public boolean isFixedPrecision();
|
|
107 |
public boolean isPredefinedPrecision();
|
|
108 | 108 |
|
109 | 109 |
public NumberPrecisionAndScale fixPrecisionAndScale(int precision, int scale); |
110 | 110 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/DefaultDataTypesManager.java | ||
---|---|---|
155 | 155 |
|
156 | 156 |
public final synchronized int addtype(int type, String subtype, String name, |
157 | 157 |
Class defaultClass, Coercion coercion, String iconName, |
158 |
boolean fixedPrecision, int max_precision, int default_precision) {
|
|
158 |
boolean predefinedPrecision, int max_precision, int default_precision) {
|
|
159 | 159 |
return addtype(type, subtype, name, defaultClass, coercion, iconName, |
160 |
fixedPrecision, max_precision, default_precision, NO_SUPPORT_SCALE
|
|
160 |
predefinedPrecision, max_precision, default_precision, NO_SUPPORT_SCALE
|
|
161 | 161 |
); |
162 | 162 |
} |
163 | 163 |
|
164 | 164 |
@Override |
165 | 165 |
public final synchronized int addtype(int type, String subtype, String name, |
166 | 166 |
Class defaultClass, Coercion coercion, String iconName, |
167 |
boolean fixedPrecision, int max_precision, int default_precision, int default_scale) {
|
|
167 |
boolean predefinedPrecision, int max_precision, int default_precision, int default_scale) {
|
|
168 | 168 |
if (type == INVALID) { |
169 | 169 |
type = getNewObjectIndexType(); |
170 | 170 |
} |
... | ... | |
185 | 185 |
|
186 | 186 |
DataType dataType = new DefaultDataType( |
187 | 187 |
type, subtype, name, defaultClass, coercion, iconName, |
188 |
fixedPrecision, max_precision, default_precision, default_scale
|
|
188 |
predefinedPrecision, max_precision, default_precision, default_scale
|
|
189 | 189 |
); |
190 | 190 |
types[type] = dataType; |
191 | 191 |
LOG.info("Registered data type {}.", dataType.toString()); |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dataTypes/impl/DefaultDataType.java | ||
---|---|---|
80 | 80 |
private int max_precision; |
81 | 81 |
private int default_precision; |
82 | 82 |
private int default_scale; |
83 |
private boolean fixedPrecision;
|
|
83 |
private boolean predefinedPrecision;
|
|
84 | 84 |
|
85 | 85 |
DefaultDataType(int type, String subtype, String name, Class defaultClass, Coercion coercion) { |
86 | 86 |
this(type, subtype, name, defaultClass, coercion, "datatype-any"); |
... | ... | |
109 | 109 |
this.max_precision = max_precision; |
110 | 110 |
this.default_precision = default_precision; |
111 | 111 |
this.default_scale = default_scale; |
112 |
this.fixedPrecision = isFixedPrecision;
|
|
112 |
this.predefinedPrecision = isFixedPrecision;
|
|
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
@Override |
... | ... | |
216 | 216 |
@Override |
217 | 217 |
public void addCoercion(Coercion coercion) { |
218 | 218 |
if (this.coercion == null) { |
219 |
this.setCoercion(coercion);
|
|
219 |
this.coercion = coercion;
|
|
220 | 220 |
return; |
221 | 221 |
} |
222 | 222 |
Coercions coercions; |
... | ... | |
288 | 288 |
precision, |
289 | 289 |
scale |
290 | 290 |
); |
291 |
if( this.fixedPrecision ) {
|
|
291 |
if( this.predefinedPrecision ) {
|
|
292 | 292 |
r.precision = max_precision; |
293 | 293 |
} |
294 | 294 |
if( this.default_scale==NO_SUPPORT_SCALE ) { |
... | ... | |
386 | 386 |
return this.default_scale; |
387 | 387 |
} |
388 | 388 |
|
389 |
public boolean isFixedPrecision() { |
|
390 |
return this.fixedPrecision; |
|
389 |
@Override |
|
390 |
public boolean isPredefinedPrecision() { |
|
391 |
return this.predefinedPrecision; |
|
391 | 392 |
} |
392 | 393 |
} |
Also available in: Unified diff