/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //Copyright Dr. Marek A. Suchenek, 2015 //All rights reserved package split; /** * * @author suchenek */ public class Split1 { public static void main(String[] args) { // TODO code application logic here int[] Array; int N, K = 8; // para for the number of insertions cnt.clr(); //counts calls to constructor, enqueue, and dequeue // for (K = 1; K<=100; K++) { N = K*15; Array = new int[N]; for (int i = 0; i < N; i++) Array[i] = i + 1; Test(Array); } } public static void Test(int[] A) { int n = A.length; QUEUE1 Q = new QUEUE1(); Q.dump(); for (int m = 0; m*15 < n; m++) { for (int i = 0; i < 15; i++) { Q.enqueue(A[i + m*15]); A[i + m*15] = 0; Q.dump(); } for (int i = 0; i < 13; i++) { Q.dequeue(); Q.dump(); } } System.out.println("Clone test"); QUEUE1 P = Q.clone(); QUEUE1 R = Q; // "copy" System.out.print("Cloned queue: "); P.dump(); System.out.print("Copied queue: "); R.dump(); for (int i = 1; i <= 17; i++) { Q.dequeue(); Q.dump(); } System.out.print("Cloned queue: "); P.dump(); System.out.print("Copied queue: "); R.dump(); // for (int i = 0; i < 15; i++) // { // Q.enqueue(i); // Q.dump(); // } // for (int i = 1; i <= 17; i++) // { // Q.dequeue(); // Q.dump(); // } } }