public Integer columnOfOrNull(Integer index) { if (index == null) return null; int columns = 0; int iMax = maxLimit(index, cells.size()); for (int i = 0; i < iMax; i++) { TableCell cell = cells.get(i); columns += cell.columnSpan; } return columns; }
public int textToInsideOffset(int insideOffset, TableCell previousCell) { return maxLimit(getCellSize(previousCell), minLimit(insideOffset - getTextStartOffset(previousCell) + getInsideStartOffset(previousCell), 0)); }
public int insideToTextOffset(int insideOffset, TableCell previousCell) { return maxLimit(text.length(), minLimit(insideOffset - getInsideStartOffset(previousCell) + getTextStartOffset(previousCell), 0)); }
public int getLineNumber(int offset) { if (lineSegments == EMPTY_LIST) { BasedSequence preText = getChars().baseSubSequence(0, Utils.maxLimit(offset, getChars().length())); if (preText.isEmpty()) return 0; int lineNumber = 0; int nextLineEnd = preText.endOfLineAnyEOL(0); final int length = preText.length(); while (nextLineEnd < length) { lineNumber++; nextLineEnd = preText.endOfLineAnyEOL(nextLineEnd + 1); } return lineNumber; } else { final int iMax = lineSegments.size(); for (int i = 0; i < iMax; i++) { if (offset < lineSegments.get(i).getEndOffset()) { return i; } } return iMax; } }
/** * Only available if not at last row * <p> * CAUTION: NOT TESTED * * @param insideOffset offset inside the cell, null if same as th * * @return offset in previous cell or null */ public TableCellOffsetInfo nextRowOffset(Integer insideOffset) { if (row + 1 < table.getAllRowsCount()) { List<TableRow> allRows = table.getAllRows(); TableRow otherRow = allRows.get(this.row + 1); if (getInsideColumn() && column < otherRow.cells.size()) { // transfer inside offset TableCell cell = otherRow.cells.get(column); TableCell previousCell = getPreviousCell(otherRow, 1); if (insideOffset == null) cell.textToInsideOffset(tableCell.insideToTextOffset(this.insideOffset == null ? 0 : this.insideOffset, previousCell), previousCell); return table.getCellOffsetInfo(cell.getTextStartOffset(previousCell) + (maxLimit(cell.getCellSize(previousCell), minLimit(0, insideOffset)))); } else { if (isBeforeCells()) { return table.getCellOffsetInfo(otherRow.cells.get(0).getStartOffset(null)); } else { return table.getCellOffsetInfo(otherRow.cells.get(otherRow.cells.size() - 1).getEndOffset()); } } } return null; }
/** * Only available if not at row 0 * <p> * CAUTION: NOT TESTED * * @param insideOffset offset inside the cell, null if same as th * * @return offset in previous cell or null */ public TableCellOffsetInfo previousRowOffset(Integer insideOffset) { if (row > 0) { List<TableRow> allRows = table.getAllRows(); TableRow otherRow = allRows.get(this.row - 1); if (getInsideColumn() && column < otherRow.cells.size()) { // transfer inside offset TableCell cell = getPreviousCell(); TableCell previousCell = getPreviousCell(2); if (insideOffset == null) cell.textToInsideOffset(tableCell.insideToTextOffset(this.insideOffset == null ? 0 : this.insideOffset, previousCell), previousCell); return table.getCellOffsetInfo(cell.getTextStartOffset(previousCell) + (maxLimit(cell.getCellSize(previousCell), minLimit(0, insideOffset)))); } else { if (isBeforeCells()) { return table.getCellOffsetInfo(otherRow.cells.get(0).getStartOffset(null)); } else { return table.getCellOffsetInfo(otherRow.cells.get(otherRow.cells.size() - 1).getEndOffset()); } } } return null; }
/** * Only available if tableRow/tableCell are set and not in first cell of first row * <p> * CAUTION: NOT TESTED * * @param insideOffset offset inside the cell, null if same as th * * @return offset in previous cell or null */ public TableCellOffsetInfo nextCellOffset(Integer insideOffset) { if (getInsideColumn() && column + 1 < tableRow.cells.size()) { TableCell cell = getPreviousCell(); TableCell previousCell = getPreviousCell(2); if (insideOffset == null) cell.textToInsideOffset(tableCell.insideToTextOffset(this.insideOffset == null ? 0 : this.insideOffset, previousCell), previousCell); return table.getCellOffsetInfo(cell.getTextStartOffset(previousCell) + (maxLimit(cell.getCellSize(previousCell), minLimit(0, insideOffset)))); } return null; }
/** * Only available if inside are set and not in first cell of first row * <p> * CAUTION: NOT TESTED * * @param insideOffset offset inside the cell, null if same as the current cell inside * offset * * @return offset in previous cell or null */ public TableCellOffsetInfo previousCellOffset(Integer insideOffset) { if (getInsideColumn() && column > 0) { TableCell cell = getPreviousCell(); TableCell previousCell = getPreviousCell(2); if (insideOffset == null) { cell.textToInsideOffset(tableCell.insideToTextOffset(this.insideOffset == null ? 0 : this.insideOffset, previousCell), previousCell); } return table.getCellOffsetInfo(cell.getTextStartOffset(previousCell) + (maxLimit(cell.getCellSize(previousCell), minLimit(0, insideOffset)))); } return null; }
public Integer columnOfOrNull(Integer index) { if (index == null) return null; int columns = 0; int iMax = maxLimit(index, cells.size()); for (int i = 0; i < iMax; i++) { TableCell cell = cells.get(i); columns += cell.columnSpan; } return columns; }
int wasEnd = rangeEnd; rangeStart = Utils.minLimit(rangeStart, 1); rangeEnd = Utils.maxLimit(rangeEnd, 6); if (wasStart != rangeStart || wasEnd != rangeEnd) { parserParams.add(new ParserMessage(option, ParsedOptionStatus.WEAK_WARNING, finalProvider.message(KEY_OPTION_0_VALUE_1_TRUNCATED_TO_RANGE_2, OPTION_0_VALUE_1_TRUNCATED_TO_RANGE_2, myOptionName, option, rangeStart + ", " + rangeEnd)));
public int textToInsideOffset(int insideOffset, TableCell previousCell) { return maxLimit(getCellSize(previousCell), minLimit(insideOffset - getTextStartOffset(previousCell) + getInsideStartOffset(previousCell), 0)); }
public int insideToTextOffset(int insideOffset, TableCell previousCell) { return maxLimit(text.length(), minLimit(insideOffset - getInsideStartOffset(previousCell) + getTextStartOffset(previousCell), 0)); }
/** * Only available if not at last row * <p> * CAUTION: NOT TESTED * * @param insideOffset offset inside the cell, null if same as th * * @return offset in previous cell or null */ public TableCellOffsetInfo nextRowOffset(Integer insideOffset) { if (row + 1 < table.getAllRowsCount()) { List<TableRow> allRows = table.getAllRows(); TableRow otherRow = allRows.get(this.row + 1); if (getInsideColumn() && column < otherRow.cells.size()) { // transfer inside offset TableCell cell = otherRow.cells.get(column); TableCell previousCell = getPreviousCell(otherRow, 1); if (insideOffset == null) cell.textToInsideOffset(tableCell.insideToTextOffset(this.insideOffset == null ? 0 : this.insideOffset, previousCell), previousCell); return table.getCellOffsetInfo(cell.getTextStartOffset(previousCell) + (maxLimit(cell.getCellSize(previousCell), minLimit(0, insideOffset)))); } else { if (isBeforeCells()) { return table.getCellOffsetInfo(otherRow.cells.get(0).getStartOffset(null)); } else { return table.getCellOffsetInfo(otherRow.cells.get(otherRow.cells.size() - 1).getEndOffset()); } } } return null; }
public int getLineNumber(int offset) { if (lineSegments == EMPTY_LIST) { BasedSequence preText = getChars().baseSubSequence(0, Utils.maxLimit(offset, getChars().length())); if (preText.isEmpty()) return 0; int lineNumber = 0; int nextLineEnd = preText.endOfLineAnyEOL(0); final int length = preText.length(); while (nextLineEnd < length) { lineNumber++; nextLineEnd = preText.endOfLineAnyEOL(nextLineEnd + 1); } return lineNumber; } else { final int iMax = lineSegments.size(); for (int i = 0; i < iMax; i++) { if (offset < lineSegments.get(i).getEndOffset()) { return i; } } return iMax; } }
/** * Only available if not at row 0 * <p> * CAUTION: NOT TESTED * * @param insideOffset offset inside the cell, null if same as th * * @return offset in previous cell or null */ public TableCellOffsetInfo previousRowOffset(Integer insideOffset) { if (row > 0) { List<TableRow> allRows = table.getAllRows(); TableRow otherRow = allRows.get(this.row - 1); if (getInsideColumn() && column < otherRow.cells.size()) { // transfer inside offset TableCell cell = getPreviousCell(); TableCell previousCell = getPreviousCell(2); if (insideOffset == null) cell.textToInsideOffset(tableCell.insideToTextOffset(this.insideOffset == null ? 0 : this.insideOffset, previousCell), previousCell); return table.getCellOffsetInfo(cell.getTextStartOffset(previousCell) + (maxLimit(cell.getCellSize(previousCell), minLimit(0, insideOffset)))); } else { if (isBeforeCells()) { return table.getCellOffsetInfo(otherRow.cells.get(0).getStartOffset(null)); } else { return table.getCellOffsetInfo(otherRow.cells.get(otherRow.cells.size() - 1).getEndOffset()); } } } return null; }
/** * Only available if tableRow/tableCell are set and not in first cell of first row * <p> * CAUTION: NOT TESTED * * @param insideOffset offset inside the cell, null if same as th * * @return offset in previous cell or null */ public TableCellOffsetInfo nextCellOffset(Integer insideOffset) { if (getInsideColumn() && column + 1 < tableRow.cells.size()) { TableCell cell = getPreviousCell(); TableCell previousCell = getPreviousCell(2); if (insideOffset == null) cell.textToInsideOffset(tableCell.insideToTextOffset(this.insideOffset == null ? 0 : this.insideOffset, previousCell), previousCell); return table.getCellOffsetInfo(cell.getTextStartOffset(previousCell) + (maxLimit(cell.getCellSize(previousCell), minLimit(0, insideOffset)))); } return null; }
/** * Only available if inside are set and not in first cell of first row * <p> * CAUTION: NOT TESTED * * @param insideOffset offset inside the cell, null if same as the current cell inside * offset * * @return offset in previous cell or null */ public TableCellOffsetInfo previousCellOffset(Integer insideOffset) { if (getInsideColumn() && column > 0) { TableCell cell = getPreviousCell(); TableCell previousCell = getPreviousCell(2); if (insideOffset == null) { cell.textToInsideOffset(tableCell.insideToTextOffset(this.insideOffset == null ? 0 : this.insideOffset, previousCell), previousCell); } return table.getCellOffsetInfo(cell.getTextStartOffset(previousCell) + (maxLimit(cell.getCellSize(previousCell), minLimit(0, insideOffset)))); } return null; }
int wasEnd = rangeEnd; rangeStart = Utils.minLimit(rangeStart, 1); rangeEnd = Utils.maxLimit(rangeEnd, 6); if (wasStart != rangeStart || wasEnd != rangeEnd) { parserParams.add(new ParserMessage(option, ParsedOptionStatus.WEAK_WARNING, finalProvider.message(KEY_OPTION_0_VALUE_1_TRUNCATED_TO_RANGE_2, OPTION_0_VALUE_1_TRUNCATED_TO_RANGE_2, myOptionName, option, rangeStart + ", " + rangeEnd)));
int listIndent = markerIndent; int listIndex = markerIndent; final int contentIndentRemoval = Utils.maxLimit(currentIndent, contentIndent, listIndent + 4); return continueAtColumn(state.getColumn() + Utils.maxLimit(contentIndent, itemIndent)); } else { ListBlockParser.ListData listData = ListBlockParser.parseListMarker(myOptions, -1, state);