Java Code Examples for org.eclipse.jdt.core.dom.ASTNode#JAVADOC
The following examples show how to use
org.eclipse.jdt.core.dom.ASTNode#JAVADOC .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ASTVisitors.java From tassal with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void preVisit(final ASTNode node) { // If node is a foldableType add node to foldableStack and // add fold to allFolds if (foldableTypes.contains(node.getNodeType())) { final FoldableNode fn = tree.new FoldableNode(node); // If node is also a javadoc, add its range to javadocFolds // along with first line of javadoc comment if (node.getNodeType() == ASTNode.JAVADOC) { final Javadoc jdoc = (Javadoc) node; String firstTagLine = ""; if (!jdoc.tags().isEmpty()) { // Handle empty comment final String firstTag = ((TagElement) jdoc.tags().get(0)).toString(); firstTagLine = firstTag.split("\n")[1].substring(2); // If tokenizing comments add javadoc tokens to tree if (tokenizeComments) fn.addTerms(tokenizeCommentString(firstTag)); } javadocFolds.put(fn.getRange(), firstTagLine); } foldableStack.push(fn); allFolds.add(fn.getRange()); } }
Example 2
Source File: Checks.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static boolean isInsideJavadoc(ASTNode node) { do { if (node.getNodeType() == ASTNode.JAVADOC) return true; node= node.getParent(); } while (node != null); return false; }
Example 3
Source File: UnfoldAlgorithms.java From tassal with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override protected FoldableNode getBestNode(final HashMap<FoldableNode, Option> options, final double budget, final boolean debug) { int maxScore = Integer.MIN_VALUE; FoldableNode bestNode = null; // For every *folded* FoldableNode for (final FoldableNode fn : options.keySet()) { if (!fn.isUnfolded()) { // Get cost final int cost = options.get(fn).cost; // Get parent node final ASTNode parentNode = fn.node.getParent(); // Get score (2 - javadoc, 0 - method, 1 - o/w) int score = Integer.MIN_VALUE; if (cost <= budget) { if (fn.node.getNodeType() == ASTNode.JAVADOC) score = 2; else if (parentNode == null) // parent is root node score = 1; else if (parentNode.getNodeType() == ASTNode.METHOD_DECLARATION) score = 0; else score = 1; } // Set profit (for counting ties) // options.get(fn).profit = score; // Print node cost stats if (debug) System.out.println( "\n+++++ Node: " + fn + "Cost: " + cost + " Budget: " + budget + " score: " + score); // Set bestNode as node with max score if (score > maxScore) { maxScore = score; bestNode = fn; } } } // countRandomlyBrokenTies(options, bestNode, maxScore); // Print out bestNode and stats if (debug && bestNode != null) System.out.println("\n+=+=+ bestNode " + bestNode.printRange() + ", cost: " + options.get(bestNode).cost + " score: " + maxScore); return bestNode; }