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

Java ICounter类代码示例

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

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



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

示例1: createAnnotations

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
private void createAnnotations(final ISourceNode linecoverage) {
  AnnotationModelEvent event = new AnnotationModelEvent(this);
  clear(event);
  final int firstline = linecoverage.getFirstLine();
  final int lastline = Math.min(linecoverage.getLastLine(),
      document.getNumberOfLines());
  try {
    for (int l = firstline; l <= lastline; l++) {
      final ILine line = linecoverage.getLine(l);
      if (line.getStatus() != ICounter.EMPTY) {
        final IRegion region = document.getLineInformation(l - 1);
        final CoverageAnnotation ca = new CoverageAnnotation(
            region.getOffset(), region.getLength(), line);
        annotations.add(ca);
        event.annotationAdded(ca);
      }
    }
  } catch (BadLocationException ex) {
    EclEmmaUIPlugin.log(ex);
  }
  fireModelChanged(event);
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:23,代码来源:CoverageAnnotationModel.java


示例2: getText

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
@Override
public String getText() {
  final ICounter branches = line.getBranchCounter();
  switch (branches.getStatus()) {
  case ICounter.NOT_COVERED:
    return NLS.bind(UIMessages.AnnotationTextAllBranchesMissed_message,
        Integer.valueOf(branches.getMissedCount()));
  case ICounter.FULLY_COVERED:
    return NLS.bind(UIMessages.AnnotationTextAllBranchesCovered_message,
        Integer.valueOf(branches.getTotalCount()));
  case ICounter.PARTLY_COVERED:
    return NLS.bind(UIMessages.AnnotationTextSomeBranchesMissed_message,
        Integer.valueOf(branches.getMissedCount()),
        Integer.valueOf(branches.getTotalCount()));
  default:
    return null;
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:19,代码来源:CoverageAnnotation.java


示例3: print_counters

import org.jacoco.core.analysis.ICounter; //导入依赖的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());

}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:21,代码来源:ExecAnalyze.java


示例4: getCoverableStmts

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
public boolean[] getCoverableStmts() {
	int testsNum = this.getTestCount();
	if(testsNum == 0) return new boolean[0];

	int[] test = this.testStmtMatrix.get(0);

	int[] decodedCoverge = null;
	if(format == LineCoverageFormat.DENSE) {
		decodedCoverge = decodeDense(test); 
	} else {
		decodedCoverge = decodeCompact(test);
	}

	boolean[] stmts = new boolean[decodedCoverge.length];
	for(int i = 0; i < decodedCoverge.length; i += 1) {
		int coverageStatus = decodedCoverge[i];
		if(coverageStatus == ICounter.EMPTY) {
			stmts[i] = false;
		} else {
			stmts[i] = true;
		}
	}

	return stmts;
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:26,代码来源:CoverageMatrix.java


示例5: createCoverageVectors

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
boolean[] createCoverageVectors(int[] coverage, LineCoverageFormat format) {
	int[] decodedCoverge = null;
	if(format == LineCoverageFormat.DENSE) {
		decodedCoverge = decodeDense(coverage); 
	} else {
		decodedCoverge = decodeCompact(coverage);
	}

	int sourcesize = source.getRealLineCount();
	boolean[] stmts = new boolean[sourcesize];
	for(int i = 0; i < sourcesize; i += 1) {
		int coverageStatus = decodedCoverge[i];
		if(coverageStatus== ICounter.FULLY_COVERED
				|| coverageStatus == ICounter.PARTLY_COVERED) {
			stmts[i] = true;
		} else {
			stmts[i] = false;
		}
	}
	return stmts;
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:22,代码来源:SourceSpecificCoverageMatrix.java


示例6: findCoverableStmts

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
boolean[] findCoverableStmts(
		int[] coverage, LineCoverageFormat format, int length) {
	int[] decodedCoverge = null;
	if(format == LineCoverageFormat.DENSE) {
		decodedCoverge = decodeDense(coverage); 
	} else {
		decodedCoverge = decodeCompact(coverage);
	}

	boolean[] stmts = new boolean[length];
	for(int i = 0; i < length; i += 1) {
		int coverageStatus = decodedCoverge[i];
		if(coverageStatus == ICounter.EMPTY) {
			stmts[i] = false;
		} else {
			stmts[i] = true;
		}
	}
	return stmts;
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:21,代码来源:SourceSpecificCoverageMatrix.java


示例7: data

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
@Parameters
  public static Collection<Object[]> data() {
    ArrayList<Object[]> tests = new ArrayList<>();
    
    tests.add(new Object[] { 0,0,0,0, ICounter.EMPTY });
//    tests.add(new Object[] { 0,0,0,1, ICounter.EMPTY });
//    tests.add(new Object[] { 0,0,1,0, ICounter.EMPTY });
//    tests.add(new Object[] { 0,0,1,1, ICounter.EMPTY });
    tests.add(new Object[] { 0,1,0,0, ICounter.NOT_COVERED });
    tests.add(new Object[] { 0,1,0,1, ICounter.NOT_COVERED });
//    tests.add(new Object[] { 0,1,1,0, ICounter.EMPTY });
//    tests.add(new Object[] { 0,1,1,1, ICounter.PARTLY_COVERED });
    tests.add(new Object[] { 1,0,0,0, ICounter.FULLY_COVERED });
    tests.add(new Object[] { 1,0,0,1, ICounter.PARTLY_COVERED });
    tests.add(new Object[] { 1,0,1,0, ICounter.FULLY_COVERED });
    tests.add(new Object[] { 1,0,1,1, ICounter.PARTLY_COVERED });
    tests.add(new Object[] { 1,1,0,0, ICounter.PARTLY_COVERED });
    tests.add(new Object[] { 1,1,0,1, ICounter.PARTLY_COVERED });
    tests.add(new Object[] { 1,1,1,0, ICounter.PARTLY_COVERED });
    tests.add(new Object[] { 1,1,1,1, ICounter.PARTLY_COVERED });

    return tests;
  }
 
开发者ID:spideruci,项目名称:tacoco,代码行数:24,代码来源:TestCountersToStatus.java


示例8: decorate

import org.jacoco.core.analysis.ICounter; //导入依赖的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())));
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:15,代码来源:CoverageDecorator.java


示例9: getImageDescriptorId

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
public String getImageDescriptorId(Annotation annotation) {
  if (annotation instanceof CoverageAnnotation) {
    final ICounter branches = ((CoverageAnnotation) annotation).getLine()
        .getBranchCounter();
    switch (branches.getStatus()) {
    case ICounter.FULLY_COVERED:
      return EclEmmaUIPlugin.OBJ_MARKERFULL;
    case ICounter.PARTLY_COVERED:
      return EclEmmaUIPlugin.OBJ_MARKERPARTIAL;
    case ICounter.NOT_COVERED:
      return EclEmmaUIPlugin.OBJ_MARKERNO;
    }
  }
  return null;
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:16,代码来源:CoverageAnnotationImageProvider.java


示例10: getAnnotationID

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
private static String getAnnotationID(ILine line) {
  switch (line.getStatus()) {
  case ICounter.FULLY_COVERED:
    return FULL_COVERAGE;
  case ICounter.PARTLY_COVERED:
    return PARTIAL_COVERAGE;
  case ICounter.NOT_COVERED:
    return NO_COVERAGE;
  }
  throw new AssertionError(line.getStatus());
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:12,代码来源:CoverageAnnotation.java


示例11: draw

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
public static void draw(Event event, int columnWith, ICounter counter,
    int maxTotal) {
  if (maxTotal == 0) {
    return;
  }
  final int maxWidth = getMaxWidth(event, columnWith);
  final int redLength = maxWidth * counter.getMissedCount() / maxTotal;
  bar(event, EclEmmaUIPlugin.DGM_REDBAR, 0, redLength);
  final int greenLength = maxWidth * counter.getCoveredCount() / maxTotal;
  bar(event, EclEmmaUIPlugin.DGM_GREENBAR, redLength, greenLength);
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:12,代码来源:RedGreenBar.java


示例12: getRatio

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
String getRatio(Object element) {
  ICounter counter = getCounter(element);
  if (counter.getTotalCount() == 0) {
    return ""; //$NON-NLS-1$
  } else {
    return COVERAGE_VALUE.format(counter.getCoveredRatio());
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:9,代码来源:CellTextConverter.java


示例13: compare

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
  CounterEntity counters = settings.getCounters();
  ICounter c1 = CoverageTools.getCoverageInfo(e1).getCounter(counters);
  ICounter c2 = CoverageTools.getCoverageInfo(e2).getCounter(counters);
  int res = 0;
  switch (settings.getSortColumn()) {
  case CoverageView.COLUMN_ELEMENT:
    res = elementsorter.compare(viewer, e1, e2);
    break;
  case CoverageView.COLUMN_RATIO:
    res = Double.compare(c1.getCoveredRatio(), c2.getCoveredRatio());
    break;
  case CoverageView.COLUMN_COVERED:
    res = (int) (c1.getCoveredCount() - c2.getCoveredCount());
    break;
  case CoverageView.COLUMN_MISSED:
    res = (int) (c1.getMissedCount() - c2.getMissedCount());
    break;
  case CoverageView.COLUMN_TOTAL:
    res = (int) (c1.getTotalCount() - c2.getTotalCount());
    break;
  }
  if (res == 0) {
    res = elementsorter.compare(viewer, e1, e2);
  } else {
    res = settings.isReverseSort() ? -res : res;
  }
  return res;
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:31,代码来源:CoverageViewSorter.java


示例14: encode

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
public int encode(ILine lineCoverage) {
	ICounter insnCounter = lineCoverage.getInstructionCounter();
	int ic = insnCounter.getCoveredCount();
	int im = insnCounter.getMissedCount();
	ICounter branchCounter = lineCoverage.getBranchCounter();
	int bc = branchCounter.getCoveredCount();
	int bm = branchCounter.getMissedCount();

	int code = encode(ic, im, bc, bm); 
	return code;
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:12,代码来源:LineCoverageCoder.java


示例15: toStatus

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
public int toStatus(int[] counters) {
	int bm = counters[3];
	int bc = counters[2];
	int im = counters[1];
	int ic = counters[0];
	ICounter insnCounter = CounterImpl.getInstance(im, ic);
	ICounter branchCounter = CounterImpl.getInstance(bm, bc);
	return insnCounter.getStatus() | branchCounter.getStatus();
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:10,代码来源:LineCoverageCoder.java


示例16: print_source_counter_verbose

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
public static void print_source_counter_verbose(ISourceNode source)
{
	int firstLine = source.getFirstLine();
	int lastLine = source.getLastLine();
	System.out.printf("%18s: %s\n", "First Line", firstLine);
	System.out.printf("%18s: %s\n", "Last Line", lastLine);
	for(int i = firstLine; i <= lastLine; i++)
	{
		ILine line = source.getLine(i);
		ICounter instructionCounter = line.getInstructionCounter();
		int status = instructionCounter.getStatus();
		if(status != ICounter.EMPTY)
		{
			String status_string = "";
			switch(status)
			{
				case ICounter.NOT_COVERED:
					status_string = "NOT_COVERED";
					break;
				case ICounter.FULLY_COVERED:
					status_string = "FULLY_COVERED";
					break;
				case ICounter.PARTLY_COVERED:
					status_string = "PARTLY_COVERED";
					break;
				default:
			}
			System.out.printf("%18s: %6s (%s)\n", "Line "+i, instructionCounter.getCoveredCount() + "/" + instructionCounter.getTotalCount(), status_string);
		}
	}
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:32,代码来源:ExecAnalyze.java


示例17: lineStatusString

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
private String lineStatusString(int lineStatus) {
	switch(lineStatus) {
	case ICounter.EMPTY: return "EMPTY";
	case ICounter.NOT_COVERED: return "NOT COVERED";
	case ICounter.PARTLY_COVERED: return "PARTLY COVERED";
	case ICounter.FULLY_COVERED: return "FULLY COVERED";
	default: return "UNKNOWN STATUS";
	}
}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:10,代码来源:CoveragePrettyPrinter.java


示例18: coverage

import org.jacoco.core.analysis.ICounter; //导入依赖的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


示例19: positionCoverage

import org.jacoco.core.analysis.ICounter; //导入依赖的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


示例20: build

import org.jacoco.core.analysis.ICounter; //导入依赖的package包/类
public IMethodCoverage build() {
  IMethodCoverage methodMock = mock(IMethodCoverage.class);
  ICounter counterMock = mock(ICounter.class);
  when(methodMock.getComplexityCounter()).thenReturn(counterMock);
  when(counterMock.getTotalCount()).thenReturn(complexity);
  when(counterMock.getCoveredRatio()).thenReturn(coverageRatio);

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java DLOAD类代码示例发布时间:2022-05-23
下一篇:
Java ArArchiveEntry类代码示例发布时间: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