1 11 package org.eclipse.test.internal.performance.data; 12 13 import java.util.Map ; 14 import java.util.Set ; 15 16 import org.eclipse.test.performance.Dimension; 17 18 import junit.framework.Assert; 19 20 23 public class Sample { 24 String fScenarioID; 25 long fStartTime; 26 Map fProperties; 27 DataPoint[] fDataPoints; 28 29 boolean fIsSummary; 30 boolean fSummaryIsGlobal; 31 String fShortName; 32 Dimension[] fSummaryDimensions; 33 int fCommentType; 34 String fComment; 35 36 37 public Sample(String scenarioID, long starttime, Map properties, DataPoint[] dataPoints) { 38 Assert.assertTrue("scenarioID is null", scenarioID != null); fScenarioID= scenarioID; 40 fStartTime= starttime; 41 fProperties= properties; 42 fDataPoints= dataPoints; 43 } 44 45 public Sample(DataPoint[] dataPoints) { 46 fDataPoints= dataPoints; 47 } 48 49 public void tagAsSummary(boolean global, String shortName, Dimension[] summaryDimensions, int commentType, String comment) { 50 fIsSummary= true; 51 fSummaryIsGlobal= global; 52 fShortName= shortName; 53 fSummaryDimensions= summaryDimensions; 54 fCommentType= commentType; 55 fComment= comment; 56 } 57 58 public String getScenarioID() { 59 return fScenarioID; 60 } 61 62 public long getStartTime() { 63 return fStartTime; 64 } 65 66 public String getProperty(String name) { 67 return (String ) fProperties.get(name); 68 } 69 70 public String [] getPropertyKeys() { 71 if (fProperties == null) 72 return new String [0]; 73 Set set= fProperties.keySet(); 74 return (String []) set.toArray(new String [set.size()]); 75 } 76 77 public DataPoint[] getDataPoints() { 78 DataPoint[] dataPoints= new DataPoint[fDataPoints.length]; 79 System.arraycopy(fDataPoints, 0, dataPoints, 0, fDataPoints.length); 80 return dataPoints; 81 } 82 83 public String toString() { 84 return "MeteringSession [scenarioID= " + fScenarioID + ", #datapoints: " + fDataPoints.length + "]"; } 86 87 public boolean isSummary() { 88 return fIsSummary; 89 } 90 91 public boolean isGlobal() { 92 return fSummaryIsGlobal; 93 } 94 95 public String getShortname() { 96 return fShortName; 97 } 98 99 public Dimension[] getSummaryDimensions() { 100 return fSummaryDimensions; 101 } 102 103 public int getCommentType() { 104 return fCommentType; 105 } 106 107 public String getComment() { 108 return fComment; 109 } 110 } 111 | Popular Tags |