/** * Checks if the documentation of the given document only has a summary. * * @return {@code true} if the documentation of the concept only has a summary, {@code false} otherwise */ private boolean onlyHasSummary(Concept concept) { String doc = concept.getDoc(); if (doc == null) { return true; } int index = doc.indexOf('.'); if (index == -1) { return true; } return index == doc.length() - 1; }
protected void generateDoc(Concept concept) { List<String> lines = new ArrayList<>(); String doc = concept.getDoc(); if (doc != null) { Collections.addAll(lines, doc.split("\n")); } if (!lines.isEmpty()) { javaBuffer.addDocComment(lines); } } }
private String getSummary(Concept concept) { // If there is no documentation then consider it empty: String doc = concept.getDoc(); if (doc == null) { doc = ""; } // The summary is the first sentence of the documentation, or the complete documentation if there is no dot // to end the first sentence. int index = doc.indexOf('.'); if (index != -1) { doc = doc.substring(0, index + 1); } // Apply document fixes, like replacing the forward slash with the id separator: doc = fixDoc(doc); return doc; }
private void addDoc(Concept concept) { // Do nothing if the concept doesn't have documentation: String doc = concept.getDoc(); if (doc == null) { return; } // Apply document fixes, like replacing the forward slash with the id separator: doc = fixDoc(doc); // Split the documentation into lines, and add them to the buffer: List<String> lines = new ArrayList<>(); Collections.addAll(lines, doc.split("\n")); lines.forEach(docBuffer::addLine); docBuffer.addLine(); }
private void writeDoc(Concept concept) { String doc = concept.getDoc(); if (doc != null) { writer.writeElement("doc", doc); String html = htmlGenerator.toHtml(doc); if (html != null) { writer.writeElement("html", html); } } }
/** * Counts the number of items in a concept tha are documented. */ private int countDocuments(Concept concept) { int count = 0; if (concept.getDoc() != null) { count++; } if (concept instanceof StructType) { StructType type = (StructType) concept; count += type.attributes().mapToInt(this::countDocuments).sum(); count += type.links().mapToInt(this::countDocuments).sum(); } else if (concept instanceof EnumType) { EnumType type = (EnumType) concept; count += type.values().mapToInt(this::countDocuments).sum(); } else if (concept instanceof Service) { Service service = (Service) concept; count += service.methods().mapToInt(this::countDocuments).sum(); count += service.locators().mapToInt(this::countDocuments).sum(); } else if (concept instanceof Method) { Method method = (Method) concept; count += method.parameters().mapToInt(this::countDocuments).sum(); } return count; }
private void writeDoc(Concept concept) { String doc = concept.getDoc(); if (doc != null) { writer.write("doc", doc); String html = htmlGenerator.toHtml(doc); if (html != null) { writer.write("html", html); } } }