package com.connor.erp.materialquery.ViewStockOfERP;

import javax.swing.JTable;

class CMap1 implements CMap {
  public int span(JTable table, int row, int column) {
    int rowCount = table.getRowCount();
    if (column == 0 || column == 1 || column == 2) {
      int reRow = 1;
      for (int i = row; i < rowCount - 1 && 
        table.getValueAt(i, column).toString().equals(table.getValueAt(i + 1, column).toString()); i++)
        reRow++; 
      return reRow;
    } 
    return 1;
  }
  
  public int visibleCell(JTable table, int row, int column) {
    if ((column == 0 || column == 1 || column == 2) && 
      row > 0 && 
      table.getValueAt(row, column).toString() == table.getValueAt(row - 1, column).toString())
      return row - 1; 
    return row;
  }
}
