/*!
 * 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 S=O.extend("sap.ui.model.odata.type.Single",{constructor:function(f){O.apply(this,arguments);this.oFormatOptions=f;this._handleLocalizationChange();}});S.prototype.formatValue=function(v,t){if(v===null||v===undefined){return null;}switch(t){case"any":return v;case"float":return parseFloat(v);case"int":return parseInt(v,10);case"string":return g(this).format(parseFloat(v));default:throw new F("Don't know how to format "+this.getName()+" to "+t);}};S.prototype.parseValue=function(){throw new P("Unsupported operation: data type "+this.getName()+" is read-only.");};S.prototype._handleLocalizationChange=function(){this.oFormat=null;};S.prototype.validateValue=function(){throw new V("Unsupported operation: data type "+this.getName()+" is read-only.");};S.prototype.getName=function(){return"sap.ui.model.odata.type.Single";};return S;});
