www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@sweepsetfilter/sweepsetfilter.m

    function obj = sweepsetfilter(pSweepset, nameStr, dateStr)
%SWEEPSETFILTER Constructor
%
%  OBJ = SWEEPSETFILTER(PTR_SWEEPSET, NAME, DATE)
%
%  PTR_SWEEPSET should be a pointer to a sweepset.
%
%  See also SWEEPSET.

%  Copyright 2000-2014 The MathWorks, Inc. and Ford Global Technologies, Inc.


if nargin && isstruct(pSweepset)
    % Check if we are being called from loadobj with a structure
    obj = pSweepset;
elseif nargin && isa(pSweepset, 'sweepsetfilter')
    % Overloaded sweepsetfilter cast to allow derived objects to implement
    % a call to sweepsetfilter and return an ssf
    obj = pSweepset;
    return
else
    % Initialise correctly for zero orgument constructor
    if nargin < 1
        pSweepset = xregpointer;
    end
    if nargin < 2
        nameStr = '';
    end
    if nargin < 3
        dateStr = datestr(now);
    end
    
    if ~(isa(pSweepset, 'xregpointer') && length(pSweepset) == 1)
        error(message('mbc:sweepsetfilter:InvalidArgument14'));
    end
    % Create the empty structure with fields in the correct alphabetic
    % order - then fill them in during construction
    obj = struct(...
        'allowsCacheing', [],...
        'allowsFlag', [],...
        'cachedSweepset', [],...
        'comment', [],...
        'dataMessageService', [],...
        'date', [],...
        'defineTests', [],...
        'displayLayout',[],...
        'filterGuid', [],...
        'filters', [],...
        'modifiedData', [],...
        'name', [],...
        'pSweepset', [],...
        'recordsToRemove', [],...
        'reorderSweeps', [],...
        'resampling', [],...
        'sweepFilters', [],...
        'sweepNotes', [],...
        'sweepVariableSweepset', [],...
        'sweepVariables', [],...
        'sweepsToRemove', [],...
        'variableSweepset', [],...
        'variables', [],...
        'variablesToKeep', [],...
        'version', 6); 
        
    
    % Pointer to the underlying sweepset
    obj.pSweepset = pSweepset;
    
    % Information about the filters being applied
    % ---------------------------------------------------------------------
    % filterExp - the string expression  of the filter
    % result - indicates success in applying the filter
    % inlineExp - mbcinline version of the filter
    % filterResult - logical result of the filter
    % OK - boolean indicating successful application of the filter
    % userdata - userdata field stored with the filters
    obj.filters = struct(...
        'OK',{},...
        'filterExp',{},...
        'filterResult',{},...
        'inlineExp',{},...
        'result',{},...
        'userdata',{});
    
    obj.sweepFilters = struct(...
        'OK',{},...
        'filterExp',{},...
        'filterResult',{},...
        'inlineExp',{},...
        'result',{},...
        'userdata',{});
    
    obj.filterGuid = guidarray;
    
    % Cached info that allows the filters to be applied
    obj.recordsToRemove   = [];
    obj.sweepsToRemove    = {};
    obj.variablesToKeep   = {};
      
    % Cacheing info
    obj.cachedSweepset    = [];
    obj.allowsCacheing    = false;
    
    % Reordering information .. both new dataset and sweep order
    obj.reorderSweeps = {};
    obj.defineTests = struct('variable',{},...
        'tolerance',{},...
        'reorder',{},...
        'testnumAlias',{});
    
    % Information about the user-defined variables added
    % ---------------------------------------------------------------------
    % varName - name of the variable being added
    % varExp - expression defining the new variable
    % varString - similar to the string used to construct the variable [varName ' = ' varExp]
    % result - indicates success in add the variable
    % OK - boolean indicating successful application of the variable
    % inlineExp - mbcinline version of the variable expression    
    % userdata - userdata field stored with the filters
    obj.variables = struct(...
        'OK',{},...
        'inlineExp',{},...
        'result',{},...
        'userdata',{},...
        'varExp',{},...
        'varName',{},...
        'varString',{},...
        'varUnit',{});

    % Cached copy of the user-defined variables
    obj.variableSweepset = [];

    % Information about the user-defined sweep variables added
    % ---------------------------------------------------------------------
    % varName - name of the variable being added
    % varExp - expression defining the new variable
    % varString - similar to the string used to construct the variable [varName ' = ' varExp]
    % result - indicates success in add the variable
    % OK - boolean indicating successful application of the variable
    % inlineExp - mbcinline version of the variable expression    
    % userdata - userdata field stored with the filters
    obj.sweepVariables = struct(...
        'OK',{},...
        'inlineExp',{},...
        'result',{},...
        'userdata',{},...
        'varExp',{},...
        'varName',{},...
        'varString',{},...
        'varUnit',{});

    % Cached copy of the user-defined variables
    obj.sweepVariableSweepset = [];
    
    % Information about sweep notes in alphabetic order
    % ---------------------------------------------------------------------
    % noteExp - the string expression that represents the note
    % noteString - the string to be displayed where the note is applied
    % noteColor - The color triple associated with the note
    % lAppliesTo - a logical vector which holds which sweeps the note applies to
    % isMultiNote - a boolean that indicates noteExp returns multiple notes
    %             - not used at present
    % result - indicates that noteExp was applied successfully
    % OK - boolean indicateing successful application of the note
    % inlineExp - holds the mbcinline version of the note
    % userdata - userdata field stored with the filters
    obj.sweepNotes = struct(...
        'OK',{},...
        'inlineExp',{},...
        'isMultiNote',{},...
        'lAppliesTo',{},...
        'noteColor',{},...
        'noteExp',{},...
        'noteString',{},...
        'result',{},...
        'userdata',{});
    
    % Information about resampling process.
    % ---------------------------------------------------------------------
    % Note that the resampling structure is different to those of the other
    % processes. In particular, this structure is of size [1, 1] rather than an
    % array of structures. 
    %
    % OK - (logical) indicating successful application of the whole resample
    %     process  
    % resampleExp - (cell-string) the string expressions of the resample
    %     commands
    % resampledSweepset - (sweepset) cached version of the resampled sweepset
    % result - (string) indicates success or otherwise of the whole resample
    %     process  
    % userdata - any further data needed to be stored with the resample process    % inlineExp - (cell array of mbcinline) parsed versions of the resample
    %     commands  
    % varNames - (cell-array) list of variables that each of the resample
    %     processes apply to. Must be the same size as inlineExp and
    %     resampleExp. Each element of the applicable variable array can either
    %     be a string with a variable name or a cell array of such strings.   
    obj.resampling = struct( ...
        'OK', true, ...
        'resampleExp', {{}}, ...
        'resampledSweepset', [], ...
        'result', '', ...
        'userdata', [], ...
        'varNames', {{}} );
    
    % Structure to hold changes to underlying data - dataValues is a sparse
    % array of changes to data indexed on the row by guid and column by
    % variable name. dataPosition indicates which values are applicable
    % ---------------------------------------------------------------------
    % dataValues - sparse matrix holding the new data values
    % dataPosition - sparse logical matrix indicating which values in
    %      dataValues are relevant changes
    % rowGuid - guidarray that indicates which row of the sweepset is
    %      modified by the coresponding row in dataValues
    % columnName - cell array of string that indicates which column of the
    %      sweepset is modified by the coresponding column in dataValues
    % validRows - indicates the number of valid rows in dataValues
    % validCols - indicates the number of valid columns in dataValues
    %      Note that some guids or columnNames might not be found in the
    %      underlying sweepset and those rows/cols need to be placed at the
    %      end of the sparse matrices. Within the sparse matrices the
    %      guids and columns that do exist are ordered as found in the
    %      underlying sweepset.
    % fullPosition - logical sparse matrix which locates which elements in
    %      the underlying matrix need modification. This matrix needs
    %      updateing every time the underlying sweepset changes
    obj.modifiedData = struct(...
        'columnName', {{}},...
        'dataPosition', sparse(false(0)),...
        'dataValues', sparse(0,0),...
        'fullPosition', sparse(0,0),...
        'rowGuid', guidarray,...
        'validCols', 0,...
        'validRows', 0);
    
    % Allows flag (set all properties on by default)
    obj.allowsFlag = intmax('uint64');
    
    % Information about this object
    obj.name = nameStr;
    obj.date = dateStr;
    obj.comment = '';
    
    % Event sending object to broadcast change information
    obj.dataMessageService = [];
end

obj = class(obj, 'sweepsetfilter');