public String getFormatted(boolean withDelimiter) { String s = NumberFormat.getFormat(myFormat, Utils.minLimit(myCount, 1)); String o = myLowercase == null ? s : myLowercase ? s.toLowerCase() : s.toUpperCase(); return withDelimiter && myDelimiter != null && !myDelimiter.isEmpty() ? o + myDelimiter : o; } }
g2.setColor(TRANSPARENT); g2.setComposite(AlphaComposite.Src); g2.fillRoundRect(minLimit(0, x - borderWidth / 2), minLimit(0, y - borderWidth / 2), w + borderWidth, h + borderWidth, cornerRadius + borderWidth, cornerRadius + borderWidth); } else { g2.setColor(TRANSPARENT); g2.setComposite(AlphaComposite.Src); g2.fillRect(minLimit(0, x - borderWidth / 2), minLimit(0, y - borderWidth / 2), w + borderWidth, h + borderWidth);
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)); }
cells.add(index + 1, tableCell.withColumnSpan(minLimit(1, cell.columnSpan - spanOffset + 1)));
int colonCount = alignment1 == CellAlignment.LEFT || alignment1 == CellAlignment.RIGHT ? 1 : alignment1 == CellAlignment.CENTER ? 2 : 0; int dashCount = 0; int dashesOnly = Utils.minLimit(dashCount, options.minSeparatorColumnWidth - colonCount, options.minSeparatorDashes); if (dashCount < dashesOnly) dashCount = dashesOnly; int width = dashCount * options.dashWidth + colonCount * options.colonWidth + options.pipeWidth; BasedSequence trim = cell.text.trim(colonTrimChars); int dashCount = trim.length(); int dashesOnly = Utils.minLimit(dashCount, options.minSeparatorColumnWidth - colonCount, options.minSeparatorDashes); if (dashCount < dashesOnly) dashCount = dashesOnly; int width = dashCount * options.dashWidth + colonCount * options.colonWidth + options.pipeWidth;
/** * 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; }
out.append(headingText); int extraChars = outputAttributes(out, " "); out.line().repeat(level == 1 ? '=' : '-', Utils.minLimit(headingText.length() + extraChars, myOptions.minSetextHeadingMarkerLength)); } else { out.repeat('#', level).append(' ');
/** * 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 cellOffset = out.offsetWithPending(); int adjustForBlank = cell.text.isBlank() ? -1 : 0; trackedOffsets.put(cell.trackedTextOffset + cell.getTextStartOffset(i == 0 ? null : row.cells.get(i - 1)), cellOffset + minLimit(adjustedCell.trackedTextOffset + adjustForBlank, 0) + adjustedCell.trackedTextAdjust);
int colonCount = alignment1 == CellAlignment.LEFT || alignment1 == CellAlignment.RIGHT ? 1 : alignment1 == CellAlignment.CENTER ? 2 : 0; int dashCount = (columnWidths[j] - colonCount * options.colonWidth - options.pipeWidth) / options.dashWidth; int dashesOnly = Utils.minLimit(dashCount, options.minSeparatorColumnWidth - colonCount, options.minSeparatorDashes); if (dashCount < dashesOnly) dashCount = dashesOnly; trackedPos = cell == null ? NOT_TRACKED : minLimit(cell.trackedTextOffset, 0); captionCell = captionCell.withTrackedOffset(minLimit(cell.trackedTextOffset - cell.text.trimmedStart().length(), 0)); TableCell adjustedCell = row.cells.get(0); if (adjustedCell.trackedTextOffset != NOT_TRACKED) { trackedOffsets.put(cell.trackedTextOffset + cell.text.getStartOffset(), cellOffset + (cellText.isBlank() ? 1 : minLimit(adjustedCell.trackedTextOffset, 0) + adjustedCell.trackedTextAdjust));
public String getFormatted(boolean withDelimiter) { String s = NumberFormat.getFormat(myFormat, Utils.minLimit(myCount, 1)); String o = myLowercase == null ? s : myLowercase ? s.toLowerCase() : s.toUpperCase(); return withDelimiter && myDelimiter != null && !myDelimiter.isEmpty() ? o + myDelimiter : o; } }
int wasStart = rangeStart; int wasEnd = rangeEnd; rangeStart = Utils.minLimit(rangeStart, 1); rangeEnd = Utils.maxLimit(rangeEnd, 6); if (wasStart != rangeStart || wasEnd != rangeEnd) {
if (node.getParent() instanceof ListItem) { BasedSequence marker = ((ListItem) node.getParent()).getOpeningMarker(); prefix = RepeatedCharSequence.of(" ", Utils.minLimit(8 - marker.length() - 1, 4)).toString();
unorderedListDelimiter = FlexmarkHtmlParser.UNORDERED_LIST_DELIMITER.getFrom(options); definitionMarkerSpaces = FlexmarkHtmlParser.DEFINITION_MARKER_SPACES.getFrom(options); minSetextHeadingMarkerLength = Utils.minLimit(FlexmarkHtmlParser.MIN_SETEXT_HEADING_MARKER_LENGTH.getFrom(options), 3); codeIndent = FlexmarkHtmlParser.CODE_INDENT.getFrom(options); eolInTitleAttribute = FlexmarkHtmlParser.EOL_IN_TITLE_ATTRIBUTE.getFrom(options);
public int insideToTextOffset(int insideOffset, TableCell previousCell) { return maxLimit(text.length(), minLimit(insideOffset - getInsideStartOffset(previousCell) + getTextStartOffset(previousCell), 0)); }
markdown.repeat(node.getClosingMarker().charAt(0), Utils.minLimit(markdown.offset() - ref.value, formatterOptions.minSetextMarkerLength)); } else { markdown.append(node.getClosingMarker());