1 2 12 package com.versant.core.metric; 13 14 import java.io.Serializable ; 15 16 19 public abstract class Metric implements Serializable , Comparable { 20 21 private final String name; 22 private final String displayName; 23 private final String category; 24 private final String descr; 25 private final int decimals; 26 27 public static final int CALC_RAW = 1; 28 public static final int CALC_AVERAGE = 2; 29 public static final int CALC_DELTA = 3; 30 public static final int CALC_DELTA_PER_SECOND = 4; 31 32 public Metric(String name, String displayName, String category, String descr, 33 int decimals) { 34 this.name = name; 35 this.displayName = displayName; 36 this.category = category; 37 this.descr = descr; 38 this.decimals = decimals; 39 } 40 41 public String getName() { 42 return name; 43 } 44 45 public String getDisplayName() { 46 return displayName; 47 } 48 49 public String getCategory() { 50 return category; 51 } 52 53 public String getDescr() { 54 return descr; 55 } 56 57 public int getDecimals() { 58 return decimals; 59 } 60 61 public String toString() { 62 return name; 63 } 64 65 68 public abstract int getDefaultCalc(); 69 70 78 public abstract double get(MetricDataSource dataSet, int firstSampleNo, 79 int lastSampleNo, int calc, double seconds); 80 81 84 public int compareTo(Object o) { 85 return getName().compareTo(((Metric)o).getName()); 86 } 87 88 } 89 | Popular Tags |