/*!
 * SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
 * (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
 * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
 */
sap.ui.define(['sap/ui/core/format/NumberFormat','sap/ui/model/FormatException','sap/ui/model/odata/type/ODataType','sap/ui/model/ParseException','sap/ui/model/ValidateException'],function(N,F,O,P,V){"use strict";function g(t){var f;if(!t.oFormat){f=jQuery.extend({groupingEnabled:true},t.oFormatOptions);t.oFormat=N.getFloatInstance(f);}return t.oFormat;}var D=O.extend("sap.ui.model.odata.type.Double",{constructor:function(f){O.apply(this,arguments);this.oFormatOptions=f;this._handleLocalizationChange();}});D.prototype.formatValue=function(v,t){var f,a;if(v===null||v===undefined){return null;}switch(t){case"any":return v;case"float":return parseFloat(v);case"int":return Math.floor(parseFloat(v));case"string":a=parseFloat(v);if(a&&(Math.abs(a)>=1e15||Math.abs(a)<1e-4)){f=g(this).oFormatOptions;return a.toExponential().replace("e","\u00a0E").replace(".",f.decimalSeparator).replace("+",f.plusSign).replace("-",f.minusSign);}return g(this).format(v);default:throw new F("Don't know how to format "+this.getName()+" to "+t);}};D.prototype.parseValue=function(){throw new P("Unsupported operation: data type "+this.getName()+" is read-only.");};D.prototype._handleLocalizationChange=function(){this.oFormat=null;};D.prototype.validateValue=function(){throw new V("Unsupported operation: data type "+this.getName()+" is read-only.");};D.prototype.getName=function(){return"sap.ui.model.odata.type.Double";};return D;});
