-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from dcm4che/dev
Improve JavaDocs of IODs
- Loading branch information
Showing
17 changed files
with
237 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...dicom-java-generator-lib/src/main/java/org/dcm4che/typeddicom/generator/JavaDocUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.dcm4che.typeddicom.generator; | ||
|
||
import org.davidmoten.text.utils.WordWrap; | ||
|
||
public class JavaDocUtils { | ||
private static final String JAVA_DOC_NEWLINE = "\n * "; | ||
private static final int MAX_LINE_LENGTH = 120; | ||
private static final String ZERO_WIDTH_CHARACTERS_REGEX = "[\n\r]"; | ||
|
||
private JavaDocUtils() { | ||
} | ||
|
||
public static String javaDocify(String html, int indentationLevel) { | ||
String jdoc = WordWrap.from(html) | ||
.maxWidth(MAX_LINE_LENGTH | ||
- JAVA_DOC_NEWLINE.replaceAll(ZERO_WIDTH_CHARACTERS_REGEX, "").length() | ||
- indentationLevel) | ||
.extraWordChars("0123456789-._~:/?#[]@!$&'()*+,;%=\"<>") | ||
.newLine(JAVA_DOC_NEWLINE) | ||
.breakWords(false) | ||
.wrap(); | ||
jdoc = "/**\n * " + jdoc + "\n */"; | ||
jdoc = indent(jdoc, indentationLevel); | ||
return jdoc; | ||
} | ||
|
||
private static String indent(String text, int indentationLevel) { | ||
String indent = " ".repeat(indentationLevel * 4); | ||
return indent + text.replace("\n", "\n" + indent); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.