1 2 12 package com.versant.core.metric; 13 14 18 public class SumMetric extends DerivedMetric { 19 20 private Metric metricA; 21 private Metric metricB; 22 23 public SumMetric(String name, String displayName, String category, 24 String descr, Metric[] args) { 25 this(name, displayName, category, descr, args[0], args[1]); 26 } 27 28 public SumMetric(String name, String displayName, String category, String descr, 29 Metric metricA, Metric metricB) { 30 super(name, displayName, category, descr, metricA.getDecimals()); 31 this.metricA = metricA; 32 this.metricB = metricB; 33 } 34 35 39 public int getArgCount() { 40 return 2; 41 } 42 43 51 public double get(MetricDataSource dataSet, int firstSampleNo, int lastSampleNo, 52 int calc, double seconds) { 53 return metricA.get(dataSet, firstSampleNo, lastSampleNo, calc, seconds) 54 + metricB.get(dataSet, firstSampleNo, lastSampleNo, calc, seconds); 55 } 56 57 60 public int getDefaultCalc() { 61 return metricA.getDefaultCalc(); 62 } 63 64 } 65 66 | Popular Tags |