• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IClassCoverage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jacoco.core.analysis.IClassCoverage的典型用法代码示例。如果您正苦于以下问题:Java IClassCoverage类的具体用法?Java IClassCoverage怎么用?Java IClassCoverage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IClassCoverage类属于org.jacoco.core.analysis包,在下文中一共展示了IClassCoverage类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: resolveMethods

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
private void resolveMethods(final IType type) {
  IClassCoverage classCoverage = (IClassCoverage) getCoverageFor(type);
  if (classCoverage == null) {
    return;
  }
  try {
    MethodLocator locator = new MethodLocator(type);
    for (IMethodCoverage methodCoverage : classCoverage.getMethods()) {
      final IMethod method = locator.findMethod(methodCoverage.getName(),
          methodCoverage.getDesc());
      if (method != null) {
        coveragemap.put(method, methodCoverage);
      } else {
        TRACER
            .trace(
                "Method not found in Java model: {0}.{1}{2}", type.getFullyQualifiedName(), methodCoverage.getName(), methodCoverage.getDesc()); //$NON-NLS-1$
      }
    }
  } catch (JavaModelException e) {
    TRACER.trace("Error while creating method locator for {0}: {1}", type //$NON-NLS-1$
        .getFullyQualifiedName(), e);
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:24,代码来源:JavaModelCoverage.java


示例2: opCodeCoverage

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
@Override
public int opCodeCoverage(CtMethod method, int indexOpcode) {
    IClassCoverage classCoverage = null;
    CtClass cl = method.getDeclaringClass();

    if(classToCover != null && !cl.getName().equals(classToCover)) {
        return 0;
    }

    String name = cl.getName().replace(".","/");

    for (IClassCoverage cc : coverageBuilder.getClasses()) {
        if(name.equals(cc.getName())) {
            classCoverage = cc;
            break;
        }
    }
    if(classCoverage == null)
        return 0;

    MethodInfo mInfo = method.getMethodInfo();
    int line = mInfo.getLineNumber(indexOpcode);

    return classCoverage.getLine(line).getStatus();
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:26,代码来源:CoverageReport.java


示例3: visit

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
public void visit(IType type, String vmname) {
  final IClassCoverage coverage = nodes.getClassCoverage(vmname);
  if (coverage != null) {
    classes.add(coverage);
    modelcoverage.putType(type, coverage);
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:8,代码来源:SessionAnalyzer.java


示例4: AnalyzedNodes

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
AnalyzedNodes(final Collection<IClassCoverage> classes,
    final Collection<ISourceFileCoverage> sourcefiles) {
  this.classmap = new HashMap<String, IClassCoverage>();
  for (final IClassCoverage c : classes) {
    classmap.put(c.getName(), c);
  }
  this.sourcemap = new HashMap<String, ISourceFileCoverage>();
  for (final ISourceFileCoverage s : sourcefiles) {
    final String key = sourceKey(s.getPackageName(), s.getName());
    sourcemap.put(key, s);
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:13,代码来源:AnalyzedNodes.java


示例5: CoverageResults

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
public CoverageResults(CoverageBuilder coverageBuilder) {
	this.coverageBuilder = coverageBuilder;
	final int[] counter = new int[2];
	coverageBuilder.getClasses().stream()
			.map(IClassCoverage::getInstructionCounter)
			.forEach(iCounter -> {
				counter[0] += iCounter.getCoveredCount();
				counter[1] += iCounter.getTotalCount();
			});
	this.instructionsCovered = counter[0];
	this.instructionsTotal = counter[1];
}
 
开发者ID:STAMP-project,项目名称:dspot,代码行数:13,代码来源:CoverageResults.java


示例6: printClassCoverage

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
public void printClassCoverage() {
	Collection<IPackageCoverage> packages = coverage.getPackages();
	for(IPackageCoverage packageCoverage : packages) {
		out.println(packageCoverage.getName() + 
				" ... " + prettyCoverageCount(packageCoverage.getClassCounter()));
		Collection<IClassCoverage> classes = packageCoverage.getClasses();
		for(IClassCoverage classCoverage : classes) {
			out.println("\t" + classCoverage.getName() + 
					" ... " + prettyCoverageCount(classCoverage.getClassCounter()));
		}
	}
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:13,代码来源:CoveragePrettyPrinter.java


示例7: coverage

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
protected double coverage(CtElement operator) {
    CtType<?> cl = operator.getParent(CtType.class);

    if(classToCover != null && !cl.getQualifiedName().equals(classToCover)) {
        return 0d;
    }

    IClassCoverage classCoverage = null;
    if(!(cl == null || cl.getPackage() == null)) {
        String name =  cl.getQualifiedName().replace(".","/");
        for (IClassCoverage cc : coverageBuilder.getClasses()) {
            if(name.equals(cc.getName())) {
                classCoverage = cc;
                break;
            }
        }
    }
    if(classCoverage == null) {
        return 0;
    }

    double ret = 0;
    int start = operator.getPosition().getLine();
    int end = operator.getPosition().getEndLine();
    for (int i = start; i <= end; i++) {
        if (classCoverage.getLine(i).getStatus() == ICounter.FULLY_COVERED) {
            ret++;
        }
    }
    return ret/(double)(end - start + 1);
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:32,代码来源:CoverageReport.java


示例8: positionCoverage

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
@Override
public double positionCoverage(SourcePosition position) {
    CtType<?> cl = position.getCompilationUnit().getMainType();

    if(classToCover != null && !cl.getQualifiedName().equals(classToCover)) {
        return 0d;
    }

    IClassCoverage classCoverage = null;
    if(!(cl == null || cl.getPackage() == null)) {
        String name =  cl.getQualifiedName().replace(".","/");
        for (IClassCoverage cc : coverageBuilder.getClasses()) {
            if(name.equals(cc.getName())) {
                classCoverage = cc;
                break;
            }
        }
    }
    if(classCoverage == null) {
        return 0;
    }

    double ret = 0;
    int start = position.getLine();
    int end = position.getEndLine();
    for (int i = start; i <= end; i++) {
        if (classCoverage.getLine(i).getStatus() == ICounter.FULLY_COVERED) {
            ret++;
        }
    }
    return ret/(double)(end - start + 1);
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:33,代码来源:CoverageReport.java


示例9: analyse

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
public final void analyse(SensorContext context) {

    if (noBinaryDirectoryFound()) {
      J3cLogger.LOGGER.info("No JaCoCo analysis of project coverage can be done since there is no directories with classes.");
      return;
    }

    File jacocoExecutionData = pathResolver.relativeFile(fileSystem.baseDir(), configuration.getReportPath());

    if(noCoverageReportFound(jacocoExecutionData)) {
      J3cLogger.LOGGER.info("No JaCoCo analysis of project coverage found at: " + jacocoExecutionData.getPath());
      return;
    }

    try {
      ExecutionDataStore mergedResults = parseExecutionData(jacocoExecutionData);
      CoverageBuilder coverageBuilder = analyze(mergedResults);

      CoverageComplexityDataSet coverageComplexityDataSet = new CoverageComplexityDataSet();
      for (IClassCoverage classCoverage : coverageBuilder.getClasses()) {
        if (isExcluded(classCoverage) || isNotInScope(classCoverage, context)) {
          continue;
        }
        for (IMethodCoverage methodCoverage : classCoverage.getMethods()) {
          coverageComplexityDataSet.add(methodCoverage);
        }
      }
      saveMeasures(context, coverageComplexityDataSet);

    } catch (Exception e) {
      J3cLogger.LOGGER.error(e.getMessage(), e);
      throw new SonarException(e);
    }
  }
 
开发者ID:cezarcoca,项目名称:sonar-j3c,代码行数:35,代码来源:JacocoAnalyzer.java


示例10: isNotInScope

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
private boolean isNotInScope(IClassCoverage coverage, SensorContext context) {

    Resource resourceInContext = context.getResource(javaResourceLocator.findResourceByClassName(coverage.getName()));

    if (resourceInContext == null || ResourceUtils.isUnitTestClass(resourceInContext)) {
      J3cLogger.LOGGER.info("Not in scope: " + coverage.getName());
      return true;
    }

    return false;
  }
 
开发者ID:cezarcoca,项目名称:sonar-j3c,代码行数:12,代码来源:JacocoAnalyzer.java


示例11: BranchDetailAnalyzer

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
public BranchDetailAnalyzer(final ExecutionDataStore executionData) {
  super(executionData, new ICoverageVisitor() {
    @Override
    public void visitCoverage(IClassCoverage coverage) {
    }
  });

  this.executionData = executionData;
  this.branchDetails = new TreeMap<String, BranchCoverageDetail>();
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:11,代码来源:BranchDetailAnalyzer.java


示例12: setup

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
@Before
public void setup() {
  classes = new ArrayList<IClassCoverage>();
  sourcefiles = new ArrayList<ISourceFileCoverage>();
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:6,代码来源:AnalyzedNodesTest.java


示例13: TypeVisitor

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
TypeVisitor(AnalyzedNodes nodes) {
  this.nodes = nodes;
  this.classes = new HashSet<IClassCoverage>();
  this.sources = new HashSet<ISourceFileCoverage>();
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:6,代码来源:SessionAnalyzer.java


示例14: getClasses

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
Collection<IClassCoverage> getClasses() {
  return classes;
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:4,代码来源:SessionAnalyzer.java


示例15: getClassCoverage

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
IClassCoverage getClassCoverage(final String vmname) {
  return classmap.get(vmname);
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:4,代码来源:AnalyzedNodes.java


示例16: isExcluded

import org.jacoco.core.analysis.IClassCoverage; //导入依赖的package包/类
private boolean isExcluded(IClassCoverage coverage) {
  return excludesMatcher.matches(coverage.getName());
}
 
开发者ID:cezarcoca,项目名称:sonar-j3c,代码行数:4,代码来源:JacocoAnalyzer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TableMetaData类代码示例发布时间:2022-05-23
下一篇:
Java ModelFunctionJacobian类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap