%% 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 current_index = convert_twodimensional_grid_to_java_real(grid, left_grid, top_gird, java_grid, current_index)

for i=1:size(left_grid,2)
    % If we are not a leaf node on the left, descend:
    if ~isempty(old_cell.subgrid)
        current_index = TableBlock.convert_twodimensional_grid_to_java_real(grid, left_grid(i).subgrid.cells, top_grid, java_grid, current_index)
    else % Otherwise, we are the reference cell for the 2d grid.  So pull results out.
        java_grid.resize(java_grid.sizeX(), current_index + 1)
        for j=1:size(top_grid, 2)
            java_grid.get(j, current_index).setContents(grid.search_return(top_grid(j), left_grid(i)).result_text);
        end
        current_index=current_index+1;
    end
end

end

