当前位置: 首页>>代码示例>>Java>>正文


Java Comment.getLength方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.Comment.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java Comment.getLength方法的具体用法?Java Comment.getLength怎么用?Java Comment.getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.dom.Comment的用法示例。


在下文中一共展示了Comment.getLength方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doComments

import org.eclipse.jdt.core.dom.Comment; //导入方法依赖的package包/类
private void doComments(ASTNode node, boolean post) {
	Comment c = comments.peek();

	while (c != null && c.getStartPosition() > endOfLastNode) {
		int startOfNextNode = post ? siblingOrParentPosition(node) 
				 				   : node.getStartPosition();

		if (c.getStartPosition() + c.getLength() < startOfNextNode) {
			comments.remove().accept(this);
			c = comments.peek();
		} else {
			break;
		}
	}
	endOfLastNode = node.getStartPosition() + node.getLength();
}
 
开发者ID:mrmonday,项目名称:j2d,代码行数:17,代码来源:J2dVisitor.java

示例2: getNewUnitSource

import org.eclipse.jdt.core.dom.Comment; //导入方法依赖的package包/类
/**
 * Gets compilation unit's source
 *
 * @param unit
 *            affected compilation unit
 * @param comment
 *            comment to be replaced; set null if comment is not present
 * @return new compilation unit's source
 */
private String getNewUnitSource(final ICompilationUnit unit, final Comment comment) {
	String source = null;
	try {
		source = unit.getSource();
		if (comment != null) {
			final int endOfComment = comment.getLength() + comment.getStartPosition();
			source = source.replace(source.substring(0, endOfComment), getCopyrightText());
		}
	} catch (final JavaModelException e) {
		ConsoleUtils.printError(e.getMessage());
	}
	return source;
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:23,代码来源:CopyrightManager.java

示例3: extractCommentItem

import org.eclipse.jdt.core.dom.Comment; //导入方法依赖的package包/类
private final CommentItem extractCommentItem(final int index) {
    if (commentsVisited[index]) {
        return null;
    } else {
        final Comment comment = (Comment) comments.get(index);
        if (comment.isDocComment()) {
            /* Interpret DocComment as Line or Block */
            comment.delete();
        }
        final int start = comment.getStartPosition();
        final int end = start + comment.getLength();
        final String value = this.src.substring(start, end);
        return new CommentItem(comment, value);
    }
}
 
开发者ID:boalang,项目名称:compiler,代码行数:16,代码来源:UglyMathCommentsExtractor.java

示例4: getNodeFirstLeadingCommentIndex

import org.eclipse.jdt.core.dom.Comment; //导入方法依赖的package包/类
private final int getNodeFirstLeadingCommentIndex(final ASTNode node) {
    if (node instanceof PackageDeclaration) {
        if (commentsVisited.length > 0) {
            final Comment comment = (Comment) comments.get(0);
            if (comment.getStartPosition() + comment.getLength() <= ((PackageDeclaration) node).getName()
                    .getStartPosition()) {
                return 0;
            }
        }
        return -1;
    } else {
        return cu.firstLeadingCommentIndex(node);
    }
}
 
开发者ID:boalang,项目名称:compiler,代码行数:15,代码来源:UglyMathCommentsExtractor.java

示例5: getCommentContent

import org.eclipse.jdt.core.dom.Comment; //导入方法依赖的package包/类
/** Extract comment content from source. */
private String getCommentContent(Comment comment) {
   int start = comment.getStartPosition();
   int end = start + comment.getLength();
   String content = routeSource.substring(start, end);
   if (content.startsWith("//")) {
      content = content.substring(2).trim();
   }
   return content;
}
 
开发者ID:lbroudoux,项目名称:eip-designer,代码行数:11,代码来源:CamelJavaFileParser.java


注:本文中的org.eclipse.jdt.core.dom.Comment.getLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。