Commit 3b241485 authored by Matthew Dawson's avatar Matthew Dawson
Browse files

Start refactor of the table tool box.

Remove some of the old stuff no longer relevant, and also start on the condition
grid.  Note needs to be renamed.


git-svn-id: https://groke.mcmaster.ca/svn/grad/colin/branches/TableTool_refactor@8639 57e6efec-57d4-0310-aeb1-a6c144bb1a8b
parent c1974580
Loading
Loading
Loading
Loading

@CondCell/CondCell.m

0 → 100644
+29 −0
Original line number Diff line number Diff line
% Author: Matthew Dawson matthew@mjdsystems.ca
% Organization: McMaster Centre for Software Certification
classdef CondCell < handle
    % This class will store a single cell of data.  It contains its string,
    % and it contains a subgrid if appropriate.
    
    properties
        text = '';
        grid = [];
    end
    
    
    
    methods
        
        %% Data
        %   constructor
        % inputs:
        %   none
        % outputs:
        %   object:Data - created object
        function object = CondCell()
            
        end
        
    end
    
    
end

@CondGrid/CondGrid.m

0 → 100644
+31 −0
Original line number Diff line number Diff line
% Author: Matthew Dawson matthew@mjdsystems.ca
% Organization: McMaster Centre for Software Certification
classdef CondGrid < handle
    % This class stores a grid containing conditions for the table.
    % It can be used either for the left of top grid.
    
    properties
        grid = {}
        right_most_grid_cells = {}
    end
    
    events
        AddedOuterCell
    end
    
    methods
        
        %% Data
        %   constructor
        % inputs:
        %   none
        % outputs:
        %   object:Data - created object
        function object = CondGrid()
            
        end
        
    end
    
    
end

@CondGrid/add_cell.m

0 → 100644
+57 −0
Original line number Diff line number Diff line
% Author: Matthew Dawson matthew@mjdsystems.ca
% Organization: McMaster Centre for Software Certification

function [] = add_cell( object, beneath_cell, after_cell )
%% ADD_CELL Add a cell to the grid.
%   Adds a new cell to the grid, updates relevant information throughout,
%   and sends appropriate update signals.
global asdf
    %% Find Subgrid
    if isempty(beneath_cell)
        subgrid = object;
    else 
        subgrid = beneath_cell;
    end
    
    NewCell = CondCell();
    NewCell.text = asdf;
    asdf = asdf + 1;
        
    if isempty(after_cell)
        %% Append cell to grid
        % Append the cell to the current grid.
        
        % Find new index for right_most_grid_cells
        if isempty(subgrid.grid)
            % No cells at this level.  If we are base, just use 1.
            % Otherwise use its current index.
            if isempty(beneath_cell)
                rmgi = 1;
            else
                rmgi = object.find_cell_in_list(object.right_most_grid_cells, beneath_cell);
            end
            
            %Ok, this is a replacement operation.
            object.right_most_grid_cells{ rmgi } = NewCell;
            if isempty(beneath_cell)
                %Only notify if a new cell was added.
                notify(object, 'AddedOuterCell', GridSingleCellEventDetails(rmgi))
            end
        else
            rmgi = object.find_cell_in_list(object.right_most_grid_cells, subgrid.grid{ size(subgrid.grid, 2) });
            
            %Since this is now an addition to the right most list, append.
            object.right_most_grid_cells = {object.right_most_grid_cells{1:rmgi} NewCell object.right_most_grid_cells{(rmgi+1):size(object.right_most_grid_cells, 2)}};
            rmgi = rmgi + 1;
    
            %This is always an addition.  So notify.
            notify(object, 'AddedOuterCell', GridSingleCellEventDetails(rmgi))
        end
        
        subgrid.grid{ size(subgrid.grid, 2)+1 } = NewCell;
    else
        assert(false, 'Add support for non-appending action');
    end

end
+17 −0
Original line number Diff line number Diff line
% Author: Matthew Dawson matthew@mjdsystems.ca
% Organization: McMaster Centre for Software Certification

function [ gi ] = find_cell_in_list( object, grid, find_cell )

    gi = -1;
    
    for i = 1:size(object.right_most_grid_cells, 2)
        if grid{i} == find_cell
            gi = i;
            break;
        end
    end
    
    assert(gi ~= -1, 'Failed to find looked for cell!')
end
+4 −5
Original line number Diff line number Diff line
% Author: Colin Eles elesc@mcmaster.ca
% Author: Matthew Dawson matthew@mjdsystems.ca
% Organization: McMaster Centre for Software Certification
classdef Data < handle
    % This class will store the data for each table, ideally to seperate
    % out the data from the gui and logic.
    
    properties
        Grid0 = [];
        Grid1 = [];
        Grid2 = [];
        left_cond = CondGrid();
        top_cond = CondGrid();
        result_grid = ResultGrid();
        function_name = [];
        function_inputs = [];
        settings = [];
@@ -35,4 +35,3 @@ classdef Data < handle
    
    
end
Loading