/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. */
  16. package com.google.test.metric.report;
  17. import com.google.test.metric.Cost;
  18. import com.google.test.metric.WeightedAverage;
  19. public class ClassReport extends SummaryGraphReport<ClassReport.MethodUnit> {
  20. public static class MethodUnit extends SummaryGraphReport.Unit {
  21. private final int lineNumber;
  22. private final Cost totalCost;
  23. private final Cost directCost;
  24. public MethodUnit(String methodName, int lineNumber, Cost totalCost,
  25. Cost directCost, int overallCost) {
  26. super(methodName, overallCost);
  27. this.lineNumber = lineNumber;
  28. this.totalCost = totalCost;
  29. this.directCost = directCost;
  30. }
  31. public int getLineNumber() {
  32. return lineNumber;
  33. }
  34. public Cost getTotalCost() {
  35. return totalCost;
  36. }
  37. public Cost getDirectCost() {
  38. return directCost;
  39. }
  40. }
  41. private final Source source;
  42. public ClassReport(String name, Source source, GradeCategories grades, WeightedAverage average) {
  43. super(name, grades, average);
  44. this.source = source;
  45. }
  46. public Source getSource() {
  47. return source;
  48. }
  49. public void addMethod(String methodName, int lineNumber,
  50. int overallCost, Cost totalCost, Cost directCost) {
  51. addUnit(new MethodUnit(methodName, lineNumber, totalCost, directCost, overallCost));
  52. }
  53. }