1 // Copyright (C) 2000 - 2006 Philip Aston 2 // All rights reserved. 3 // 4 // This file is part of The Grinder software distribution. Refer to 5 // the file LICENSE which is part of The Grinder distribution for 6 // licensing details. The Grinder distribution is available on the 7 // Internet at http://grinder.sourceforge.net/ 8 // 9 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 10 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 11 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 12 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 13 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 14 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 15 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 16 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 17 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 18 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 19 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 20 // OF THE POSSIBILITY OF SUCH DAMAGE. 21 22 package net.grinder.statistics; 23 24 25 /** 26 * Access to a set of long and double values. Clients can access 27 * individual values using an index object obtained from a {@link 28 * StatisticsIndexMap}. 29 * 30 * @author Philip Aston 31 * @see net.grinder.script.Grinder.ScriptContext#getStatistics 32 */ 33 public interface StatisticsSet extends ImmutableStatisticsSet { 34 35 /** 36 * Reset this StatisticsSet to default values. Allows instance to 37 * be reused. 38 */ 39 void reset(); 40 41 /** 42 * Set the value specified by <code>index</code>. 43 * 44 * @param index The index. 45 * @param value The value. 46 */ 47 void setValue(StatisticsIndexMap.LongIndex index, long value); 48 49 /** 50 * Set the value specified by <code>index</code>. 51 * 52 * @param index The index. 53 * @param value The value. 54 */ 55 void setValue(StatisticsIndexMap.DoubleIndex index, double value); 56 57 /** 58 * Add <code>value</code> to the value specified by 59 * <code>index</code>. 60 * 61 * @param index The index. 62 * @param value The value. 63 */ 64 void addValue(StatisticsIndexMap.LongIndex index, long value); 65 66 /** 67 * Add <code>value</code> to the value specified by 68 * <code>index</code>. 69 * 70 * @param index The index. 71 * @param value The value. 72 */ 73 void addValue(StatisticsIndexMap.DoubleIndex index, double value); 74 75 /** 76 * Add sample <code>value</code> to the sample statistic specified by 77 * <code>index</code>. 78 * 79 * @param index The index. 80 * @param value The value. 81 */ 82 void addSample(StatisticsIndexMap.LongSampleIndex index, long value); 83 84 /** 85 * Add sample <code>value</code> to the sample statistic specified by 86 * <code>index</code>. 87 * 88 * @param index The index. 89 * @param value The value. 90 */ 91 void addSample(StatisticsIndexMap.DoubleSampleIndex index, double value); 92 93 /** 94 * Reset the sample statistic specified by <code>index</code>. 95 * 96 * @param index Index of sample statistic. 97 */ 98 void reset(StatisticsIndexMap.LongSampleIndex index); 99 100 /** 101 * Reset the sample statistic specified by <code>index</code>. 102 * 103 * @param index Index of sample statistic. 104 */ 105 void reset(StatisticsIndexMap.DoubleSampleIndex index); 106 107 /** 108 * Add the values of another {@link StatisticsSet} to ours. 109 * Assumes we don't need to synchronise access to operand. 110 * @param operand The {@link StatisticsSet} value to add. 111 */ 112 void add(ImmutableStatisticsSet operand); 113 114 /** 115 * Marked this statistics set as containing composite statistics. 116 */ 117 void setIsComposite(); 118 }