1 package yawn.util; 2 3 import java.util.Random; 4 5 /*** 6 * An (Input,Output) pair. 7 * 8 * <p>$Id: InputOutputPattern.java,v 1.9 2005/05/09 11:04:58 supermarti Exp $</p> 9 * 10 * @author Luis Martí (luis dot marti at uc3m dot es) 11 * @version $Revision: 1.9 $ 12 */ 13 public class InputOutputPattern { 14 15 /*** 16 * 17 * @uml.property name="input" 18 * @uml.associationEnd multiplicity="(0 1)" 19 */ 20 public Pattern input; 21 22 /*** 23 * 24 * @uml.property name="output" 25 * @uml.associationEnd multiplicity="(0 1)" 26 */ 27 public Pattern output; 28 29 public InputOutputPattern(int inputSize, int outputSize) { 30 input = new Pattern(inputSize); 31 output = new Pattern(outputSize); 32 } 33 34 public static InputOutputPattern[] randomOrderList(InputOutputPattern[] in) { 35 InputOutputPattern[] res = new InputOutputPattern[in.length]; 36 System.arraycopy(in, 0, res, 0, in.length); 37 Random random = new Random(System.currentTimeMillis()); 38 for (int i = 0; i < in.length; i++) { 39 int next = random.nextInt(in.length - i); 40 InputOutputPattern iop = res[next]; 41 res[next] = res[i]; 42 res[i] = iop; 43 } 44 return res; 45 } 46 }