3 function [propVal,isThere]=getProp(propName,varargin)
4 branchName=mfilename(
'class');
6 branchName,propName,varargin{:});
8 function setProp(propName,propVal)
9 branchName=mfilename(
'class');
11 branchName,propName,propVal);
14 branchName=mfilename('class');
15 mxberry.core.obj.StaticPropStorage.flushInternal(branchName);
17 function val=getEqCounter()
24 function setEqCounter(val)
28 function incEqCounter(valInc)
35 function checkNCallsEquality(fList)
37 callNumVec=nan(1,nFunc);
39 callNumVec(iFunc)=getNCalls(fList{iFunc});
41 checkEqCalls(callNumVec(1:end-1),callNumVec(2:end));
44 function checkNotSortableCalls(objVec)
47 @()
mxberry.
core.ismemberjoint({objVec},{objVec(2:end)}),...
49 EqualCallCounter.checkNCallsEquality({...
50 @()
mxberry.
core.ismemberjoint({objVec},{objVec}),...
52 EqualCallCounter.checkNCallsEquality({...
57 function checkCalls(objVec,isBuiltInsChecked)
60 isBuiltInsChecked=
true;
64 check(@()(isequal(objVec(1),objVec(2))),1);
65 check(@()(isequaln(objVec(1),objVec(2))),1);
66 check(@()(isequaln(objVec(1),objVec(2))),1);
68 nSortCalls=getNCalls(@()sort(objVec));
69 sortedObjVec=sort(objVec);
70 nDoubleSortCalls=getNCalls(@()sort([sortedObjVec,sortedObjVec]));
71 doubleSortedObjVec=sort([sortedObjVec,sortedObjVec]);
72 nHandleComparisons=sum(eq(doubleSortedObjVec(1:end-1),...
73 doubleSortedObjVec(2:end),
'asHandle',
true));
74 fUniqCplx=@(x)(x-1+nSortCalls);
75 fIsMembCplx=@(x)(2*fUniqCplx(x)+2*x-1-nHandleComparisons+nDoubleSortCalls);
77 nCallsForBuiltInUniq=fUniqCplx(nRels);
78 if ismethod(objVec,
'sort')
79 nCallsForUniqJoint=nCallsForBuiltInUniq;
81 nCallsForUniqJoint=nRels*(nRels-1)*0.5;
85 check(@()
unique(objVec),nCallsForBuiltInUniq);
89 nEqCallsForBuiltInIsMember=fIsMembCplx(nRels);
91 check(@()
ismember(objVec,objVec),nEqCallsForBuiltInIsMember);
93 check(@()
mxberry.
core.ismemberjoint({objVec},{objVec}),...
94 nEqCallsForBuiltInIsMember);
96 nEqCallsForBuiltInIsMember);
98 function check(fHandle,nExpCalls)
99 nCalls=getNCalls(fHandle);
100 checkEqCalls(nExpCalls,nCalls);
103 function nCalls=getNCalls(fHandle)
104 nCalls=getNCalls(fHandle);
108 function checkEqCalls(nExpCallVec,nCallVec)
109 isOk=isequal(nExpCallVec,nCallVec);
112 sprintf(
'Expected %s calls, Called %s times',...
113 mat2str(nExpCallVec),mat2str(nCallVec)));
116 function nCalls=getNCalls(fHandle)
static function setPropInternal(in branchName, in propName, in propVal)
static function setEqCounter(in val)
function uniquejoint(in inpCArr, in varargin)
UNIQUEJOINT perform joint unique operation for cell arrays.
static function getEqCounter()
function unique(in inpVec)
UNIQUE for arrays of any type.
static function checkNCallsEquality(in fList)
function ismember(in leftVec, in rightVec, in varargin)
ISMEMBER - ismember implementation for arrays of any type.
static function getPropInternal(in branchName, in propName, in isPresenceChecked)