PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/testability-explorer/src/main/java/com/google/test/metric/report/ClassReport.java

http://testability-explorer.googlecode.com/
Java | 67 lines | 38 code | 14 blank | 15 comment | 0 complexity | 6553ff71e616c36f3af6c7e686154e74 MD5 | raw file
 1/*
 2 * Copyright 2007 Google Inc.
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 5 * use this file except in compliance with the License. You may obtain a copy of
 6 * the License at
 7 *
 8 * http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16package com.google.test.metric.report;
17
18import com.google.test.metric.Cost;
19import com.google.test.metric.WeightedAverage;
20
21
22public class ClassReport extends SummaryGraphReport<ClassReport.MethodUnit> {
23
24  public static class MethodUnit extends SummaryGraphReport.Unit {
25
26    private final int lineNumber;
27    private final Cost totalCost;
28    private final Cost directCost;
29
30    public MethodUnit(String methodName, int lineNumber, Cost totalCost,
31        Cost directCost, int overallCost) {
32      super(methodName, overallCost);
33      this.lineNumber = lineNumber;
34      this.totalCost = totalCost;
35      this.directCost = directCost;
36    }
37
38    public int getLineNumber() {
39      return lineNumber;
40    }
41
42    public Cost getTotalCost() {
43      return totalCost;
44    }
45
46    public Cost getDirectCost() {
47      return directCost;
48    }
49  }
50
51  private final Source source;
52
53  public ClassReport(String name, Source source, GradeCategories grades, WeightedAverage average) {
54    super(name, grades, average);
55    this.source = source;
56  }
57
58  public Source getSource() {
59    return source;
60  }
61
62  public void addMethod(String methodName, int lineNumber,
63      int overallCost, Cost totalCost, Cost directCost) {
64    addUnit(new MethodUnit(methodName, lineNumber, totalCost, directCost, overallCost));
65  }
66
67}