1 /* 2 * Copyright (c) 2004, RV Test Team 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * Redistributions of source code must retain the above copyright notice, this 9 * list of conditions and the following disclaimer. 10 * 11 * Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * 15 * Neither the name of the "RV Test Team" nor the names of its contributors may 16 * be used to endorse or promote products derived from this software without 17 * specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 29 * THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 */ 32 /* 33 * Copyright (c) 2002, Reuters 34 * All rights reserved. 35 * 36 * Redistribution and use in source and binary forms, with or without 37 * modification, are permitted provided that the following conditions are met: 38 * 39 * Redistributions of source code must retain the above copyright notice, this 40 * list of conditions and the following disclaimer. 41 * Redistributions in binary form must reproduce the above copyright notice, 42 * this list of conditions and the following disclaimer in the documentation 43 * and/or other materials provided with the distribution. 44 * Neither the name of the Reuters nor the names of its contributors may be 45 * used to endorse or promote products derived from this software without 46 * specific prior written permission. 47 * 48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 49 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 52 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 53 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 54 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 55 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 56 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 57 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 58 * THE POSSIBILITY OF SUCH DAMAGE. 59 * 60 */ 61 package com.reuters.msgtest.load.value; 62 63 import com.reuters.msgtest.RvTestException; 64 65 66 /*** 67 * Interface for value generators from a given set. 68 * 69 * @author Cavit Aydin 70 * @version @VSS_FLAG_VERSION@ 71 */ 72 public interface ValueGenerator { 73 static final String SEQUENTIAL = "sequential"; 74 static final String RANDOM = "random"; 75 76 /*** 77 * Returns the value of the current element in this set 78 * corresponding to the given substitution string. 79 * 80 * @param substr the substitution string 81 * @return the current element value as string 82 * @throws RvTestException 83 */ 84 String getCurrentValue(String substr) throws RvTestException; 85 86 /*** 87 * Changes the current value. The choice 88 * of the new element can be by any criteria implemented by 89 * the subclasses. The return value is used as an indication 90 * to the calling code that this set has exhausted its current 91 * range of values. This is especially helpful for an outer loop 92 * to detect the end of loop condition for an inner loop. For large 93 * random sets relying on this value may not be efficient, so it should 94 * avoided. 95 * 96 * @return true, if all the unique values have been exhausted and the 97 * current value is a duplicate 98 */ 99 boolean changeValue(); 100 } // ValueGenerator