// Description - accepts a reference to an array of the base class imageCollage. // randomly allocates 10 slots of collage objects followed by one // of each object. static void allocateCollageArray(ref imageCollage[] colArray) { int collageSelector; int collageSize; for (int index = 0; index < colArray.Length; index++) { collageSelector = rnd.Next(NUM_COL); collageSize = rnd.Next(MIN_IMG, MAX_IMG); if (index < RANDOM_SIZE) //Random portion of array { if (collageSelector == IMAGE) { colArray[index] = new imageCollage(collageSize); } if (collageSelector == CYCLIC) { colArray[index] = new cyclicCollage(collageSize); } if (collageSelector == BIT) { colArray[index] = new bitCollage(collageSize); } } if (index >= RANDOM_SIZE) // Constant portion of array used in test suites { colArray[index] = new bitCollage(TEST_SIZE); ++index; colArray[index] = new cyclicCollage(TEST_SIZE); ++index; colArray[index] = new imageCollage(TEST_SIZE); } } }
// This method initializes 1 imageCollage, 1 cyclicCollage, and 1 bitCollage and fills them with random sequnce sizes, subscriptions lengths and image ids. // As well as random parameters specific to the object type. public static imageCollage[] heteroCollage(int size) { imageCollage[] H = new imageCollage[size]; int iQuantity = rand.Next(4, 11); H[0] = new imageCollage(iQuantity, rand.Next(5, 11)); for (int n = 0; n < iQuantity; n++) { H[0].addImage(rand.Next(1000, 10000)); } int cQuantity = rand.Next(4, 11); H[1] = new cyclicCollage(cQuantity, rand.Next(5, 11), 3); for (int n = 0; n < cQuantity; n++) { H[1].addImage(rand.Next(1000, 10000)); } bool replaceable = false; int x = rand.Next(0, 1); if (x == 1) { replaceable = true; } int bQuantity = rand.Next(4, 11); H[2] = new bitCollage(bQuantity, rand.Next(5, 11), replaceable); for (int n = 0; n < bQuantity; n++) { H[2].addImage(rand.Next(1000, 10000)); } return(H); }
// Description - accepts a reference to an array of the base class imageCollage. // randomly allocates 10 slots of collage objects followed by one // of each object. static void allocateCollageArray(ref imageCollage[] colArray) { int collageSelector; int collageSize; for (int index = 0; index < colArray.Length; index++) { collageSelector = rnd.Next(NUM_COL); collageSize = rnd.Next(MIN_IMG, MAX_IMG); if (index < RANDOM_SIZE) //Random portion of array { if (collageSelector == IMAGE) colArray[index] = new imageCollage(collageSize); if (collageSelector == CYCLIC) colArray[index] = new cyclicCollage(collageSize); if (collageSelector == BIT) colArray[index] = new bitCollage(collageSize); } if (index >= RANDOM_SIZE) // Constant portion of array used in test suites { colArray[index] = new bitCollage(TEST_SIZE); ++index; colArray[index] = new cyclicCollage(TEST_SIZE); ++index; colArray[index] = new imageCollage(TEST_SIZE); } } }