Changeset 14176
- Timestamp:
- 12/17/12 16:47:05 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/pairoptions.m
r14101 r14176 5 5 % pairoptions=pairoptions('module',true,'solver',false); 6 6 7 classdef pairoptions 7 classdef pairoptions < handle 8 8 properties (SetAccess = private,GetAccess = private) 9 9 functionname = ''; 10 list = cell(0, 2);10 list = cell(0,3); 11 11 end 12 12 methods … … 38 38 39 39 %Allocate memory 40 obj.list=cell(numoptions, 2);40 obj.list=cell(numoptions,3); 41 41 42 42 %go through varargin and build list of obj … … 45 45 obj.list{i,1}=varargin{2*i-1}; 46 46 obj.list{i,2}=varargin{2*i}; 47 obj.list{i,3}=false; %used? 47 48 else 48 49 %option is not a string, ignore it … … 57 58 obj.list{end+1,1} = field; 58 59 obj.list{end,2} = value; 60 obj.list{end,3} = false; 59 61 end 60 62 end % }}} … … 65 67 obj.list{end+1,1} = field; 66 68 obj.list{end,2} = value; 69 obj.list{end,3} = true; %It is a default so user will not be notified if not used 67 70 end 68 71 end … … 91 94 %add new field if not found 92 95 obj=addfield(obj,field,newvalue); 96 obj.list{end,3}=true; % do not notify user if unused 93 97 else 94 98 for i=1:length(lines), … … 116 120 %remove duplicates from the options list 117 121 obj.list=obj.list(lines,:); 122 end % }}} 123 function displayunused(obj) % {{{ 124 %DISPLAYUNUSED - display unused options 125 126 numoptions=size(obj.list,1); 127 for i=1:numoptions, 128 if ~obj.list{i,3}, 129 disp(['WARNING: option ' obj.list{i,1} ' was not used']) 130 end 131 end 118 132 end % }}} 119 133 function disp(obj) % {{{ … … 187 201 pos=find(strcmpi(obj.list(:,1),field)); 188 202 if ~isempty(pos), 189 value=obj.list{pos(1),2}; %ignore extra entry 203 value=obj.list{pos(1),2}; % ignore extra entry 204 obj.list{pos(1),3}=true; % option used 190 205 return; 191 206 end
Note:
See TracChangeset
for help on using the changeset viewer.