%% convert_hierarchical_grid_to_java
% generates a java version fo the hiearchcial grid
%
% inputs:
%   grid:Grid - grid to convert
%   java_grid:List<HierarchicalCell> - place to put changed cells.
%
% outputs;
%   none
% Author: Matthew Dawson matthew@mjdsystems.ca
% Organization: McMaster Centre for Software Certification

function convert_hierarchical_grid_to_java(grid, java_grid)

for i=1:size(grid,2)
    new_cell = ca.mcscert.jtet.tabularexpression.HierarchicalCell;
    
    old_cell = grid(i);
    new_cell.setContents(old_cell.cond_text)
    
    if ~isempty(old_cell.subgrid)
        TableBlock.convert_hierarchical_grid_to_java(old_cell.subgrid.cells, new_cell.getSubHierarchy())
    end
    java_grid.add(new_cell);
end

end

