Skip to content

Commit 312cbf9

Browse files
committed
Fix JDoc and apply suggestions
1 parent 2c35db7 commit 312cbf9

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

app/src/main/java/org/schabi/newpipe/streams/SrtFromTtmlWriter.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,19 @@ private void writeString(final String text) throws IOException {
5454
out.write(text.getBytes(charset));
5555
}
5656

57-
/*
58-
* Recursive method to extract text from all nodes
59-
* - This method processes TextNode and <br> tags, recursively
60-
* extracting text from nested tags.
61-
* For example: extract text from nested <span> tags
62-
* - Appends newlines for <br> tags.
57+
/**
58+
* <p>Recursive method to extract text from all nodes.</p>
59+
* <p>
60+
* This method processes {@link TextNode}s and {@code <br>} tags,
61+
* recursively extracting text from nested tags
62+
* (e.g. extracting text from nested {@code <span>} tags).
63+
* Newlines are added for {@code <br>} tags.
64+
* </p>
6365
*/
6466
private void extractText(final Node node, final StringBuilder text) {
65-
if (node instanceof TextNode) {
66-
text.append(((TextNode) node).text());
67-
} else if (node instanceof Element) {
68-
final Element element = (Element) node;
67+
if (node instanceof TextNode textNode) {
68+
text.append((textNode).text());
69+
} else if (node instanceof Element element) {
6970
// <br> is a self-closing HTML tag used to insert a line break.
7071
if (element.tagName().equalsIgnoreCase("br")) {
7172
// Add a newline for <br> tags
@@ -98,7 +99,7 @@ public void build(final SharpStream ttml) throws IOException {
9899
final Elements paragraphList = doc.select("body > div > p");
99100

100101
// check if has frames
101-
if (paragraphList.size() < 1) {
102+
if (paragraphList.isEmpty()) {
102103
return;
103104
}
104105

0 commit comments

Comments
 (0)