Package org.openl.rules.table
Class SimpleLogicalTable
- java.lang.Object
-
- org.openl.rules.table.ALogicalTable
-
- org.openl.rules.table.SimpleLogicalTable
-
- All Implemented Interfaces:
ILogicalTable,ITable<ILogicalTable>
public class SimpleLogicalTable extends ALogicalTable
AdaptsIGridTable, that doesn`t contain merged cells in the top row and left column toILogicalTableinterface.
Be careful, as this implementation doesn`t provide that following operations
ITable.getColumn(int)
ITable.getColumns(int)
ITable.getColumns(int, int)
ITable.getRow(int)
ITable.getRows(int)
ITable.getRows(int, int)
ITable.getSubtable(int, int, int, int)
will return right ILogicalTable. That is because all of them are based ongetSubtable(int, int, int, int)method implementation.- Author:
- Andrei Astrouski, DLiauchuk
-
-
Constructor Summary
Constructors Constructor Description SimpleLogicalTable(IGridTable table)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intfindColumnStart(int gridOffset)Calculates # of the column starting exactly at gridOffset.intfindRowStart(int gridOffset)Calculates # of the row starting exactly at gridOffset.ICellgetCell(int column, int row)intgetColumnWidth(int column)intgetHeight()intgetRowHeight(int row)ILogicalTablegetSubtable(int column, int row, int width, int height)This method consider that this table doesn`t have merged regions inside itself.intgetWidth()-
Methods inherited from class org.openl.rules.table.ALogicalTable
getColumn, getColumns, getColumns, getRow, getRows, getRows, getSource, isNormalOrientation, toString, transpose
-
-
-
-
Constructor Detail
-
SimpleLogicalTable
public SimpleLogicalTable(IGridTable table)
-
-
Method Detail
-
getWidth
public int getWidth()
- Returns:
- width of the table
-
getHeight
public int getHeight()
- Returns:
- height of the table
-
findColumnStart
public int findColumnStart(int gridOffset)
Description copied from interface:ILogicalTableCalculates # of the column starting exactly at gridOffset. Throws TableException if gridOffset does not match any column's start.- Returns:
-
findRowStart
public int findRowStart(int gridOffset)
Description copied from interface:ILogicalTableCalculates # of the row starting exactly at gridOffset. Throws TableException if gridOffset does not match any row's start.- Returns:
-
getColumnWidth
public int getColumnWidth(int column)
- Parameters:
column- index of the column- Returns:
- width of the column by its index.
-
getRowHeight
public int getRowHeight(int row)
- Parameters:
row- index of the row- Returns:
- height of the row by its index.
-
getSubtable
public ILogicalTable getSubtable(int column, int row, int width, int height)
This method consider that this table doesn`t have merged regions inside itself. In general it is not true. Current Openl parsing implementation, correctly handles such cases. If you need the trully ILogicalTable, with correctly calculated logical columns and rows, you may get the source table, by callingILogicalTable.getSource()extract the region you need by callingITable.getSubtable(int, int, int, int)and createILogicalTableby callingLogicalTableHelper.logicalTable(IGridTable). This is optimised implementation because of time overhead when checking for each table is it really logical or not.
For test seeSimpleLogicalTableTest.- Parameters:
column- from which we want to take the subtable, including this.row- from which we want to take the subtable, including this.width- of the needed table.height- of the needed table.- Returns:
SimpleLogicalTable
-
getCell
public ICell getCell(int column, int row)
- Returns:
- cell form the given column and row.
-
-