Examples of Cost


Examples of beans.serializable.Cost

    public void addChangeStatut(final ChangeStatut changeStatut) {
        this.listChangeStatut.add(changeStatut);
    }
    @Override
    public void addCost(final Stat stat, final Integer impact) {
        this.cost.add(new Cost(stat, impact));
    }
View Full Code Here

Examples of com.google.apphosting.api.DatastorePb.Cost

    PutRequestInfo requestInfo;

    public synchronized void postCall(byte[] result) {
      DatastorePb.PutResponse putRequest = new DatastorePb.PutResponse();
      putRequest.mergeFrom(result);
      Cost cost = putRequest.getCost();
      if (requestInfo != null) {
        updateInfo(requestInfo, cost);
        recordInfo(requestInfo);
      }
    }
View Full Code Here

Examples of com.google.test.metric.Cost

    SourceLocation location = new SourceLocation("com/google/FooClass.java", 1);
    final Issue issue =
        new Issue(location, "void doThing()", 0.5f, IssueType.CONSTRUCTION, IssueSubType.SETTER);
    final MethodCost methodCost = new MethodCost("", "void setUp()", 1, false, false, false);
    methodCost.addCostSource(new MethodInvocationCost(location, methodCost,
        Reason.IMPLICIT_SETTER, new Cost(100, 1, new int[0])));

    //TODO: looks like we want IssuesReporter to be an interface
    IssuesReporter issuesReporter = new IssuesReporter(null, null) {
      @Override
      public List<ClassIssues> getMostImportantIssues() {
View Full Code Here

Examples of com.google.test.metric.Cost

  public void test2DeepSupress0Cost() throws Exception {
    DrillDownReportGenerator printer =
      new DrillDownReportGenerator(new PrintStream(out), costModel, null, MAX_VALUE, 2);
    methodCost1.addCostSource(new MethodInvocationCost(new SourceLocation(null, 8), methodCost0,
        NON_OVERRIDABLE_METHOD_CALL, new Cost()));
    methodCost1.addCostSource(new MethodInvocationCost(new SourceLocation(null, 13), methodCost3,
        NON_OVERRIDABLE_METHOD_CALL, Cost.cyclomatic(3)));
    methodCost1.link();
    printer.print("", methodCost1, MAX_VALUE);
    assertStringEquals("c.g.t.A.method1()V [CC: 4 / CC: 1]\n" +
View Full Code Here

Examples of com.google.test.metric.Cost

    DrillDownReportGenerator printer =
      new DrillDownReportGenerator(new PrintStream(out), costModel, null, MAX_VALUE, 0);
    methodCost3.addCostSource(new MethodInvocationCost(new SourceLocation(null, 1), methodCost2,
        NON_OVERRIDABLE_METHOD_CALL, Cost.cyclomatic(2)));
    methodCost2.addCostSource(new MethodInvocationCost(new SourceLocation(null, 2), methodCost2,
        NON_OVERRIDABLE_METHOD_CALL, new Cost()));
    methodCost3.link();
    printer.print("", methodCost3, 10);
    assertStringEquals("c.g.t.A.method3()V [CC: 5 / CC: 3]\n" +
      "  line 1: c.g.t.A.method2()V [CC: 2 / CC: 2] " + NON_OVERRIDABLE_METHOD_CALL + "\n",
      out.toString());
View Full Code Here

Examples of com.google.test.metric.Cost

  private int computeClassWithoutMethod(ClassCost classCost, MethodCost adjustedMethod,
                                        Cost replacementCost) {

    WeightedAverage average = costModel.createWeighedAverage();
    for (MethodCost methodCost : classCost.getMethods()) {
      Cost cost = (adjustedMethod == methodCost ? replacementCost : methodCost.getTotalCost());
      average.addValue(costModel.computeOverall(cost));
    }
    return (int) average.getAverage();
  }
View Full Code Here

Examples of com.google.test.metric.Cost

    return (int) average.getAverage();
  }

  public float computeContributionFromIssue(ClassCost classCost, MethodCost violationMethodCost,
                                            ViolationCost violationCost) {
    Cost adjustedCost = violationMethodCost.getTotalCost().add(violationCost.getCost().negate());
    WeightedAverage average = costModel.createWeighedAverage();
    for (MethodCost methodCost : classCost.getMethods()) {
      Cost cost = (violationMethodCost == methodCost ? adjustedCost : methodCost.getTotalCost());
      average.addValue(costModel.computeOverall(cost));
    }
    return 1 - (int) average.getAverage() / (float) computeClass(classCost);
  }
View Full Code Here

Examples of com.google.test.metric.Cost

      if (model instanceof SimpleNumber) {
        SimpleNumber number = (SimpleNumber) model;
        return "" + number;
      } else if (model instanceof BeanModel) {
        BeanModel arg0 = (BeanModel) model;
        Cost cost = (Cost) arg0.getAdaptedObject(Cost.class);
        return "Cost: " + costModel.computeOverall(cost) + " [" + cost + "]";
      } else {
        throw new IllegalStateException();
      }
    }
View Full Code Here

Examples of com.google.test.metric.Cost

      if (model instanceof SimpleNumber) {
        SimpleNumber number = (SimpleNumber) model;
        return number;
      } else if (model instanceof BeanModel) {
        BeanModel arg0 = (BeanModel) model;
        Cost cost = (Cost) arg0.getAdaptedObject(Cost.class);
        return costModel.computeOverall(cost);
      } else {
        throw new IllegalStateException();
      }
    }
View Full Code Here

Examples of com.volantis.mcs.dissection.annotation.Cost

     * @return A {@link Cost} object that can be used to calculate shard
     * related costs.
     */
    public Cost getTemporaryShardCost() {
        if (temporaryShardCost == null) {
            temporaryShardCost = new Cost("Shard", sharedContentUsages, true);
        } else {
            temporaryShardCost.resetTotal();
        }
        return temporaryShardCost;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.