1 /******************************************************************************* 2 * Copyright (c) 2000, 2009 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.test.internal.performance.results.model; 12 13 import java.util.Vector; 14 15 import org.eclipse.ui.views.properties.IPropertyDescriptor; 16 import org.eclipse.ui.views.properties.TextPropertyDescriptor; 17 18 public class BuildResultsProperties { 19 20 // Property descriptors 21 static final String P_ID_SMALL_VALUE = "BuildResultsProperties.small_value"; //$NON-NLS-1$ 22 static final String P_ID_NO_BASELINE = "BuildResultsProperties.no_baseline"; //$NON-NLS-1$ 23 static final String P_ID_SINGLE_RUN = "BuildResultsProperties.single_run"; //$NON-NLS-1$ 24 static final String P_ID_BIG_ERROR = "BuildResultsProperties.big_error"; //$NON-NLS-1$ 25 static final String P_ID_STUDENT_TTEST = "BuildResultsProperties.ttest"; //$NON-NLS-1$ 26 static final String P_ID_NOT_STABLE = "BuildResultsProperties.not_stable"; //$NON-NLS-1$ 27 static final String P_ID_NOT_RELIABLE = "BuildResultsProperties.not_reliable"; //$NON-NLS-1$ 28 static final String P_ID_BIG_DELTA = "BuildResultsProperties.big_delta"; //$NON-NLS-1$ 29 static final String P_STR_SMALL_VALUE = "small value"; //$NON-NLS-1$ 30 static final String P_STR_NO_BASELINE = "no baseline"; //$NON-NLS-1$ 31 static final String P_STR_SINGLE_RUN = "single run"; //$NON-NLS-1$ 32 static final String P_STR_BIG_ERROR = "big error"; //$NON-NLS-1$ 33 static final String P_STR_STUDENT_TTEST = "student ttest"; //$NON-NLS-1$ 34 static final String P_STR_NOT_STABLE = "not stable"; //$NON-NLS-1$ 35 static final String P_STR_NOT_RELIABLE = "not reliable"; //$NON-NLS-1$ 36 static final String P_STR_BIG_DELTA = "delta error"; //$NON-NLS-1$ 37 private static Vector descriptors; 38 static { 39 descriptors = new Vector(); 40 descriptors.addElement(new TextPropertyDescriptor(P_ID_SMALL_VALUE, P_STR_SMALL_VALUE)); 41 descriptors.addElement(new TextPropertyDescriptor(P_ID_NO_BASELINE, P_STR_NO_BASELINE)); 42 descriptors.addElement(new TextPropertyDescriptor(P_ID_SINGLE_RUN, P_STR_SINGLE_RUN)); 43 descriptors.addElement(new TextPropertyDescriptor(P_ID_BIG_ERROR, P_STR_BIG_ERROR)); 44 descriptors.addElement(new TextPropertyDescriptor(P_ID_STUDENT_TTEST, P_STR_STUDENT_TTEST)); 45 descriptors.addElement(new TextPropertyDescriptor(P_ID_NOT_STABLE, P_STR_NOT_STABLE)); 46 descriptors.addElement(new TextPropertyDescriptor(P_ID_NOT_RELIABLE, P_STR_NOT_RELIABLE)); 47 descriptors.addElement(new TextPropertyDescriptor(P_ID_BIG_DELTA, P_STR_BIG_DELTA)); 48 } 49 static Vector getDescriptors() { 50 return descriptors; 51 } 52 53 private int status; 54 55 public BuildResultsProperties() { 56 } 57 58 void setStatus(int status) { 59 this.status = status; 60 } 61 62 public Object getEditableValue() { 63 return null; 64 } 65 66 /* (non-Javadoc) 67 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors() 68 */ 69 public IPropertyDescriptor[] getPropertyDescriptors() { 70 return (IPropertyDescriptor[]) getDescriptors().toArray( 71 new IPropertyDescriptor[getDescriptors().size()]); 72 } 73 74 /* (non-Javadoc) 75 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object) 76 */ 77 public Object getPropertyValue(Object propKey) { 78 if (propKey.equals(P_ID_SMALL_VALUE)) { 79 if ((this.status & ResultsElement.SMALL_VALUE) != 0) { 80 return "This test and/or its variation has a small value, hence it may not be necessary to spend time on fixing it if a regression occurs."; 81 } 82 } 83 if (propKey.equals(P_ID_NO_BASELINE)) { 84 if ((this.status & ResultsElement.NO_BASELINE) != 0) { 85 return "There's no baseline to compare with."; 86 } 87 } 88 if (propKey.equals(P_ID_SINGLE_RUN)) { 89 if ((this.status & ResultsElement.SINGLE_RUN) != 0) { 90 return "This test has only one run, hence no error can be computed to verify if it's stable enough to be reliable."; 91 } 92 } 93 if (propKey.equals(P_ID_BIG_ERROR)) { 94 if ((this.status & ResultsElement.BIG_ERROR) != 0) { 95 return "The error on this test is over the 3% threshold, hence its result may not be really reliable."; 96 } 97 } 98 if (propKey.equals(P_ID_STUDENT_TTEST)) { 99 if ((this.status & ResultsElement.STUDENT_TTEST) != 0) { 100 return "The student-t on this test is over the threshold"; 101 } 102 } 103 if (propKey.equals(P_ID_NOT_STABLE)) { 104 if ((this.status & ResultsElement.NOT_STABLE) != 0) { 105 return "The results history shows that the variation of its delta is between 10% and 20%, hence its result may not be really reliable."; 106 } 107 } 108 if (propKey.equals(P_ID_NOT_RELIABLE)) { 109 if ((this.status & ResultsElement.NOT_RELIABLE) != 0) { 110 return "The results history shows that the variation of its delta is over 20%, hence its result is surely not reliable."; 111 } 112 } 113 if (propKey.equals(P_ID_BIG_DELTA)) { 114 if ((this.status & ResultsElement.BIG_DELTA) != 0) { 115 return "The delta on this test is over the 10% threshold, hence may indicate a possible regression."; 116 } 117 } 118 return null; 119 } 120 121 } 122