Changeset 14176


Ignore:
Timestamp:
12/17/12 16:47:05 (12 years ago)
Author:
Mathieu Morlighem
Message:

NEW: added list of all unused option for plotmodel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/pairoptions.m

    r14101 r14176  
    55%      pairoptions=pairoptions('module',true,'solver',false);
    66
    7 classdef pairoptions
     7classdef pairoptions < handle
    88        properties (SetAccess = private,GetAccess = private)
    99                functionname = '';
    10                 list         = cell(0,2);
     10                list         = cell(0,3);
    1111        end
    1212        methods
     
    3838
    3939                        %Allocate memory
    40                         obj.list=cell(numoptions,2);
     40                        obj.list=cell(numoptions,3);
    4141
    4242                        %go through varargin and build list of obj
     
    4545                                        obj.list{i,1}=varargin{2*i-1};
    4646                                        obj.list{i,2}=varargin{2*i};
     47                                        obj.list{i,3}=false; %used?
    4748                                else
    4849                                        %option is not a string, ignore it
     
    5758                                obj.list{end+1,1} = field;
    5859                                obj.list{end,2}   = value;
     60                                obj.list{end,3}   = false;
    5961                        end
    6062                end % }}}
     
    6567                                        obj.list{end+1,1} = field;
    6668                                        obj.list{end,2}   = value;
     69                                        obj.list{end,3}   = true;  %It is a default so user will not be notified if not used
    6770                                end
    6871                        end
     
    9194                                %add new field if not found
    9295                                obj=addfield(obj,field,newvalue);
     96                                obj.list{end,3}=true; % do not notify user if unused
    9397                        else
    9498                                for i=1:length(lines),
     
    116120                        %remove duplicates from the options list
    117121                        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
    118132                end % }}}
    119133                function disp(obj) % {{{
     
    187201                        pos=find(strcmpi(obj.list(:,1),field));
    188202                        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
    190205                                return;
    191206                        end
Note: See TracChangeset for help on using the changeset viewer.