Revision 39112

View differences:

branches/v2_0_0_prep/libraries/libEvaluator_SQLJEP/src/org/gvsig/tools/evaluator/sqljep/SQLJEPEvaluator.java
1 1
package org.gvsig.tools.evaluator.sqljep;
2 2

  
3
import java.math.BigDecimal;
3 4
import java.util.Map;
4 5
import java.util.Map.Entry;
5 6

  
......
17 18
	private boolean not_parsed;
18 19

  
19 20
	public SQLJEPEvaluator(String expresion) {
21
	    
22
	    
20 23
		super(expresion);
21 24
		this.expresion = expresion;
22 25
		this.data = null;
......
80 83
		}
81 84

  
82 85
		public Object getValue() {
86
		    
87
		    Object resp = null;
88
		    
83 89
			if (data.hasDataValue(key)) {
84
				return data.getDataValue(key);
90
			    resp = data.getDataValue(key);
91
			    resp = fixDecimal(resp);
92
				return resp;
85 93
			}
86
			return data.getDataValue(key);
94
			resp = data.getDataValue(key);;
95
            resp = fixDecimal(resp);
96
			return resp;
87 97
		}
88 98

  
89
		public Object setValue(Object arg0) {
99
		/**
100
         * @param resp
101
         * @return
102
         */
103
        private Object fixDecimal(Object obj) {
104
            
105
            if (obj instanceof Double) {
106
                Double dou = (Double) obj;
107
                String doustr = Double.toString(dou);
108
                return new BigDecimal(doustr);
109
            } else {
110
                if (obj instanceof Float) {
111
                    Float flo = (Float) obj;
112
                    String flostr = Float.toString(flo);
113
                    return new BigDecimal(flostr);
114
                } else {
115
                    return obj;
116
                }
117
            }
118
        }
119

  
120
        public Object setValue(Object arg0) {
90 121
			return null;
91 122
		}
92 123

  

Also available in: Unified diff