package onetomany.bargainingchipsgame; //import java.util.Arrays; // // public Bundle aggregateWith333(Bundle b) // { // if (b!=null && this!=null) // { // Bundle l=new Bundle(); // // for (Stack s : b.getBundle()) // { // l=this.aggregateWith(s); // } // return l; // } // return this; // } // //public Bundle aggregateWith(Bundle b) // { // if (b!=null && this!=null) // { // Bundle l=new Bundle(); // // for (Stack s : b.getBundle()) // { // l=this.aggregateWith(s); // due to parallel actions on all stacks in a nested manner, sometimes some strange results, when the second bundle has multiple stacks (doesn't matter if any shared colors or not!! //// Boolean f=false; //// for (int i=1; i=0) // { // Bundle b=new Bundle(); // Boolean f=false; // // for (int i=0; i=0) // { // Stack t= this.getStack(k); // l.addStack(t.aggregateWith(s)); // //f1[j]=true; // this stack of b bundle considered into the new bundle // f2[k]=true; // this stack of `this' bundle considered into the new bundle // } // else // { // l.addStack(s); // //f1[j]=true; // this stack of b bundle directly added into the new bundle // } // } // } // for (int i=1;i=0) // the color of j-th stack of bundle b found in i-th stack of `this' bundle // { // l.aggregateWith2(this.getStack(i)); //aggregate these two stacks into the new bundle l <-- aggregateWith2 stack (difference with aggregateWith5 bundle) // } // else // l.addStack(s); // so put j-th stack of bundle b directly into the new bundle // // and other stacks of `this' bundle have already been in the new bundle! // } // return l; // } // return this; // } // // // public Bundle aggregateWith5(Bundle b) // { // if (b!=null && this!=null) // { // Bundle l=new Bundle(); // int i; // for (i=1;i=0) // the color of j-th stack of bundle b found in i-th stack of `this' bundle // { // l.aggregateWith(this.getStack(i)); //aggregate these two stacks into the new bundle l <-- aggregateWith stack (difference with aggregateWith4 bundle) // } // else // l.addStack(s); // so put j-th stack of bundle b directly into the new bundle // // and other stacks of `this' bundle have already been in the new bundle! // } // return l; // } // return this; // } // // // // // //OTHER TESTS // // // // // System.out.println("\nTEST12::: index of stack1 in Bundle1: "+bundle1.findStack(stack1)); // // System.out.println("\nTEST13::: index of stack2 in Bundle1: "+bundle1.findStack(stack2)); // // System.out.println("\nTEST14::: index of null in Bundle1: "+bundle1.findStack(null)); // // s=new Stack(new Chip("Yellow", 8),40); // // System.out.println("\nTEST15::: index of stack "+s+" in Bundle1: "+bundle1.findStack(s)); // // //System.out.println("\n*TEST6-02:::Bundle1: "+bundle1+" is aggregated with Stack "+ss+" as follows:\n"+bundle1.aggregateWith2(ss)); //System.out.println("\n*TEST6:::Bundle1: "+bundle1+" is aggregated with Stack: 40 x Chip(Yellow, 8$) as follows:\n"+bundle1.aggregateWith2(new Stack(new Chip("Yellow", 8),40))); //System.out.println("\n*TEST6-03:::Bundle1: "+bundle1+" is aggregated with Stack "+sss+" as follows:\n"+bundle1.aggregateWith2(sss)); // // // //System.out.println("\n*TEST7:::Bundle1: "+bundle1+" is aggregated with ``null Stack'' as follows:\n"+bundle1.aggregateWith2(ssss)); // // //System.out.println("\n-----aggregateWith-----"); // // // // //System.out.println("\n*TEST9-01::: Without shared colors ::: single stack B2: "+b2+" is aggregated with ``null'' bundle5 as follows:\n"+ b2.aggregateWith(bundle5)); // // //System.out.println("\n*TEST9-02::: Without shared colors ::: multi stack B1: "+b1+" is aggregated with ``null'' bundle5 as follows:\n"+ b1.aggregateWith(bundle5)); // // //System.out.println("\n*TEST9-03::: Without shared colors ::: single stack B2: "+b2+" is aggregated with single stack B5: "+b5+" as follows:\n"+ b2.aggregateWith(b5)); // //System.out.println("\n*TEST9-04::: Without shared colors ::: single stack B2: "+b2+" is aggregated with multi stack B3: "+b3+" as follows:\n"+ b2.aggregateWith(b3)); // //System.out.println("\n*TEST9-05::: With shared colors ::: single stack B2: "+b2+" is aggregated with single stack B5: "+b6+" as follows:\n"+ b2.aggregateWith(b6)); // //System.out.println("\n*TEST9-06::: With shared colors ::: single stack B2: "+b2+" is aggregated with multi stack B3: "+b1+" as follows:\n"+ b2.aggregateWith(b1)); // // //System.out.println("\n*TEST9-07::: With shared colors ::: multi stack B1: "+b1+" is aggregated with multi stack B3: "+b3+" as follows:\n"+ b1.aggregateWith(b3)); // // //System.out.println("\n*TEST9-08::: With shared colors ::: multi stack B1: "+b1+" is aggregated with single stack B2: "+b2+" as follows:\n"+ b1.aggregateWith(b2)); // //System.out.println("\n*TEST9-09::: Without shared colors ::: multi stack B1: "+b1+" is aggregated with multi stack B2: "+b4+" as follows:\n"+ b1.aggregateWith(b4)); // // //System.out.println("\n-----aggregateWith2-----"); // // //System.out.println("\n*TEST10-01::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b2.aggregateWith2(bundle5)); // // //System.out.println("\n*TEST10-02::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b1.aggregateWith2(bundle5)); // // //System.out.println("\n*TEST10-03::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b5+" as follows:\n"+ b2.aggregateWith2(b5)); // //System.out.println("\n*TEST10-04::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b2.aggregateWith2(b3)); // //System.out.println("\n*TEST10-05::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b6+" as follows:\n"+ b2.aggregateWith2(b6)); // //System.out.println("\n*TEST10-06::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b1+" as follows:\n"+ b2.aggregateWith2(b1)); // // //System.out.println("\n*TEST10-07::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b1.aggregateWith2(b3)); // // //System.out.println("\n*TEST10-08::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with single stack B2: "+b2+" as follows:\n"+ b1.aggregateWith2(b2)); // //System.out.println("\n*TEST10-09::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B2: "+b4+" as follows:\n"+ b1.aggregateWith2(b4)); // // //System.out.println("\n-----BUNDLEaggregateWith4Bundle (& BUNDLEaggregateWith2Stack)-----"); // // //System.out.println("\n*TEST10-01::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b2.aggregateWith4(bundle5)); // // //System.out.println("\n*TEST10-02::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b1.aggregateWith4(bundle5)); // // //System.out.println("\n*TEST10-03::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b5+" as follows:\n"+ b2.aggregateWith4(b5)); // //System.out.println("\n*TEST10-04::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b2.aggregateWith4(b3)); // //System.out.println("\n*TEST10-05::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b6+" as follows:\n"+ b2.aggregateWith4(b6)); // //System.out.println("\n*TEST10-06::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b1+" as follows:\n"+ b2.aggregateWith4(b1)); // // //System.out.println("\n*TEST10-07::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b1.aggregateWith4(b3)); // // //System.out.println("\n*TEST10-08::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with single stack B2: "+b2+" as follows:\n"+ b1.aggregateWith4(b2)); // //System.out.println("\n*TEST10-09::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B2: "+b4+" as follows:\n"+ b1.aggregateWith4(b4)); // //System.out.println("\n-----BUNDLEaggregateWith5Bundle (& BUNDLEaggregateWithStack)-----"); // // //System.out.println("\n*TEST10-01::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b2.aggregateWith5(bundle5)); // // //System.out.println("\n*TEST10-02::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b1.aggregateWith5(bundle5)); // // //System.out.println("\n*TEST10-03::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b5+" as follows:\n"+ b2.aggregateWith5(b5)); // //System.out.println("\n*TEST10-04::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b2.aggregateWith5(b3)); // //System.out.println("\n*TEST10-05::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b6+" as follows:\n"+ b2.aggregateWith5(b6)); // //System.out.println("\n*TEST10-06::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b1+" as follows:\n"+ b2.aggregateWith5(b1)); // // //System.out.println("\n*TEST10-07::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b1.aggregateWith5(b3)); // // //System.out.println("\n*TEST10-08::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with single stack B2: "+b2+" as follows:\n"+ b1.aggregateWith5(b2)); // //System.out.println("\n*TEST10-09::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B2: "+b4+" as follows:\n"+ b1.aggregateWith5(b4)); // // //System.out.println("\n-----BUNDLEaggregateWith33Bundle (& BUNDLEaggregateWithStack)-----"); // // //System.out.println("\n*TEST10-01::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b2.aggregateWith33(bundle5)); // // //System.out.println("\n*TEST10-02::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b1.aggregateWith33(bundle5)); // // //System.out.println("\n*TEST10-03::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b5+" as follows:\n"+ b2.aggregateWith33(b5)); // //System.out.println("\n*TEST10-04::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b2.aggregateWith33(b3)); // //System.out.println("\n*TEST10-05::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b6+" as follows:\n"+ b2.aggregateWith33(b6)); // //System.out.println("\n*TEST10-06::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b1+" as follows:\n"+ b2.aggregateWith33(b1)); // // //System.out.println("\n*TEST10-07::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b1.aggregateWith33(b3)); // // //System.out.println("\n*TEST10-08::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with single stack B2: "+b2+" as follows:\n"+ b1.aggregateWith33(b2)); // //System.out.println("\n*TEST10-09::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B2: "+b4+" as follows:\n"+ b1.aggregateWith33(b4)); // //System.out.println("\n-----BUNDLEaggregateWith333Bundle-----"); // // //System.out.println("\n*TEST10-01::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b2.aggregateWith333(bundle5)); // // //System.out.println("\n*TEST10-02::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b1.aggregateWith333(bundle5)); // // //System.out.println("\n*TEST10-03::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b5+" as follows:\n"+ b2.aggregateWith333(b5)); // //System.out.println("\n*TEST10-04::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b2.aggregateWith333(b3)); // //System.out.println("\n*TEST10-05::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b6+" as follows:\n"+ b2.aggregateWith333(b6)); // //System.out.println("\n*TEST10-06::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b1+" as follows:\n"+ b2.aggregateWith333(b1)); // // //System.out.println("\n*TEST10-07::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b1.aggregateWith333(b3)); // // //System.out.println("\n*TEST10-08::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with single stack B2: "+b2+" as follows:\n"+ b1.aggregateWith333(b2)); // //System.out.println("\n*TEST10-09::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B2: "+b4+" as follows:\n"+ b1.aggregateWith333(b4)); // //