%% clone
%    function will create a copy of the current grid and store it
%    in dest_grid, since grid is a recursive datatype this is a
%    recursive function in order to do a deep clone.
% inputs:
%   object:Grid - current Grid object
%   dest_grid:Grid - grid to copy contents to
%   index:int - index of the current grid
%   p_cell:Cell - parent cell of the current grid.
% outputs:
%   none
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function [] = clone(object,dest_grid,index,p_cell)
for i=1:size(object.cells,2)
    dest_grid.new_Cell();
    dest_grid.cells(i).cond_text = object.cells(i).cond_text;
    if (~isempty(object.cells(i).subgrid))
        dest_grid.cells(i).subgrid = Grid(dest_grid.cells(i).cell_index,dest_grid.cells(i));
        dest_grid.cells(i).subgrid.set_rGrid(dest_grid.cells(i).parent_grid.rGrid);
        object.cells(i).subgrid.clone(dest_grid.cells(i).subgrid,object.cells(i).subgrid.grid_index,dest_grid.cells(i));
    else
        
    end
    
end
end