Initial commit

This commit is contained in:
casim
2025-10-31 23:21:03 +01:00
commit 332f12bca2
238 changed files with 128397 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
package de.lcag.common;
import java.util.Set;
public class GenericTable extends HashTable {
private static final String KEY_COLUMN = "Key";
private static final String ROW_NUMBER_COLUMN = "RowNo";
private static final String COLUMN_NUMBER_COLUMN = "ColNo";
private static final String COLUMN_NAME_COLUMN = "ColName";
private static final String COLUMN_VALUE_COLUMN = "ColValue";
AbstractTable sourceTable = null;
private char encloseBy = '"';
public GenericTable(AbstractTable pSrcTable) {
super(KEY_COLUMN, ROW_NUMBER_COLUMN, COLUMN_NUMBER_COLUMN, COLUMN_NAME_COLUMN, COLUMN_VALUE_COLUMN);
this.sourceTable = pSrcTable;
convertToGenericTable();
}
private void convertToGenericTable() {
AbstractTable srcTable = this.sourceTable;
int noRows = srcTable.lenght();
Set<String> columnNames = srcTable.getColumnNames();
for (int srcRowNumber = 0; srcRowNumber < noRows; srcRowNumber++) {
int columnNumber = 0;
for (String columnName : columnNames) {
int n = this.newRow();
Object cellValue = srcTable.getCellValue(srcRowNumber, columnName);
columnNumber += 1;
this.setCellValue(n, KEY_COLUMN, srcRowNumber);
this.setCellValue(n, ROW_NUMBER_COLUMN, srcRowNumber);
this.setCellValue(n, COLUMN_NUMBER_COLUMN, columnNumber);
this.setCellValue(n, COLUMN_NAME_COLUMN, columnName);
this.setCellValue(n, COLUMN_VALUE_COLUMN, cellValue);
}
}
}
public String getKey(int pRowNo) {
String result = this.getCellValue(pRowNo, KEY_COLUMN).toString();
return result;
}
}