/*!
 * 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(['jquery.sap.global','./FilterOperator','sap/ui/core/util/UnicodeNormalizer'],function(q,F,U){"use strict";var a=sap.ui.base.Object.extend("sap.ui.model.Filter",{constructor:function(p,o,v,V){if(typeof p==="object"&&!q.isArray(p)){var f=p;this.sPath=f.path;this.sOperator=f.operator;this.oValue1=f.value1;this.oValue2=f.value2;this.aFilters=f.filters||f.aFilters;this.bAnd=f.and||f.bAnd;this.fnTest=f.test;}else{if(q.isArray(p)){this.aFilters=p;}else{this.sPath=p;}if(q.type(o)==="boolean"){this.bAnd=o;}else if(q.type(o)==="function"){this.fnTest=o;}else{this.sOperator=o;}this.oValue1=v;this.oValue2=V;}this.oValue1=this._normalizeValue(this.oValue1);this.oValue2=this._normalizeValue(this.oValue2);if(q.isArray(this.aFilters)&&!this.sPath&&!this.sOperator&&!this.oValue1&&!this.oValue2){this._bMultiFilter=true;q.each(this.aFilters,function(i,b){if(!(b instanceof a)){q.sap.log.error("Filter in Aggregation of Multi filter has to be instance of sap.ui.model.Filter");}});}else if(!this.aFilters&&this.sPath!==undefined&&((this.sOperator&&this.oValue1!==undefined)||this.fnTest)){this._bMultiFilter=false;}else{q.sap.log.error("Wrong parameters defined for filter.");}}});a.prototype._normalizeValue=function(v){if(typeof v==="string"&&String.prototype.normalize!=undefined){v=v.normalize();}return v;};return a;},true);
