本文整理汇总了Java中org.jacoco.core.analysis.ICoverageNode类的典型用法代码示例。如果您正苦于以下问题:Java ICoverageNode类的具体用法?Java ICoverageNode怎么用?Java ICoverageNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ICoverageNode类属于org.jacoco.core.analysis包,在下文中一共展示了ICoverageNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLines
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
private Line[] getLines() {
ICoverageNode c = CoverageTools.getCoverageInfo(getElement());
if (c == null) {
return new Line[0];
} else {
return new Line[] {
new Line(UIMessages.CoveragePropertyPageInstructions_label,
c.getInstructionCounter()),
new Line(UIMessages.CoveragePropertyPageBranches_label,
c.getBranchCounter()),
new Line(UIMessages.CoveragePropertyPageLines_label,
c.getLineCounter()),
new Line(UIMessages.CoveragePropertyPageMethods_label,
c.getMethodCounter()),
new Line(UIMessages.CoveragePropertyPageTypes_label,
c.getClassCounter()),
new Line(UIMessages.CoveragePropertyPageComplexity_label,
c.getComplexityCounter()) };
}
}
示例2: getAdapter
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
public Object getAdapter(Object object,
@SuppressWarnings("rawtypes") Class adapterType) {
// if the object is a IResource find the corresponding IJavaElement
if (object instanceof IResource) {
object = ((IResource) object).getAdapter(IJavaElement.class);
if (object == null) {
return null;
}
}
// then find the coverage information from the current session
IJavaModelCoverage mc = CoverageTools.getJavaModelCoverage();
if (mc == null) {
return null;
} else {
ICoverageNode coverage = mc.getCoverageFor((IJavaElement) object);
if (adapterType.isInstance(coverage)) {
return coverage;
} else {
return null;
}
}
}
示例3: print_counters
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
public static void print_counters(ICoverageNode node)
{
String name = node.getName();
ICounter lineCounter = node.getLineCounter();
ICounter instructionCounter = node.getInstructionCounter();
ICounter classCounter = node.getClassCounter();
ICounter methodCounter = node.getMethodCounter();
ICounter branchCounter = node.getBranchCounter();
ICounter complexityCounter = node.getComplexityCounter();
System.out.printf("%18s: %s\n", "ICoverageNode name", name);
System.out.printf("%18s: %s\n", "lineCounter", lineCounter.getCoveredCount() + "/" + lineCounter.getTotalCount());
System.out.printf("%18s: %s\n", "instructionCounter", instructionCounter.getCoveredCount() + "/" + instructionCounter.getTotalCount());
System.out.printf("%18s: %s\n", "classCounter", classCounter.getCoveredCount() + "/" + classCounter.getTotalCount());
System.out.printf("%18s: %s\n", "methodCounter", methodCounter.getCoveredCount() + "/" + methodCounter.getTotalCount());
System.out.printf("%18s: %s\n", "branchCounter", branchCounter.getCoveredCount() + "/" + branchCounter.getTotalCount());
System.out.printf("%18s: %s\n", "complexityCounter", complexityCounter.getCoveredCount() + "/" + complexityCounter.getTotalCount());
}
示例4: decorate
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
public void decorate(Object element, IDecoration decoration) {
final ICoverageNode coverage = CoverageTools.getCoverageInfo(element);
if (coverage == null) {
// no coverage data
return;
}
// TODO obtain counter from preferences
ICounter counter = coverage.getInstructionCounter();
ImageDescriptor overlay = EclEmmaUIPlugin.getCoverageOverlay(counter
.getCoveredRatio());
decoration.addOverlay(overlay, IDecoration.TOP_LEFT);
decoration.addSuffix(SUFFIX_FORMAT.format(Double.valueOf(counter
.getCoveredRatio())));
}
示例5: findSourceCoverageForElement
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
private ISourceNode findSourceCoverageForElement(Object element) {
// Do we have a coverage info for the editor input?
ICoverageNode coverage = CoverageTools.getCoverageInfo(element);
if (coverage instanceof ISourceNode) {
return (ISourceNode) coverage;
}
return null;
}
示例6: calculateMaxTotal
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
private int calculateMaxTotal(IJavaElement parent) {
int max = 0;
for (Object sibling : contentProvider.getChildren(parent)) {
final ICoverageNode coverage = CoverageTools.getCoverageInfo(sibling);
if (coverage != null) {
max = Math.max(max, coverage.getCounter(settings.getCounters())
.getTotalCount());
}
}
return max;
}
示例7: getCoverageFor
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
public ICoverageNode getCoverageFor(IJavaElement element) {
final ICoverageNode coverage = coveragemap.get(element);
if (coverage != null) {
return coverage;
}
if (IJavaElement.METHOD == element.getElementType()) {
resolveMethods((IType) element.getParent());
return coveragemap.get(element);
}
return null;
}
示例8: getCoverageInfo
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
/**
* Convenience method that tries to adapt the given object to ICoverageNode,
* i.e. find coverage information from the active session.
*
* @param object
* Object to adapt
* @return adapter or <code>null</code>
*/
public static ICoverageNode getCoverageInfo(Object object) {
if (object instanceof IAdaptable) {
return (ICoverageNode) ((IAdaptable) object)
.getAdapter(ICoverageNode.class);
} else {
return null;
}
}
示例9: putFragment
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
public void putFragment(IPackageFragment element, ICoverageNode coverage) {
coveragemap.put(element, coverage);
fragments.add(element);
}
示例10: putType
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
public void putType(IType element, ICoverageNode coverage) {
coveragemap.put(element, coverage);
types.add(element);
}
示例11: putClassFile
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
public void putClassFile(IClassFile element, ICoverageNode coverage) {
coveragemap.put(element, coverage);
}
示例12: putCompilationUnit
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
public void putCompilationUnit(ICompilationUnit element,
ICoverageNode coverage) {
coveragemap.put(element, coverage);
}
示例13: getAdapterList
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
public Class<?>[] getAdapterList() {
return new Class[] { ICoverageNode.class, ISourceNode.class };
}
示例14: getPlainCopy
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
public ICoverageNode getPlainCopy() {
return this;
}
示例15: getCoverageFor
import org.jacoco.core.analysis.ICoverageNode; //导入依赖的package包/类
public ICoverageNode getCoverageFor(IJavaElement element) {
return null;
}