From d7eaecafa9b4f3d3d1d1a3e713ac685775222870 Mon Sep 17 00:00:00 2001 From: Koen Wermer <koenwermer@gmail.com> Date: Wed, 8 Mar 2017 03:08:45 +0100 Subject: [PATCH] daikon false positives tested --- Equivalent mutations/twodmatrix.class | Bin 0 -> 1724 bytes Results/Daikon results.txt | 2 +- Tests/BaseSecantSolver.java | 50 ++++--- daikon equivalent mutations/2D_to_1D.java | 71 +++++++++ daikon equivalent mutations/BST.java | 136 ++++++++++++++++++ daikon equivalent mutations/Fibonacci.java | 26 ++++ daikon equivalent mutations/MinsMaxs.class | Bin 0 -> 655 bytes daikon equivalent mutations/MinsMaxs.java | 37 +++++ .../Mutants/2D_to_1D_no_1D.java | 60 ++++++++ .../Mutants/2D_to_1D_no_counter.java | 70 +++++++++ .../Mutants/BST_no_parent.java | 133 +++++++++++++++++ .../Mutants/Fibonacci_no_extra_prints.java | 24 ++++ .../Mutants/MinsMaxs_R1.java | 36 +++++ .../Mutants/MinsMaxs_R2.java | 35 +++++ .../Mutants/MinsMaxs_R3.java | 35 +++++ .../Mutants/Node.class | Bin 0 -> 424 bytes .../Mutants/Normalizer_R1.class | Bin 0 -> 533 bytes .../Mutants/Normalizer_R1.java | 26 ++++ .../Mutants/Normalizer_R2.class | Bin 0 -> 631 bytes .../Mutants/Normalizer_R2.java | 31 ++++ .../Mutants/Normalizer_R3.class | Bin 0 -> 523 bytes .../Mutants/Normalizer_R3.java | 24 ++++ .../Mutants/Normalizer_R4.class | Bin 0 -> 655 bytes .../Mutants/Normalizer_R4.java | 34 +++++ .../Mutants/Program.class | Bin 0 -> 573 bytes .../Mutants/Stack_bool_is_result.java | 126 ++++++++++++++++ .../Stack_constructor_duplication.java | 126 ++++++++++++++++ .../Mutants/Stack_useless_property.java | 126 ++++++++++++++++ .../Mutants/Tree.class | Bin 0 -> 932 bytes .../Mutants/Vector_R1.class | Bin 0 -> 989 bytes .../Mutants/Vector_R1.java | 50 +++++++ .../Mutants/Vector_R2.class | Bin 0 -> 1010 bytes .../Mutants/Vector_R2.java | 49 +++++++ .../Mutants/Vector_R3.class | Bin 0 -> 997 bytes .../Mutants/Vector_R3.java | 50 +++++++ .../Mutants/Vectors01Generator_no_for.java | 38 +++++ .../Vectors01Generator_print_string.java | 40 ++++++ .../Mutants/twodmatrix.class | Bin 0 -> 1045 bytes daikon equivalent mutations/Node.class | Bin 0 -> 414 bytes daikon equivalent mutations/Normalizer.class | Bin 0 -> 529 bytes daikon equivalent mutations/Normalizer.java | 25 ++++ daikon equivalent mutations/Program.class | Bin 0 -> 563 bytes daikon equivalent mutations/Stack.java | 128 +++++++++++++++++ daikon equivalent mutations/Tree.class | Bin 0 -> 922 bytes daikon equivalent mutations/Vector.class | Bin 0 -> 976 bytes daikon equivalent mutations/Vector.java | 45 ++++++ .../Vectors01Generator.java | 39 +++++ daikon equivalent mutations/twodmatrix.class | Bin 0 -> 1037 bytes 48 files changed, 1651 insertions(+), 21 deletions(-) create mode 100644 Equivalent mutations/twodmatrix.class create mode 100644 daikon equivalent mutations/2D_to_1D.java create mode 100644 daikon equivalent mutations/BST.java create mode 100644 daikon equivalent mutations/Fibonacci.java create mode 100644 daikon equivalent mutations/MinsMaxs.class create mode 100644 daikon equivalent mutations/MinsMaxs.java create mode 100644 daikon equivalent mutations/Mutants/2D_to_1D_no_1D.java create mode 100644 daikon equivalent mutations/Mutants/2D_to_1D_no_counter.java create mode 100644 daikon equivalent mutations/Mutants/BST_no_parent.java create mode 100644 daikon equivalent mutations/Mutants/Fibonacci_no_extra_prints.java create mode 100644 daikon equivalent mutations/Mutants/MinsMaxs_R1.java create mode 100644 daikon equivalent mutations/Mutants/MinsMaxs_R2.java create mode 100644 daikon equivalent mutations/Mutants/MinsMaxs_R3.java create mode 100644 daikon equivalent mutations/Mutants/Node.class create mode 100644 daikon equivalent mutations/Mutants/Normalizer_R1.class create mode 100644 daikon equivalent mutations/Mutants/Normalizer_R1.java create mode 100644 daikon equivalent mutations/Mutants/Normalizer_R2.class create mode 100644 daikon equivalent mutations/Mutants/Normalizer_R2.java create mode 100644 daikon equivalent mutations/Mutants/Normalizer_R3.class create mode 100644 daikon equivalent mutations/Mutants/Normalizer_R3.java create mode 100644 daikon equivalent mutations/Mutants/Normalizer_R4.class create mode 100644 daikon equivalent mutations/Mutants/Normalizer_R4.java create mode 100644 daikon equivalent mutations/Mutants/Program.class create mode 100644 daikon equivalent mutations/Mutants/Stack_bool_is_result.java create mode 100644 daikon equivalent mutations/Mutants/Stack_constructor_duplication.java create mode 100644 daikon equivalent mutations/Mutants/Stack_useless_property.java create mode 100644 daikon equivalent mutations/Mutants/Tree.class create mode 100644 daikon equivalent mutations/Mutants/Vector_R1.class create mode 100644 daikon equivalent mutations/Mutants/Vector_R1.java create mode 100644 daikon equivalent mutations/Mutants/Vector_R2.class create mode 100644 daikon equivalent mutations/Mutants/Vector_R2.java create mode 100644 daikon equivalent mutations/Mutants/Vector_R3.class create mode 100644 daikon equivalent mutations/Mutants/Vector_R3.java create mode 100644 daikon equivalent mutations/Mutants/Vectors01Generator_no_for.java create mode 100644 daikon equivalent mutations/Mutants/Vectors01Generator_print_string.java create mode 100644 daikon equivalent mutations/Mutants/twodmatrix.class create mode 100644 daikon equivalent mutations/Node.class create mode 100644 daikon equivalent mutations/Normalizer.class create mode 100644 daikon equivalent mutations/Normalizer.java create mode 100644 daikon equivalent mutations/Program.class create mode 100644 daikon equivalent mutations/Stack.java create mode 100644 daikon equivalent mutations/Tree.class create mode 100644 daikon equivalent mutations/Vector.class create mode 100644 daikon equivalent mutations/Vector.java create mode 100644 daikon equivalent mutations/Vectors01Generator.java create mode 100644 daikon equivalent mutations/twodmatrix.class diff --git a/Equivalent mutations/twodmatrix.class b/Equivalent mutations/twodmatrix.class new file mode 100644 index 0000000000000000000000000000000000000000..4ab1782d5139af8f3f597b41d4d01735b25fdeab GIT binary patch literal 1724 zcmZXV%TF6u6vn^t_{|Vrfuz_FLmoAT7%-GlFr+*TObT&Y(xe1c(Ew8zipR(dG!e>< zefu}C>AF!MRhx9zP1R+kN?rG_K=kpQ@smWO`<UzR-t(L9oD0AG`_nG~hVeLz5C%eM z!k~1i06JtGl5RMJ4=@tMhXIU+@e#(t7)M$bC&HM-ogh9AVk%7KbO19l&IXZ@aW05? z85e@kWxT6E$+78dHk+Y9U0s#8H3c4-_|ukcIg<)}ab53usK7gu-!K(4ELygCZ$GzY z79JRDJ6s7DOk*QwI0fq|Pl=1Re%UeBzg{wS%aY8~b#vFT^7dW;pYZVAf@M1!3IgkS z`@k$X3PSEu-Zr`F%^4P{+TyE=+s1*>zhl^&{mTqsZ;s3H;pO~(VcndwBz%2p_KA~! zGB}$Qt%ewGYIqOr8Y0p~(V?Le*8*77u!MUG>WtOHf#-dPgU`R5P|#S7kX_q0*PQ^e z8t&uM06x>Oj0YM%$HM>~Y4`#wWaHiteF|$x;3ip|Z}O$Dm)KnjS~Ip|7Glnp8O!XL zIn#FbVq-B4H$)x_g<|v8foaE5w`XHhg@W-czT|q>6SIoC9??aqn<;u@Zo~%5+Onos zG%YT=mG9TH6@M>$(DJiA$7Gt-{5~CSEt*OFeQ}?DnnrG1K~vQMo#dNlfq6MFcJ|He zSCRz1rzQ&}1-DhA*PK?)Ecd13HM>f=t4(Lo?D5js??8E^0II~gy}Mr}u7s{xW@e-g z-3rv1h$dbmz{|#3U=Jw=cVtDlBa4EgpN(mQf^N<pL*)Y`6R)5oA}8=9q9;%jiI<$c zg!(JIo)h>g?_00KC-DEk9SW|qZ+FkDV_c2#>v4%sCmL`Yja0A#;Bn)8N1epEtEMAz z_A#c_iKs+4M(PCu%|YKAgjUqZk1X~TZ&Zd;)IFlY7fD55Ks!Z!_Q<1r|KION3j5c> z;Bgr`5#anX!f0cE75#Kzg7X=^>AVlO_-iA)=kO@!2q|Y6IfD=HbJa`6I2$XFz4-Ah z&k|0(!Z}spydj*Iye?;nD_Q1r$^H^SgGzy*yO?j@#=J(%E`nVrW*7gE-NH1}vOtV? zFym)vCKhj93GR@<lHg%AU4){I33algXk$AEe}qwmEt={`W{*@F^|y=m$J-peG_Q|I zOVX$TnvrD6`Y^;tIGW)72VSM*SEu-;fOoJ2vQ3vflno_L(O7ayAhwRtebFR;q-v3* z?awMl8xI9W_(h{=!5E{DB89XYKLpP?{7h9ZtE!J^#VRULEO94)M$?MV{|e2E60W6e zdG9GM%R+0-LYpjHsad!x2*v8{Mv(Jqrep?JFv}a0VIt-jai0He7Fb34g*r)6?Lq(l DBUewq literal 0 HcmV?d00001 diff --git a/Results/Daikon results.txt b/Results/Daikon results.txt index 1bddbc3..4dd99b3 100644 --- a/Results/Daikon results.txt +++ b/Results/Daikon results.txt @@ -10,7 +10,7 @@ GradientFunction: 0 mutations with unterminated calls 0 mutations stuck in a loop -BaseSecantSolver (doSolve not checked yet): +BaseSecantSolver: 0 mutations with error found: 0 mutations with error found not detected by wlp: 0 mutations with unterminated calls diff --git a/Tests/BaseSecantSolver.java b/Tests/BaseSecantSolver.java index 2bcf1dc..b73e491 100644 --- a/Tests/BaseSecantSolver.java +++ b/Tests/BaseSecantSolver.java @@ -28,6 +28,9 @@ import org.apache.commons.math3.exception.NullArgumentException; import org.apache.commons.math3.exception.NumberIsTooLargeException; import org.apache.commons.math3.exception.util.LocalizedFormats; import org.apache.commons.math3.util.FastMath; +import org.apache.commons.math3.exception.TooManyEvaluationsException; + +import org.apache.commons.math3.analysis.function.Abs; /** * Base class for all bracketing <em>Secant</em>-based methods for root-finding @@ -109,13 +112,11 @@ public class BaseSecantSolver this.method = method3; } - public final double doSolve() + public static double doSolve1(final double ftol, final double atol, final double rtol, double x0, double x1, Method method, AllowedSolution allowed, Abs function) throws ConvergenceException { - // Get initial solution - double x0 = getMin(); - double x1 = getMax(); - double f0 = computeObjectiveValue(x0); - double f1 = computeObjectiveValue(x1); + + double f0 = computeObjectiveValue1(x0, function); + double f1 = computeObjectiveValue1(x1, function); // If one of the bounds is the exact root, return it. Since these are // not under-approximations or over-approximations, we can return them @@ -128,22 +129,17 @@ public class BaseSecantSolver } // Verify bracketing of initial solution. - verifyBracketing(x0, x1); - - // Get accuracies. - final double ftol = getFunctionValueAccuracy(); - final double atol = getAbsoluteAccuracy(); - final double rtol = getRelativeAccuracy(); + // verifyBracketing(x0, x1); // Keep track of inverted intervals, meaning that the left bound is // larger than the right bound. boolean inverted = false; - + // Keep finding better approximations. - while (true) { + for(int i = 0; i < 100; i++) { // Calculate the next approximation. final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0)); - final double fx = computeObjectiveValue(x); + final double fx = computeObjectiveValue1(x, function); // If the new approximation is the exact root, return it. Since // this is not an under-approximation or an over-approximation, @@ -160,7 +156,7 @@ public class BaseSecantSolver f0 = f1; inverted = !inverted; } else { - switch (this.method) { + switch (method) { case ILLINOIS: f0 *= 0.5; break; @@ -187,7 +183,7 @@ public class BaseSecantSolver // given the function value accuracy, then we can't get closer to // the root than we already are. if (FastMath.abs(f1) <= ftol) { - switch (this.allowed) { + switch (allowed) { case ANY_SIDE: return x1; case LEFT_SIDE: @@ -219,7 +215,7 @@ public class BaseSecantSolver // are satisfied with the current approximation. if (FastMath.abs(x1 - x0) < FastMath.max(rtol * FastMath.abs(x1), atol)) { - switch (this.allowed) { + switch (allowed) { case ANY_SIDE: return x1; case LEFT_SIDE: @@ -235,6 +231,7 @@ public class BaseSecantSolver } } } + throw new ConvergenceException(); } protected enum Method { @@ -251,7 +248,7 @@ public class BaseSecantSolver return (a + b) * 0.5; } - public static boolean isBracketing(UnivariateFunction function1, + public static boolean isBracketing(Abs function1, final double lower1, final double upper1) throws NullArgumentException { @@ -286,7 +283,7 @@ public class BaseSecantSolver verifyInterval1(initial, upper3); } - public static void verifyBracketing(UnivariateFunction function2, + public static void verifyBracketing(Abs function2, final double lower4, final double upper4) throws NullArgumentException, @@ -318,4 +315,17 @@ public class BaseSecantSolver { return 0; } + + + public final double doSolve() + throws ConvergenceException + { + return 0; + } + + + protected static double computeObjectiveValue1(double point, Abs function) + { + return function.value(point); + } } diff --git a/daikon equivalent mutations/2D_to_1D.java b/daikon equivalent mutations/2D_to_1D.java new file mode 100644 index 0000000..fa8d22a --- /dev/null +++ b/daikon equivalent mutations/2D_to_1D.java @@ -0,0 +1,71 @@ +//http://www.sanfoundry.com/csharp-program-convert-2darray-1darray/ + + +class twodmatrix +{ + int m, n; + int[][] a; + int[] b; + twodmatrix(int x, int y) + { + this.m = x; + this.n = y; + this.a = new int[this.m][this.n]; + this.b = new int[this.m * this.n]; + } + public void readmatrix() + { + for (int i1 = 0; i1 < this.m; i1++) + { + for (int j1 = 0; j1 < this.n; j1++) + { + //System.out.printf("a[{0},{1}]=", i1, j1); + this.a[i1][j1] = 1;//System.in.read(); + } + } + } + public void printd() + { + for (int i2 = 0; i2 < this.m; i2++) + { + for (int j2 = 0; j2 < this.n; j2++) + { + //System.out.printf("{0}\t", this.a[i2][j2]); + + } + //System.out.printf("\n"); + } + } + public void convert() + { + int k = 0; + for (int i3 = 0; i3 < this.m; i3++) + { + for (int j3 = 0; j3 < this.n; j3++) + { + this.b[k++] = this.a[i3][j3]; + } + } + } + public void printoned() + { + this.convert(); + + for (int i4 = 0; i4 < this.m * this.n; i4++) + { + //System.out.printf("{0}\t", this.b[i4]); + } + } + + + public static void main(String[] args) + { + twodmatrix obj = new twodmatrix(2,3); + //System.out.printf("Enter the Elements : "); + obj.readmatrix(); + //System.out.printf("\t\t Given 2-D Array(Matrix) is : "); + obj.printd(); + //System.out.printf("\t\t Converted 1-D Array is : "); + obj.printoned(); + } +} \ No newline at end of file diff --git a/daikon equivalent mutations/BST.java b/daikon equivalent mutations/BST.java new file mode 100644 index 0000000..bfd412b --- /dev/null +++ b/daikon equivalent mutations/BST.java @@ -0,0 +1,136 @@ +// http://www.sanfoundry.com/csharp-program-binary-search-tree-linked-list/ + +/* + * C# Program to Implement Binary Search Tree using Linked List + */ + +class Node +{ + public int item; + public Node leftc; + public Node rightc; + + public Node(int item, Node leftc, Node rightc) + { + this.item = item; + this.leftc = leftc; + this.rightc = rightc; + } + + public Node() + {} + + public void display() + { + //System.out.print("["); + //System.out.print(this.item); + //System.out.print("]"); + } +} + +class Tree +{ + public Node root; + + public Tree() + { + this.root = null; + } + public Node ReturnRoot() + { + return this.root; + } + public void Insert(int id) + { + Node newNode = new Node(); + newNode.item = id; + if (this.root == null) + this.root = newNode; + else + { + Node current = this.root; + Node parent; + + while (true) + { + parent = current; + if (id < current.item) + { + current = current.leftc; + if (current == null) + { + parent.leftc = newNode; + return; + } + } + else + { + current = current.rightc; + if (current == null) + { + parent.rightc = newNode; + return; + } + } + } + } + } + public void Preorder(Node root1) + { + if (root1 != null) + { + //System.out.print(root1.item + " "); + Preorder(root1.leftc); + Preorder(root1.rightc); + } + } + public void Inorder(Node root2) + { + if (root2 != null) + { + Inorder(root2.leftc); + //System.out.print(root2.item + " "); + Inorder(root2.rightc); + } + } + public void Postorder(Node root3) + { + if (root3 != null) + { + Postorder(root3.leftc); + Postorder(root3.rightc); + //System.out.print(root3.item + " "); + } + } +} + +class Program +{ + static void main(String[] args) + { + Tree theTree = new Tree(); + theTree.Insert(20); + theTree.Insert(25); + theTree.Insert(45); + theTree.Insert(15); + theTree.Insert(67); + theTree.Insert(43); + theTree.Insert(80); + theTree.Insert(33); + theTree.Insert(67); + theTree.Insert(99); + theTree.Insert(91); + //System.out.println("Inorder Traversal : "); + theTree.Inorder(theTree.ReturnRoot()); + //System.out.println(" "); + //System.out.println(); + //System.out.println("Preorder Traversal : "); + theTree.Preorder(theTree.ReturnRoot()); + //System.out.println(" "); + //System.out.println(); + //System.out.println("Postorder Traversal : "); + theTree.Postorder(theTree.ReturnRoot()); + //System.out.println(" "); + //System.in.read(); + } +} \ No newline at end of file diff --git a/daikon equivalent mutations/Fibonacci.java b/daikon equivalent mutations/Fibonacci.java new file mode 100644 index 0000000..c8a9a17 --- /dev/null +++ b/daikon equivalent mutations/Fibonacci.java @@ -0,0 +1,26 @@ +// http://www.sanfoundry.com/csharp-program-generate-fibonocci-series/ + +/* + * C# Program to Generate Fibonacci Series + */ + +class Program +{ + static void main(String[] args) + { + int i, count, f1 = 0, f2 = 1, f3 = 0; + System.out.print("Enter the Limit : "); + count = System.in.read(); + System.out.println(f1); + System.out.println(f2); + for (i = 0; i <= count; i++) + { + f3 = f1 + f2; + System.out.println(f3); + f1 = f2; + f2 = f3; + } + System.in.read(); + + } +} \ No newline at end of file diff --git a/daikon equivalent mutations/MinsMaxs.class b/daikon equivalent mutations/MinsMaxs.class new file mode 100644 index 0000000000000000000000000000000000000000..5f83d096ab741961b9ef06e1f0ca6685b6ac9932 GIT binary patch literal 655 zcmYLGO=}ZT6g_w5y_q!MwHa|t(pFdP&{z^Ai&`sU6$BHZ5utV=lQ_hw(@9My(jSnW zKR`i5$fhg7k45ooL=XgjhAV$ViPbwHvBP`!o_Fs#hq>?lJpLF0xCkQ-4Ot!2aVSwf zrDH}%j-ai&z8kC&)P=>n1aYnNz#(LAxxQ2H?KGY49lPmqCDC?*n(Ob??EO7LY+-9_ zeUUdI)d=j?qnf=tCdM0`Ubp4ka3fV}BDt__Ke3b05hI+B@Umz7?d6-E=d^9_YPa3n zas1%=e#_Yn+>TFBBJbElPRO2!Za24`R)BMmJX7>3pvaly6rYNmiL<m0L2nrl;vBV6 zQDI5~Nybbi2ZDvb4=Y^Fivbd!pllvO{c5R|@UmDd<_9pXVkIoRI_dRQI{5p$@L8|( zUJ+_l8nQ6JY{`%;Gh}(g6#rpgGWnN?IP6tdtD2!P`HE%8ilLQDyq~{Bn)A4_G0yCv zm7l#pCIXXQUt_m#BhPp83&e^vrCMs3Qka6{8y-a&4SNr#8BamwQ<eudkU{}zEOD-I zrHW}>!VK1tL!G;ujPK(N9>T<9oW)b*alrUB*WP0mA25dy^Z3rUo?_=EB!|e-A816m eBgkVUbO>H_g!v&98uCNW<+;O)FFQT@v&=s>RDECo literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/MinsMaxs.java b/daikon equivalent mutations/MinsMaxs.java new file mode 100644 index 0000000..bb10fc1 --- /dev/null +++ b/daikon equivalent mutations/MinsMaxs.java @@ -0,0 +1,37 @@ + +public class MinsMaxs { + + /** + * Given an NxM matrix of double-values, calculate the minimum and maximum of every column in the matrix. + * The mins and maxs are returned as a pair of arrays. + */ + static public double[][] getMinsMaxs(double[][] data) { + int N = data.length ; + if (N < 1) throw new IllegalArgumentException() ; + int rowWidth = data[0].length ; + // check if every row has the same length: + for (int r1=1; r1<N; r1++) + if (data[r1].length != rowWidth) throw new IllegalArgumentException() ; + + double[] mins = new double[rowWidth] ; + double[] maxs = new double[rowWidth] ; + // initialize mins and maxs: + for (int c1=0; c1<rowWidth; c1++) { + mins[c1] =data[0][c1] ; + maxs[c1] =data[0][c1] ; + } + // iterate over the matrix: + for (int r=1; r<N; r++) { + for (int c=0; c<rowWidth; c++) { + if (data[r][c] <= mins[c]) mins[c] = data[r][c] ; // mutate this + if (data[r][c] >= maxs[c]) maxs[c] = data[r][c] ; // mutate this + } + } + double[][] output = new double[2][] ; + output[0] = mins ; + output[1] = maxs ; + return output ; + } + + +} diff --git a/daikon equivalent mutations/Mutants/2D_to_1D_no_1D.java b/daikon equivalent mutations/Mutants/2D_to_1D_no_1D.java new file mode 100644 index 0000000..ce06d68 --- /dev/null +++ b/daikon equivalent mutations/Mutants/2D_to_1D_no_1D.java @@ -0,0 +1,60 @@ +//http://www.sanfoundry.com/csharp-program-convert-2darray-1darray/ + + +class twodmatrix +{ + int m, n; + int[][] a; + int[] b; + twodmatrix(int x, int y) + { + this.m = x; + this.n = y; + this.a = new int[this.m][this.n]; + } + public void readmatrix() + { + for (int i1 = 0; i1 < this.m; i1++) + { + for (int j1 = 0; j1 < this.n; j1++) + { + //System.out.printf("a[{0},{1}]=", i1, j1); + this.a[i1][j1] = 1; //System.in.read(); + } + } + } + public void printd() + { + for (int i2 = 0; i2 < this.m; i2++) + { + for (int j2 = 0; j2 < this.n; j2++) + { + //System.out.printf("{0}\t", this.a[i2][j2]); + + } + //System.out.printf("\n"); + } + } + public void printoned() + { + for (int i4 = 0; i4 < this.m; i4++) + { + for (int j4 = 0; j4 < this.n; j4++) + { + //Console.WriteLine("{0}\t", a[i*n+j]); + } + } + } + + + public static void main(String[] args) + { + twodmatrix obj = new twodmatrix(2,3); + //System.out.printf("Enter the Elements : "); + obj.readmatrix(); + //System.out.printf("\t\t Given 2-D Array(Matrix) is : "); + obj.printd(); + //System.out.printf("\t\t Converted 1-D Array is : "); + obj.printoned(); + } +} \ No newline at end of file diff --git a/daikon equivalent mutations/Mutants/2D_to_1D_no_counter.java b/daikon equivalent mutations/Mutants/2D_to_1D_no_counter.java new file mode 100644 index 0000000..f4baed1 --- /dev/null +++ b/daikon equivalent mutations/Mutants/2D_to_1D_no_counter.java @@ -0,0 +1,70 @@ +//http://www.sanfoundry.com/csharp-program-convert-2darray-1darray/ + + +class twodmatrix +{ + int m, n; + int[][] a; + int[] b; + twodmatrix(int x, int y) + { + this.m = x; + this.n = y; + this.a = new int[this.m][this.n]; + this.b = new int[this.m * this.n]; + } + public void readmatrix() + { + for (int i1 = 0; i1 < this.m; i1++) + { + for (int j1 = 0; j1 < this.n; j1++) + { + //System.out.printf("a[{0},{1}]=", i1, j1); + this.a[i1][j1] = 1; //System.in.read(); + } + } + } + public void printd() + { + for (int i2 = 0; i2 < this.m; i2++) + { + for (int j2 = 0; j2 < this.n; j2++) + { + //System.out.printf("{0}\t", this.a[i2][j2]); + + } + //System.out.printf("\n"); + } + } + public void convert() + { + for (int i3 = 0; i3 < this.m; i3++) + { + for (int j3 = 0; j3 < this.n; j3++) + { + this.b[i3*this.n+j3] = this.a[i3][j3]; + } + } + } + public void printoned() + { + this.convert(); + + for (int i4 = 0; i4 < this.m * this.n; i4++) + { + //System.out.printf("{0}\t", this.b[i4]); + } + } + + + public static void main(String[] args) + { + twodmatrix obj = new twodmatrix(2,3); + //System.out.printf("Enter the Elements : "); + obj.readmatrix(); + //System.out.printf("\t\t Given 2-D Array(Matrix) is : "); + obj.printd(); + //System.out.printf("\t\t Converted 1-D Array is : "); + obj.printoned(); + } +} \ No newline at end of file diff --git a/daikon equivalent mutations/Mutants/BST_no_parent.java b/daikon equivalent mutations/Mutants/BST_no_parent.java new file mode 100644 index 0000000..48b1971 --- /dev/null +++ b/daikon equivalent mutations/Mutants/BST_no_parent.java @@ -0,0 +1,133 @@ +// http://www.sanfoundry.com/csharp-program-binary-search-tree-linked-list/ + +/* + * C# Program to Implement Binary Search Tree using Linked List + */ + +class Node +{ + public int item; + public Node leftc; + public Node rightc; + + public Node(int item, Node leftc, Node rightc) + { + this.item = item; + this.leftc = leftc; + this.rightc = rightc; + } + + public Node() + {} + + public void display() + { + //System.out.print("["); + //System.out.print(this.item); + //System.out.print("]"); + } +} + +class Tree +{ + public Node root; + + public Tree() + { + this.root = null; + } + public Node ReturnRoot() + { + return this.root; + } + public void Insert(int id) + { + Node newNode = new Node(); + newNode.item = id; + if (this.root == null) + this.root = newNode; + else + { + Node current = this.root; + while (true) + { + if (id < current.item) + { + if (current.leftc == null) + { + current.leftc = newNode; + return; + } + current = current.leftc; + } + else + { + if (current.rightc == null) + { + current.rightc = newNode; + return; + } + current = current.rightc; + } + } + } + } + public void Preorder(Node root1) + { + if (root1 != null) + { + //System.out.print(root1.item + " "); + Preorder(root1.leftc); + Preorder(root1.rightc); + } + } + public void Inorder(Node root2) + { + if (root2 != null) + { + Inorder(root2.leftc); + //System.out.print(root2.item + " "); + Inorder(root2.rightc); + } + } + public void Postorder(Node root3) + { + if (root3 != null) + { + Postorder(root3.leftc); + Postorder(root3.rightc); + //System.out.print(root3.item + " "); + } + } +} + +class Program +{ + static void main(String[] args) + { + Tree theTree = new Tree(); + theTree.Insert(20); + theTree.Insert(25); + theTree.Insert(45); + theTree.Insert(15); + theTree.Insert(67); + theTree.Insert(43); + theTree.Insert(80); + theTree.Insert(33); + theTree.Insert(67); + theTree.Insert(99); + theTree.Insert(91); + //System.out.println("Inorder Traversal : "); + theTree.Inorder(theTree.ReturnRoot()); + //System.out.println(" "); + //System.out.println(); + //System.out.println("Preorder Traversal : "); + theTree.Preorder(theTree.ReturnRoot()); + //System.out.println(" "); + //System.out.println(); + //System.out.println("Postorder Traversal : "); + theTree.Postorder(theTree.ReturnRoot()); + //System.out.println(" "); + //System.in.read(); + } +} \ No newline at end of file diff --git a/daikon equivalent mutations/Mutants/Fibonacci_no_extra_prints.java b/daikon equivalent mutations/Mutants/Fibonacci_no_extra_prints.java new file mode 100644 index 0000000..e45c9c6 --- /dev/null +++ b/daikon equivalent mutations/Mutants/Fibonacci_no_extra_prints.java @@ -0,0 +1,24 @@ +// http://www.sanfoundry.com/csharp-program-generate-fibonocci-series/ + +/* + * C# Program to Generate Fibonacci Series + */ + +class Program +{ + static void main(String[] args) + { + int i, count, f1 = 0, f2 = 1, f3 = 0; + System.out.print("Enter the Limit : "); + count = System.in.read(); + for (i = 0; i <= count + 2; i++) + { + f3 = f1 + f2; + System.out.println(f1); + f1 = f2; + f2 = f3; + } + System.in.read(); + + } +} \ No newline at end of file diff --git a/daikon equivalent mutations/Mutants/MinsMaxs_R1.java b/daikon equivalent mutations/Mutants/MinsMaxs_R1.java new file mode 100644 index 0000000..36c873a --- /dev/null +++ b/daikon equivalent mutations/Mutants/MinsMaxs_R1.java @@ -0,0 +1,36 @@ + + +public class MinsMaxs_R1 { + + /** + * Refactoring R1: replacing some <= and >= to improve efficiency. + */ + static public double[][] getMinsMaxs(double[][] data) { + int N = data.length ; + if (N < 1) throw new IllegalArgumentException() ; + int rowWidth = data[0].length ; + // check if every row has the same lenght: + for (int r1=1; r1<N; r1++) + if (data[r1].length != rowWidth) throw new IllegalArgumentException() ; + + double[] mins = new double[rowWidth] ; + double[] maxs = new double[rowWidth] ; + // initialize mins and maxs: + for (int c1=0; c1<rowWidth; c1++) { + mins[c1] =data[0][c1] ; + maxs[c1] =data[0][c1] ; + } + // iterate over the matrix: + for (int r=1; r<data.length; r++) { + for (int c=0; c<rowWidth; c++) { + if (data[r][c] < mins[c]) mins[c] = data[r][c] ; // more efficient + if (data[r][c] > maxs[c]) maxs[c] = data[r][c] ; // more efficient + } + } + double[][] output = new double[2][] ; + output[0] = mins ; + output[1] = maxs ; + return output ; + } + +} diff --git a/daikon equivalent mutations/Mutants/MinsMaxs_R2.java b/daikon equivalent mutations/Mutants/MinsMaxs_R2.java new file mode 100644 index 0000000..461b158 --- /dev/null +++ b/daikon equivalent mutations/Mutants/MinsMaxs_R2.java @@ -0,0 +1,35 @@ + +public class MinsMaxs_R2 { + + /** + * Refactoring R2: moving the check for equal length rows to inside the main loop. + */ + static public double[][] getMinsMaxs(double[][] data) { + int N = data.length ; + if (N < 1) throw new IllegalArgumentException() ; + int rowWidth = data[0].length ; + + double[] mins = new double[rowWidth] ; + double[] maxs = new double[rowWidth] ; + + // initialize mins and maxs: + for (int c1=0; c1<rowWidth; c1++) { + mins[c1] =data[0][c1] ; + maxs[c1] =data[0][c1] ; + } + // iterate over the matrix: + for (int r=1; r<data.length; r++) { + // first check if the row has the same length as data[0]: + if (data[r].length != rowWidth) throw new IllegalArgumentException() ; + for (int c=0; c<rowWidth; c++) { + if (data[r][c] <= mins[c]) mins[c] = data[r][c] ; + if (data[r][c] >= maxs[c]) maxs[c] = data[r][c] ; + } + } + double[][] output = new double[2][] ; + output[0] = mins ; + output[1] = maxs ; + return output ; + } + +} diff --git a/daikon equivalent mutations/Mutants/MinsMaxs_R3.java b/daikon equivalent mutations/Mutants/MinsMaxs_R3.java new file mode 100644 index 0000000..9bc0439 --- /dev/null +++ b/daikon equivalent mutations/Mutants/MinsMaxs_R3.java @@ -0,0 +1,35 @@ + +public class MinsMaxs_R3 { + + /** + * Refactoring R3: changing the main loop from a row-column loop, to column-row loop. + */ + static public double[][] getMinsMaxs(double[][] data) { + int N = data.length ; + if (N < 1) throw new IllegalArgumentException() ; + int rowWidth = data[0].length ; + // check if every row has the same length: + for (int r1=1; r1<N; r1++) + if (data[r1].length != rowWidth) throw new IllegalArgumentException() ; + + double[] mins = new double[rowWidth] ; + double[] maxs = new double[rowWidth] ; + // initialize mins and maxs: + for (int c1=0; c1<rowWidth; c1++) { + mins[c1] =data[0][c1] ; + maxs[c1] =data[0][c1] ; + } + // iterate over the matrix: + for (int c=0; c<rowWidth; c++) { + for (int r=1; r<N; r++) { + if (data[r][c] <= mins[c]) mins[c] = data[r][c] ; // mutate this + if (data[r][c] >= maxs[c]) maxs[c] = data[r][c] ; // mutate this + } + } + double[][] output = new double[2][] ; + output[0] = mins ; + output[1] = maxs ; + return output ; + } + +} diff --git a/daikon equivalent mutations/Mutants/Node.class b/daikon equivalent mutations/Mutants/Node.class new file mode 100644 index 0000000000000000000000000000000000000000..f0a645ef9eb9cc339497e7914d655c0ed80cafb7 GIT binary patch literal 424 zcmZ8c%TB^T6g>ldK&=Ahq4-E#LZh;ACvl;P2?@ak#4RZ>;*e5EEhc`J3u5BJ5AdUm zXA058&AE5(dE7f+-yfd<E^+9<LM0CqRSh)_`!)`2)CCNc$hm;%2$-RKOvVCMx3`$c zD>kv3KBbekid1qfP;7KI<OZ7$47jCOpwLy3?5*Y_84rR{$Vs-LX?vocmtpWK;Pe-( zcr5RfCcT^fU>Gfi%OI9faxn{D0v9fdE^Opn<l(s3fx~!x3m0oeD-5D(>wYwo;{>Pt zg~k76!6nGC6WW$mI=76AUC#ITY9j-Kwc@`+_(yAG{IfN({`nflTk0whYfJ_81`13o pvMZqsj~P5}n{>h|s4{iZpVdl-RbuH^T2F&{+JD(GWgf{4%0EetJR1N2 literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Mutants/Normalizer_R1.class b/daikon equivalent mutations/Mutants/Normalizer_R1.class new file mode 100644 index 0000000000000000000000000000000000000000..09fe05f6a43ac426feb3eff2dcd6cf8adf53e80d GIT binary patch literal 533 zcmZ8dO-sW-5Ph4^8ttb>D^iM{YAu$E3WACsRS>j=Rzwkzw1$$JCK6H+&;AF&i_nW_ zPl7@{c=Mn57fMlQt0KC~&b*zOxBF&Z-yhomW-+KiMp#8egTQ@MMT|jNv>eM{W)M@8 zdkoULdtx$#w=KskG#eGu+chdSMfx1qYZ$h5NmxrA=4l`1IU`v1jq2%+arRxPmEERS zH8(BJiWPoX-f<~6T{q5+0Vq%zCOFR8hEvOK*|u3T>{YMUY?zL}aZxqTe9Lv{?LTye z$S<i_shd?F<B+H;z64M+P{{`9mLSi_%jpNOdjiw}S)~^g32W#l%uC-Ws*yiWx0k2d ziCgqPK{$AT_$<y#x|C_RaFo%dnSUu+mlG{4P3dwjO{cb?#FfzX%`cmCD6tUu0`Wkv zEUvhvE1BJWyj)3STU?va)3$~P;Xa6@CQ9mtFn}=xkwFMqgfU0?70MJ5!#)OKQH2d1 kE{5S@1Wm+=0gOWJBFefD*a$aWB*hMr9hwtOwD(=;6HRhzEC2ui literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Mutants/Normalizer_R1.java b/daikon equivalent mutations/Mutants/Normalizer_R1.java new file mode 100644 index 0000000..8600000 --- /dev/null +++ b/daikon equivalent mutations/Mutants/Normalizer_R1.java @@ -0,0 +1,26 @@ +import java.lang.IllegalArgumentException; + +public class Normalizer_R1 { + + /** + * R1: Restructuring the check that mins and max should be of the same length. + */ + static public void normalize(double[] mins, double[] maxs, double[][] data) { + int rowWidth = mins.length ; + if (maxs.length != rowWidth) { throw new IllegalArgumentException() ; } + int row = 0 ; + while (row < data.length) { + if (data[row].length != rowWidth) { throw new IllegalArgumentException() ; } + int col = 0 ; + while (col < rowWidth) { + double delta = maxs[col] - mins[col] ; + if (delta == 0) throw new IllegalArgumentException() ; + double x = data[row][col] ; + data[row][col] = (x - mins[col])/delta ; + col++ ; + } + row++ ; + } + } + +} diff --git a/daikon equivalent mutations/Mutants/Normalizer_R2.class b/daikon equivalent mutations/Mutants/Normalizer_R2.class new file mode 100644 index 0000000000000000000000000000000000000000..202c7bf827c8a767d3ea22e6c2302515ad3e4cf9 GIT binary patch literal 631 zcmY+BUu)A)7{;H|{IgxwZtJoZT`wHNW!-daNI{T+7>AR&K_>(4#W<}YWTwf8sfgG6 z4uUtzZoCw)CKKbmAHokJ^Urgt>yVK5yywmPJo&xneEW5p1GtHL2_~u*rb{TGT7m(` z!i<HQfO$KN!)#qZa~Jmn^t;JZU!bxT#{Tx8-}Tc+vKz5djFYr4qwp2;lH2k4bUdXP z-_2z2*+Y5wudzI8+>_CO-KOh#-l9j@y_Y@zFbk9TIXAn>Ano}Zp)#M^J~vPI+iN!t z<O^xT!X<$@m9IoH4pug!$PZ+6Ck+ODKh8#GHp-}w<3A69i3{aU_rULExXQUro(G^o zD0{{tcMYzBtI<4x_{fBGjOMVYv1JT4bJcoEk+SGC^L4GIFXfGQ*mU&e{1^|G9epit zyv5jO6ds>I`>M4J$7md5PJMBVzj3wc7^_QsKS6IF8RGr#??*c0mvfZ@C=3Bw7-wE2 zt-3x1VWZ00JO^Gt1=lfw4NPK-)g4TujTt;aZK#@r`4hGfwKEjN{0|rwO?XbUR&(5k z&PjmTy6y(I%(_{A{pJGvnj6&3<iiN0Oa$OEA+Er|?C=LXoijKZ5kN0NUqKXwKJ^DY C=yZ+% literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Mutants/Normalizer_R2.java b/daikon equivalent mutations/Mutants/Normalizer_R2.java new file mode 100644 index 0000000..062d114 --- /dev/null +++ b/daikon equivalent mutations/Mutants/Normalizer_R2.java @@ -0,0 +1,31 @@ +import java.lang.IllegalArgumentException; + +public class Normalizer_R2 { + + /** + * R2: moving the element-level normalization to a separate method. + */ + static public void normalize(double[] mins, double[] maxs, double[][] data) { + int rowWidth = mins.length ; + int row = 0 ; + if (maxs.length == rowWidth) { + while (row < data.length) { + if (data[row].length != rowWidth) { throw new IllegalArgumentException() ; } + int col = 0 ; + while (col < rowWidth) { + data[row][col] = normalizeValue(data[row][col] ,mins[col],maxs[col]) ; + col++ ; + } + row++ ; + } + } + else { throw new IllegalArgumentException() ; } + } + + static private double normalizeValue(double x, double min, double max) throws IllegalArgumentException { + double delta = max - min ; + if (delta == 0) throw new IllegalArgumentException() ; + return (x - min)/delta ; + } + +} diff --git a/daikon equivalent mutations/Mutants/Normalizer_R3.class b/daikon equivalent mutations/Mutants/Normalizer_R3.class new file mode 100644 index 0000000000000000000000000000000000000000..22fff9315e7ef23deb9f7feb729799f6bcade977 GIT binary patch literal 523 zcmY*V$w~u35Pdyck})PRGMY;e#e>ErxDXUn5H|!jR0I)`P8^1blbJ9~L_PZtf)^zh z&z=N@@!-v$@H-T@>Zk;}>8jVS-fOD*`SU&mFphQ|Dv}YTbVwq%MUZCDrfk;^W*FqY z{v8Ho&O0<2k}I}ruGK0<)8FPrhnSe_`4#TiXN2{>y?NSu^TN@(74Xv0DzE+u^)0XF zm&`?5xYBEXF8^S2Y`Dyic^n!d3_Swp9qwBBWydis?#%jDtzx>t!b!=j2DazY+yCqg zsitYYST;)mx}nfiVo9K35TO{QTb44Ttmf{(ZVAu?6txB^6V}l}SV&)p)hVCm!kK|E zdyTSOPz+@-tYd%BP)5V-6<Qu3?cPCtlnbh%X6u+9Fw~J89cxm{Xo-u<rbKwCFd6*; znP@|n(Y(!bmEC+johuaUH%)_RPinMRKr7)GWNIiz4YnhWUgCz3zyy+5LJAvb11HX+ kdKCsv&_OC7gXjn1jCH<4V(;jZU(xjjRT4iUUX_se250tY>;M1& literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Mutants/Normalizer_R3.java b/daikon equivalent mutations/Mutants/Normalizer_R3.java new file mode 100644 index 0000000..2572093 --- /dev/null +++ b/daikon equivalent mutations/Mutants/Normalizer_R3.java @@ -0,0 +1,24 @@ +import java.lang.IllegalArgumentException; + +public class Normalizer_R3 { + + /** + * R3: converting while loop to for loop. + */ + static public void normalize(double[] mins, double[] maxs, double[][] data) { + int rowWidth = mins.length ; + if (maxs.length == rowWidth) { + for (int row=0; row < data.length; row++) { + if (data[row].length != rowWidth) { throw new IllegalArgumentException() ; } + for (int col=0; col < rowWidth; col++) { + double delta = maxs[col] - mins[col] ; + if (delta == 0) throw new IllegalArgumentException() ; + double x = data[row][col] ; + data[row][col] = (x - mins[col])/delta ; + } + } + } + else { throw new IllegalArgumentException() ; } + } + +} diff --git a/daikon equivalent mutations/Mutants/Normalizer_R4.class b/daikon equivalent mutations/Mutants/Normalizer_R4.class new file mode 100644 index 0000000000000000000000000000000000000000..2e7b402415d9655d8ec93608c648a7859ae83880 GIT binary patch literal 655 zcmY*VO=}ZT6g_V~lS$g7NvD~pV^jpwv|5x>tRIDHRfJk4Ed}X9Cdp$uaX!j0(b9GN z4T2jbo36VGSePu_`IAchxG$o?8Rp*m&OPV8bLacduPK0KTriM9S;wpaNo3Q2g0cv6 zIx0FW2JL|tddV7tT%X@%P##Ae&QRF&LcY}tT0GuyT0SA!Fp2}m_l~GG>U$gX?rjLg z)OO;u-@b4T#zeY{`rA=2Zu6&}5SF(73gb7;<y&3nos&lv27@i?CEp3%rS;fL_5+@H z?I(wAevo)k$Z&1afA0I-b^P_%?FBqc{*lC_DtY+t4u;}H`LfmJ?S#RqZ%)9S{Wy9r z_PRg6i>uJ-FNsG2?FoZoj!rgZMp<nP!A_`P$WzqDphCncOjAu%RwmS--iJoICa)+9 zsr>~VQ&~(0;ESemC$&E#cM9qC5b{V~QBBnz;NgO)-fqz6u4<Mx{qfU;A~e)k&HO2> z%$R0rQM0eI<6qzU3dO-G6dI_Gj#0R$ibGW$LK~fsDGfaw(mvAIauc&;&VWp2HL{&2 z<7E_Z9Yx&03~r)?yM#O=-Yb}JFozB*aABc~Dgs=jc{Q47;|Q10#}!fomyrE|JY$t} YNbDRn`3$u)sQM!v#T>bqA&!L7Z<r8;2mk;8 literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Mutants/Normalizer_R4.java b/daikon equivalent mutations/Mutants/Normalizer_R4.java new file mode 100644 index 0000000..9ead768 --- /dev/null +++ b/daikon equivalent mutations/Mutants/Normalizer_R4.java @@ -0,0 +1,34 @@ +import java.lang.IllegalArgumentException; +import java.lang.ArithmeticException; + +public class Normalizer_R4 { + + /** + * R4: Re-routing exceptional control flow via a different exception. + */ + static public void normalize(double[] mins, double[] maxs, double[][] data) { + int rowWidth = mins.length ; + int row = 0 ; + try { + if (maxs.length == rowWidth) { + while (row < data.length) { + if (data[row].length != rowWidth) { throw new ArithmeticException() ; } + int col = 0 ; + while (col < rowWidth) { + double delta = maxs[col] - mins[col] ; + if (delta == 0) throw new ArithmeticException() ; + double x = data[row][col] ; + data[row][col] = (x - mins[col])/delta ; + col++ ; + } + row++ ; + } + } + else { throw new IllegalArgumentException() ; } + } + catch (ArithmeticException e) { + throw new IllegalArgumentException(e) ; + } + } + +} diff --git a/daikon equivalent mutations/Mutants/Program.class b/daikon equivalent mutations/Mutants/Program.class new file mode 100644 index 0000000000000000000000000000000000000000..49448c3e5caa4f88c732917d0f22aa518d60c376 GIT binary patch literal 573 zcmYk2-D(q26otQ&rkOO3CbqHKYPGSYOdGWzUI>+5v?4@84M`AcFUll6#3{*{dNQea z;f3G}dDDP`58y+I`y4BEV7|Rr?4LFB>-YDcz%$lMlvoI;mdLT-aLZxQ;kLsahoyk! zfV+yqi^L?^u3{$Ie5=UsrzcubZYD+_Oh!FzyK!$QPJR?8MzI(jHBaO7czYO|!FDIJ zi5cv;!BQuk*uH+1xaRr2PWRZP$7iwCCVS!rLaq_Yny%G4<Q^*__jwSqN-gA}!x}Y3 z(6Z^k#v?`L>dc$osqSZzwPD8EipWO|f3vN#i8bvs6|Wd=HV-8Hjx1@I)ShUon2Y{; zuDjT>`k&oO$C=l1e@_0FdvfwhMikdYtw>c;XSb%PZz2>ogavQDr%0KKXxBQGQ8(QG zLGEzMOtW68UXZU>mOLMOmOb}9>z*yo+JAoE>mx^LnZ2NJS%b@3yb7`>=V2&8MiR_W rC1sg2`JNAKV0pxtr(`^5!Y=2$<Rh>7M4QjN;|o2$O8lF$Bggz7C**1n literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Mutants/Stack_bool_is_result.java b/daikon equivalent mutations/Mutants/Stack_bool_is_result.java new file mode 100644 index 0000000..89a8d19 --- /dev/null +++ b/daikon equivalent mutations/Mutants/Stack_bool_is_result.java @@ -0,0 +1,126 @@ +// http://www.sanfoundry.com/csharp-program-stack-push-pop/ + +/* + * C# Program to Implement Stack with Push and Pop operations + */ + +class Program +{ + static void main(String[] args) + { + stack st = new stack(); + while (true) + { + System.out.println("\nStack MENU(size -- 10)"); + System.out.println("1. Add an element"); + System.out.println("2. See the Top element."); + System.out.println("3. Remove top element."); + System.out.println("4. Display stack elements."); + System.out.println("5. Exit"); + System.out.print("Select your choice: "); + int choice = System.in.read(); + switch (choice) + { + case 1: + System.out.println("Enter an Element : "); + st.Push(System.in.read()); + break; + + case 2: System.out.printf("Top element is: {0}", st.Peek()); + break; + + case 3: System.out.printf("Element removed: {0}", st.Pop()); + break; + + case 4: st.Display(); + break; + + case 5: System.exit(1); + break; + } + System.in.read(); + } + } + } + + interface StackADT + { + boolean isEmpty(); + void Push(Object element); + Object Pop(); + Object Peek(); + void Display(); + } + + class stack implements StackADT + { + public int StackSize; + public int top; + Object[] item; + + public stack() + { + this.StackSize = 10; + this.item = new Object[this.StackSize]; + this.top = -1; + } + public stack(int capacity) + { + this.StackSize = capacity; + this.item = new Object[this.StackSize]; + this.top = -1; + } + public boolean isEmpty() + { + return this.top == -1; + } + public void Push(Object element) + { + if (this.top == (this.StackSize - 1)) + { + System.out.println("Stack is full!"); + } + + else + { + + this.item[++this.top] = element; + System.out.println("Item pushed successfully!"); + } + } + public Object Pop() + { + if (this.isEmpty()) + { + System.out.println("Stack is empty!"); + return "No elements"; + } + else + { + + return this.item[this.top--]; + } + } + public Object Peek() + { + if (this.isEmpty()) + { + System.out.println("Stack is empty!"); + return "No elements"; + } + else + { + return this.item[this.top]; + } + } + + + public void Display() + { + for (int i = this.top; i > -1; i--) + { + + System.out.printf("Item {0}: {1}", (i + 1), this.item[i]); + } + } +} diff --git a/daikon equivalent mutations/Mutants/Stack_constructor_duplication.java b/daikon equivalent mutations/Mutants/Stack_constructor_duplication.java new file mode 100644 index 0000000..04c4580 --- /dev/null +++ b/daikon equivalent mutations/Mutants/Stack_constructor_duplication.java @@ -0,0 +1,126 @@ +// http://www.sanfoundry.com/csharp-program-stack-push-pop/ + +/* + * C# Program to Implement Stack with Push and Pop operations + */ + +class Program +{ + static void main(String[] args) + { + stack st = new stack(); + while (true) + { + System.out.println("\nStack MENU(size -- 10)"); + System.out.println("1. Add an element"); + System.out.println("2. See the Top element."); + System.out.println("3. Remove top element."); + System.out.println("4. Display stack elements."); + System.out.println("5. Exit"); + System.out.print("Select your choice: "); + int choice = System.in.read(); + switch (choice) + { + case 1: + System.out.println("Enter an Element : "); + st.Push(System.in.read()); + break; + + case 2: System.out.printf("Top element is: {0}", st.Peek()); + break; + + case 3: System.out.printf("Element removed: {0}", st.Pop()); + break; + + case 4: st.Display(); + break; + + case 5: System.exit(1); + break; + } + System.in.read(); + } + } + } + + interface StackADT + { + boolean isEmpty(); + void Push(Object element); + Object Pop(); + Object Peek(); + void Display(); + } + + class stack implements StackADT + { + public int StackSize; + public int top; + Object[] item; + + public stack() + { + this(10); + } + public stack(int capacity) + { + this.StackSize = capacity; + this.item = new Object[this.StackSize]; + this.top = -1; + } + public boolean isEmpty() + { + if (this.top == -1) return true; + + return false; + } + public void Push(Object element) + { + if (this.top == (this.StackSize - 1)) + { + System.out.println("Stack is full!"); + } + + else + { + + this.item[++this.top] = element; + System.out.println("Item pushed successfully!"); + } + } + public Object Pop() + { + if (this.isEmpty()) + { + System.out.println("Stack is empty!"); + return "No elements"; + } + else + { + + return this.item[this.top--]; + } + } + public Object Peek() + { + if (this.isEmpty()) + { + System.out.println("Stack is empty!"); + return "No elements"; + } + else + { + return this.item[this.top]; + } + } + + + public void Display() + { + for (int i = this.top; i > -1; i--) + { + + System.out.printf("Item {0}: {1}", (i + 1), this.item[i]); + } + } +} diff --git a/daikon equivalent mutations/Mutants/Stack_useless_property.java b/daikon equivalent mutations/Mutants/Stack_useless_property.java new file mode 100644 index 0000000..525c7c2 --- /dev/null +++ b/daikon equivalent mutations/Mutants/Stack_useless_property.java @@ -0,0 +1,126 @@ +// http://www.sanfoundry.com/csharp-program-stack-push-pop/ + +/* + * C# Program to Implement Stack with Push and Pop operations + */ + +class Program +{ + static void main(String[] args) + { + stack st = new stack(); + while (true) + { + System.out.println("\nStack MENU(size -- 10)"); + System.out.println("1. Add an element"); + System.out.println("2. See the Top element."); + System.out.println("3. Remove top element."); + System.out.println("4. Display stack elements."); + System.out.println("5. Exit"); + System.out.print("Select your choice: "); + int choice = System.in.read(); + switch (choice) + { + case 1: + System.out.println("Enter an Element : "); + st.Push(System.in.read()); + break; + + case 2: System.out.printf("Top element is: {0}", st.Peek()); + break; + + case 3: System.out.printf("Element removed: {0}", st.Pop()); + break; + + case 4: st.Display(); + break; + + case 5: System.exit(1); + break; + } + System.in.read(); + } + } + } + + interface StackADT + { + boolean isEmpty(); + void Push(Object element); + Object Pop(); + Object Peek(); + void Display(); + } + + class stack implements StackADT + { + public int StackSize; + public int top; + Object[] item; + + public stack() + { + this.item = new Object[10]; + this.top = -1; + } + public stack(int capacity) + { + this.item = new Object[capacity]; + this.top = -1; + } + public boolean isEmpty() + { + if (this.top == -1) return true; + + return false; + } + public void Push(Object element) + { + if (this.top == (this.StackSize - 1)) + { + System.out.println("Stack is full!"); + } + + else + { + + this.item[++this.top] = element; + System.out.println("Item pushed successfully!"); + } + } + public Object Pop() + { + if (this.isEmpty()) + { + System.out.println("Stack is empty!"); + return "No elements"; + } + else + { + + return this.item[this.top--]; + } + } + public Object Peek() + { + if (this.isEmpty()) + { + System.out.println("Stack is empty!"); + return "No elements"; + } + else + { + return this.item[this.top]; + } + } + + + public void Display() + { + for (int i = this.top; i > -1; i--) + { + + System.out.printf("Item {0}: {1}", (i + 1), this.item[i]); + } + } +} diff --git a/daikon equivalent mutations/Mutants/Tree.class b/daikon equivalent mutations/Mutants/Tree.class new file mode 100644 index 0000000000000000000000000000000000000000..1e07da83109b20a76bd7c38c2b6284ebe6308b26 GIT binary patch literal 932 zcmaJ<TTjzq7=GGy>srdeF%%gnDB#weOgzMZk_bXFWplEHs4-c(@rlFHlG6Euyx~?7 zkVF$MCGpNb;g2vxeZDb~aKX*<9=`W^-b4HS_m@Kecabw;;ktnyjO&;%5t2a&HzeGY zFlq8_O2V{+TRM_DQVKNR^8y8t<&w81X6Za^y3JrtK`5D8<?{m53i_9ut|+xP>%y-( z^%gVciU``iyV7Atlc`gF!QB=<6}4nR3iMV2r}4h%Y;|~?O+mEm3(sE@z5*k8!jqMH z!Tpyld)q<RH!EJ-Z-}L)Y#N)dRBNtR+j4y22DuIAgJYo|0~UJG$Ch#j3pUagGU&6A zm2ed!77`LhF~Xv%FDNx2$@!M!uIHcEH$+2D+ziB~0;QlJ+!Akt2Cv~a*WU#VjPqm` z56xHEie7{sI}<N4vZ2xgO#1+et?WbH?NrBzeY`#}2@O*)FwMF_#JjvPTFDFBdr&`} zQlvPLA`am)QMNc_3yrq=6`@xL(2AMF{t530J$8mIcQ7MmN{Q?q!XGhA6FGvB<y&M| z2Bn=pKWX)DQkO}c$scl96>``)E(P8#iX0csbI{v7+Z{~cKIeJBXa@H%%jgknA7c>< zc#0=@h9y+!T_HP;$T3EB3?D-y#&zo#bZ)^9(cNX9-BeZ%rN3d&PII)+h)S!|{vRgR zS-40n^ZG9+T<J6jL6HaKH@!g5=;|5g^;W6(l6tSH_vWk~e~%0F%&wk!Uav+yhkAAD MiL-iR+)%}}zYS!Ls{jB1 literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Mutants/Vector_R1.class b/daikon equivalent mutations/Mutants/Vector_R1.class new file mode 100644 index 0000000000000000000000000000000000000000..f314681b8d3ff54019a262960baa855eb8a97365 GIT binary patch literal 989 zcmZuuTWb?R7(KI_WOvh~t+7$pG`*y^TzVlOeQ0Y@T7^KXkVql)K{o3W(&kcPT5Q1w zq2QZ;K`2N-d}u+f*b?9U6XGxMy=d#1ZD@;_&CGnabLRWbd_Vo#0&oXOKm6!5pd;!> zANu{Y1~d%%;YF`>Vj70zIjmtsz_;btjapqmSzV+zSE`m8^8()Z>SAI=z_U<$<_L5x zm8#C8%}T+kKd}mBMvS7<SZPB&@q`2ia}CR0U$!>f5)A<Xja9kQ4(ru;B17M<RSKjM zFyon}bNth6dNy&zW_tquTy3*%I}c0puFi|X$u(=s3LuEl06GxRFcv@@i2%a5ArO<< zsj^iqPG!nvr)ZV$*NdAKr`mY%!ge+qrCK$BYY4IX3r0!SDbRfheOy@MTyDn{;7TI5 z{k-8+2)62VYum1EYzrjgOaCHgGye%?5-S*_=zhKtwU*7(^3dk>+`H)A<qIi1&Ez3O zGSxcPK0!&T$&XOfRO<`W0~g%QJwzzr<4&1LdkY3hI9i)3&y1{yNpNc}a;z<@^U=s2 zLgP^xil(!>s%W158sBG?f=kW-S%Yk|69a7OI<rA2r+iBdJ>rA`A+>H_)5lZDM%-&Y z(4t_{ccZeIn{3UUPNW%?(;tj~hR3aci;g3B^M~+#bNyp&#>b>Kqeb4ckiS=4l3(TO zZLhpKt*g^U*l;m>h=%po(hM7EQ{%R7znRu|4G#CiLq@|iR90k7W5(CS1i@jwjf|MS zb33d{sGhd7yE<_{oA8SLBj|b4cL?KBp&6<o8|gumUmu3hk9&w=fz}#^QNswfFp3?F z;U$vTLkjOOfhMM0B`0C@oH3?rFsY|WGOEfy@P}7Y-k}qOenX)(s7PsVvqVAUFP|y3 ADF6Tf literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Mutants/Vector_R1.java b/daikon equivalent mutations/Mutants/Vector_R1.java new file mode 100644 index 0000000..2bb0591 --- /dev/null +++ b/daikon equivalent mutations/Mutants/Vector_R1.java @@ -0,0 +1,50 @@ + +public class Vector_R1 { + + private double[] vector; + + public Vector_R1(double[] vec) { + this.vector = new double[vec.length] ; + System.arraycopy(vec, 0, this.vector, 0, vec.length); + } + + public double[] getVector() { + int N = this.vector.length ; + double[] V = new double[N] ; + for (int k=0; k<N; k++) V[k] = this.vector[k] ; + return V ; + } + + public int getSize() { return this.vector.length ; } + + + /** + * R1 replaces the return in the INPRODUCT-case with a break. + */ + public Vector_R1 combine(int operation, Vector_R1 Z) { + final int ACCUMULATE = 1; + final int INPRODUCT = 2; + final int PLUS = 3; + if (Z.getSize() != this.vector.length) throw new IllegalArgumentException() ; + double[] result = new double[this.vector.length] ; + double[] vector2 = Z.getVector() ; + switch (operation) { + case ACCUMULATE: ; // does nothing, deliberately falling through to the code of INPRODUCT + case INPRODUCT: { + int r = 0 ; + for (int k1=0; k1<this.vector.length; k1++) r += this.vector[k1]*vector2[k1] ; + double[] rr = new double[1]; + rr[0] = r; + result = rr ; + break ; + } + case PLUS: { + for (int k2=0; k2<this.vector.length; k2++) result[k2] = this.vector[k2] + vector2[k2] ; + break ; + } + default: return null ; + } + return new Vector_R1(result) ; + } + +} diff --git a/daikon equivalent mutations/Mutants/Vector_R2.class b/daikon equivalent mutations/Mutants/Vector_R2.class new file mode 100644 index 0000000000000000000000000000000000000000..24b58c3a27a6ba06f7f612d6a540fc50d5bff844 GIT binary patch literal 1010 zcmZuv+fEZv6kTVg?Od1wR;rd#F6ClxfnW>|fJ7r|YCx0LkPsfsbeuGWUa%G-CccsI zVB#;B@Iqopgha&%sqg-T@e6z>3a&E{AjavOefB<QueJAH)9*)Ln*eSiW1<By0|vTH z^q|+I*QX(F!jG5?`lT7rFevvS4c7$%tFF_i)diG=X-1Q!YN;_L;7=?}C+7rwcWcjF zfwq}a)qS*5DY*3~cA?A@qv$r~PNBX;Qi6l|hV3lP+RI*whM<7PtbFMe^VLK$%h;(^ z3ZxQ<B(gIn_@}uW6Uhrc+Y>PJwUxT#-Y>~ot!IhDi}tE*p%n=W7J?d*7E(xCxPq$! zad|sZwyVXFY`N?f?ed*^ai!u`8~0v1?sB74t6B)*vW07iaD+2j$=D{)evW@!SmbbC z+f?DgMSkr?!>tf(*X#D0Q(ImWNF`?eMNVY@bCgZap^wV9@M}?UIRQN%eU_(fXLO6- zO5q+!?Lnl{%>(Tdl(d@q2t`ddzd+sfz?W!4gaQFtjZ`{^GDyPtPO0X3BQxR>+?<Ra zXtU~6EV_wMCMJ(!qq%ieY#sl~>@Z8gIj2R|AWXK^%f>o*8-#KMOK1p-L$3e@KP}VE zUC2hfGTZcoM-}i+L$p+zmeYwz5}VA}&wPf@%YTQKefa115cuZB2ikamm)f`%ea}Qb zZ@47C%GJfy&*h~2OwxDMF<l)q!iERkL@catNH=VZMl_lw=k1ujZg9pQJ`x)dLuE#8 zAI5yd*n=tYVf_>wjRa2ourAU1sFPdQ3H`YRzu56G0f}Mx6RpOnk8G&}G5)&QSPyPf zu?L9bA*1IQz$ymu8bjDX65IT%en1Ah81^(Bf!T44G;|G}RJN03)R!-{{KJ}5y8jU2 P-%#lFDN^OASG?;lqxHFM literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Mutants/Vector_R2.java b/daikon equivalent mutations/Mutants/Vector_R2.java new file mode 100644 index 0000000..06367df --- /dev/null +++ b/daikon equivalent mutations/Mutants/Vector_R2.java @@ -0,0 +1,49 @@ + +public class Vector_R2 { + + private double[] vector; + + public Vector_R2(double[] vec) { + this.vector = new double[vec.length] ; + System.arraycopy(vec, 0, this.vector, 0, vec.length); + } + + public double[] getVector() { + int N = this.vector.length ; + double[] V = new double[N] ; + for (int k=0; k<N; k++) V[k] = this.vector[k] ; + return V ; + } + + public int getSize() { return this.vector.length ; } + + + /** + * R2 replaces the fall through in the ACCUMULATE case with a recursive call with INPRODUCT. + */ + public Vector_R2 combine(int operation, Vector_R2 Z) { + final int ACCUMULATE = 1; + final int INPRODUCT = 2; + final int PLUS = 3; + if (Z.getSize() != this.vector.length) throw new IllegalArgumentException() ; + double[] result = new double[this.vector.length] ; + double[] vector2 = Z.getVector() ; + switch (operation) { + case ACCUMULATE: return this.combine(INPRODUCT,Z) ; + case INPRODUCT: { + int r = 0 ; + for (int k1=0; k1<this.vector.length; k1++) r += this.vector[k1]*vector2[k1] ; + double[] rr = new double[1]; + rr[0] = r; + return new Vector_R2(rr) ; + } + case PLUS: { + for (int k2=0; k2<this.vector.length; k2++) result[k2] = this.vector[k2] + vector2[k2] ; + break ; + } + default: return null ; + } + return new Vector_R2(result) ; + } + +} diff --git a/daikon equivalent mutations/Mutants/Vector_R3.class b/daikon equivalent mutations/Mutants/Vector_R3.class new file mode 100644 index 0000000000000000000000000000000000000000..8486043ae30c9c6fe00cec33af0a5ac924dbeb60 GIT binary patch literal 997 zcmZuvTTc@~7(KJwcDu_K5UIMBaw!PC5Rqs|EJ!q>Nt2>UYe)zWX1i{hLT@RBh|eTG z=|3<gybz5KnxHj8>brl!_zQd|3Z7XTAjY(v`EKXTnKS)%^ra2p29gF04Cn|VYG4pU z2BTpOBL@5!kV#C#sNBaiToDLtx=yp!5KvYYn9Y@{rRKbVKfbb%SQ7BvtvzuCda|Xe z`(UF|a2t>8LYWo4=r)%+P+vSD!J&N9cGec{x;LW16wo-8FFoVD8c$@HJGDxIR038! zll_Z-oVz}oI1^KzfRV3lG#vMSNuJexGI({>-n31GFm9p?riKX<aU@KHaX}y^yHjPm zTAa$1%Wlyw-)R&#DsHuT@2TU~o26RS#5wd){RyKa>lWxeg+45-@?M@|8gQnO-&$|F z6@u+X!`^ag^(}#9Jo_(lHuIlSCb5JOnr`ro=(QBj$j6w+bM0Yvi!Y>bw~{T0WU76j zeT0%ylY3CqRQog34<5LeYagLNfGce#?Iq|W;ng}+%k0RBm;|@yA_v-{Iv<Vfpl>oN zOVR1vwkmdye@?#Vl!8-EldK`i?8Y!foo6=$<%n;op<f)bAf(rwV+OekDa1SG9U~eh zbFV7JT%<JbcH$<hUF@|cKf&kCzed+S{L3u_zIyqAmJYC~r8SWbM&5Gvg~te}+_RmZ zrOxPK-2?0(Vg>%jVSU=txH!3Oo%i~&kKnQuXhBa0cd<Z-I%9;54k{YfpUW_8NRTnT z=DeKIw+-UH`zXS&43!f(kHhddtl+6nX?g<;pdV3w1~G~ujMJ^#h{0u6#~9WzfldB1 zUm<}VB=H6*>|x6D^BRKv$INvN7G1SSMsK|@<6lr{^GN77{DQ&gp=b7G4k?KI0Vs2} A?f?J) literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Mutants/Vector_R3.java b/daikon equivalent mutations/Mutants/Vector_R3.java new file mode 100644 index 0000000..07a5d45 --- /dev/null +++ b/daikon equivalent mutations/Mutants/Vector_R3.java @@ -0,0 +1,50 @@ + +public class Vector_R3 { + + private double[] vector; + + public Vector_R3(double[] vec) { + this.vector = new double[vec.length] ; + System.arraycopy(vec, 0, this.vector, 0, vec.length); + } + + public double[] getVector() { + int N = this.vector.length ; + double[] V = new double[N] ; + for (int k=0; k<N; k++) V[k] = this.vector[k] ; + return V ; + } + + public int getSize() { return this.vector.length ; } + + + /** + * R3 reorder the cases, and remove the use of return from the case arms. + */ + public Vector_R3 combine(int operation, Vector_R3 Z) { + final int ACCUMULATE = 1; + final int INPRODUCT = 2; + final int PLUS = 3; + if (Z.getSize() != this.vector.length) throw new IllegalArgumentException() ; + double[] result = new double[this.vector.length] ; + double[] vector2 = Z.getVector() ; + Vector_R3 resultingVector = null ; + switch (operation) { + case PLUS: { + for (int k1=0; k1<this.vector.length; k1++) result[k1] = this.vector[k1] + vector2[k1] ; + resultingVector = new Vector_R3(result) ; + break ; } + case ACCUMULATE: ; // does nothing, deliberately falling through to the code of INPRODUCT + case INPRODUCT: { + int r = 0 ; + for (int k2=0; k2<this.vector.length; k2++) r += this.vector[k2]*vector2[k2] ; + double[] rr = new double[1]; + rr[0] = r; + resultingVector = new Vector_R3(rr) ; // we will just let it fall through + } + default: ; + } + return resultingVector ; + } + +} diff --git a/daikon equivalent mutations/Mutants/Vectors01Generator_no_for.java b/daikon equivalent mutations/Mutants/Vectors01Generator_no_for.java new file mode 100644 index 0000000..0e9ba54 --- /dev/null +++ b/daikon equivalent mutations/Mutants/Vectors01Generator_no_for.java @@ -0,0 +1,38 @@ +//http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-10-recursion/#demos-source-code + +class Vectors01Generator +{ + static void Gen01(int index, int[] vector1) + { + if (index == -1) + { + Print(vector1); + } + else + { + vector1[index] = 0; + Gen01(index - 1, vector1); + vector1[index] = 1; + Gen01(index - 1, vector1); + } + } + + static void Print(int[] vector2) + { + for (int i2 = 0; i2 < vector2.length; i2++) + { + System.out.printf("{0} ", i2); + } + System.out.println(); + } + + static void main() + { + System.out.print("n = "); + int number = System.in.read(); + + int[] vector3 = new int[number]; + + Gen01(number - 1, vector3); + } +} diff --git a/daikon equivalent mutations/Mutants/Vectors01Generator_print_string.java b/daikon equivalent mutations/Mutants/Vectors01Generator_print_string.java new file mode 100644 index 0000000..99c44ec --- /dev/null +++ b/daikon equivalent mutations/Mutants/Vectors01Generator_print_string.java @@ -0,0 +1,40 @@ +//http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-10-recursion/#demos-source-code + +class Vectors01Generator +{ + static void Gen01(int index, int[] vector1) + { + if (index == -1) + { + Print(vector1); + } + else + { + for (int i1 = 0; i1 <= 1; i1++) + { + vector1[index] = i1; + Gen01(index - 1, vector1); + } + } + } + + static void Print(int[] vector2) + { + String str = ""; + for (int i2 = 0; i2 < vector2.length; i2++) + { + str = str + Integer.toString(i2) + " "; + } + System.out.println(str); + } + + static void main() + { + System.out.print("n = "); + int number = System.in.read(); + + int[] vector3 = new int[number]; + + Gen01(number - 1, vector3); + } +} diff --git a/daikon equivalent mutations/Mutants/twodmatrix.class b/daikon equivalent mutations/Mutants/twodmatrix.class new file mode 100644 index 0000000000000000000000000000000000000000..82ba15649d47f14feccd529f953d666fb11e38ae GIT binary patch literal 1045 zcmZXSPfrt36vfY*{$qv~uwoI~ihyD}l~z$qjEF|jqzTFbW1?NuX_-Kg&X8t6J^-JD zjcXGMi5hoqT=@Z9xN+ygjT=JLbElKmgf#cQnb$k#ckX@f%b)k30Ng~$Kmt=b`fy3o z<rtE(PD{FCFy&&%%W6t0NV+O%CWfMdYBI_UhhZs%DiwLFDQNN#oo_e|Z$TlFE0^=n z6~YhQRa;?jso~g9x0^M)^~|bma>r=d)@sx8T8&+*<fJyS;#u|APpqw=B)ZjVINqv4 ztnNBHcFR-H{VmtAxf^a;4Z29>DoY#Ij#b*UoVC&l1)a4!B4@0)+pW6&xFNXnvx`;F ztzKWOI&QV@ZabdcD#~YZoWocg0~m~BNYWW3<2Z}qII<X{iucA1d`f95j!~)4NV*^e zLp}I%ZNsj6xX5WGIO{Njy37!1f2F#=62LXepe7VX`1BGX{(z!+1ZAe%(9BF5A=5nI z(*Z)C5!Tv>bl=xM8f`@1@eB6HJm%{e<n}{{^pv2*0nCuC#CE{h3^-<JJ}uh&m<-*` z2w@*dE|K(XCcM0-skeWB?kVPP!qEO>Bw^71FkNSvr`S`T>S<ODA$$T&oj_N|NF5_W zCTA6pD^!sVC%WX(E?M`1zkT439x&;TF-zb$WwIRZ^l4C{1LA=Npk00?pj%x~u?xDu z7NgR5Xg%{PXt&sD_q$L3+M{<ynkT)$MrYV&0VU=+Ts!Szvg3lcB5+Zr2aPVq%tOQi zCq8!{x=;GmBMta|Z_xJ~kLtFsu0uOPl!Hw2JjdC3=bqeSk;smGK;Mf<^a%P=;SdI+ hpAi?$&V@*E{J;X;-{&=WK$%5ewnzMTg8LdK{{d?Frq}=g literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Node.class b/daikon equivalent mutations/Node.class new file mode 100644 index 0000000000000000000000000000000000000000..4e554cd554ba44810453bc071d5a4d6fae30b7d5 GIT binary patch literal 414 zcmZ9H%}&Bl5QWdBr7gAE@~ilhxWq<f<4)p26B81G3yAwtu6Ri)28)T0<${>F@Bw@% z<GF=s;^xfUIcL63zrH^{0bF3;g@sxPMbx!4wCvj0v(XeVRVHTwqAO5L<U<w<SiSyy zEHBwC)Z{UrbX2OcD}kWZU7Kq?xhLR;VFACVQrTb5MshKXMhPcIOWXEXJwGMUtAIP0 zFBh@ARoZl}2gCDe^b&dS5O}cRcqqa3umzV;eE~nG6YV5QC+)k@RK^*OdAr5GGC(vO zc0#Y^m75#K!#3wTe05NO$yy8FA;N<d3gPJrMtHV@`Ic|_)CQ?w-h@wDz^;rcDrE4u i4e5wgFjdr~zf~(A)~V&+Xfp@%wEwX~#ws)msQv(?A~);+ literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Normalizer.class b/daikon equivalent mutations/Normalizer.class new file mode 100644 index 0000000000000000000000000000000000000000..b54f289af14676159d8883ab4f71e93fe6cf5aa9 GIT binary patch literal 529 zcmYLF$w~u36s(>#j@ewIxdc%JW86?g6jTs51UFO!@zhD0Vd7*)hKY!0|3UDg<l@<r zpfDc1`78c`xV;{gbkpxuzpm=8*RNlX5rAoQS<sO&k+q=6++m`V!I*bECtPGui^GQu z+Ol6244F;G6Wfh?Sp)~X>{6x8^Mg8foeRQN@py&i@rqQW_CsDd+2W^vL~Gw~1QoI7 zNL6P0Ulokk_!&>afXOf*@r27gdt$?Nh0Wciz;4uq7p|UH#A)dG9=+1iGGtqdopMc7 zLi9tUe&kR<ZNQ|Mpk0A7qpX)6!0ri<cZx<_R0&&XCoHLNRJACdm7+y;MjMF=x2Wc{ z(WnVAn$xDD!VTJ=pd39weO71moL*>RVI-$dmT1{?M&3wYUAHJwLkDw-Uyx74w7lW( zUFz)a`{h!j*!;gxdQ)O=Yv_m_s?>x*&XQE^B4>l-bcl9iNMROftRsV6WWkAFMJH@x l)zFPPdeA^GF+tJ%M3S-I4=C&ded;^<-l5CiNyQJQe*jicXSe_W literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Normalizer.java b/daikon equivalent mutations/Normalizer.java new file mode 100644 index 0000000..558bfbb --- /dev/null +++ b/daikon equivalent mutations/Normalizer.java @@ -0,0 +1,25 @@ +import java.lang.IllegalArgumentException; + +public class Normalizer { + + static public void normalize(double[] mins, double[] maxs, double[][] data) { + int rowWidth = mins.length ; + int row = 0 ; + if (maxs.length == rowWidth) { + while (row < data.length) { + if (data[row].length != rowWidth) { throw new IllegalArgumentException() ; } + int col = 0 ; + while (col < rowWidth) { + double delta = maxs[col] - mins[col] ; + if (delta == 0) throw new IllegalArgumentException() ; + double x = data[row][col] ; + data[row][col] = (x - mins[col])/delta ; + col++ ; + } + row++ ; + } + } + else { throw new IllegalArgumentException() ; } + } + +} diff --git a/daikon equivalent mutations/Program.class b/daikon equivalent mutations/Program.class new file mode 100644 index 0000000000000000000000000000000000000000..d6bb5df447a9f89c978cc8e8132c16f574f57650 GIT binary patch literal 563 zcmYk2-A)rx6otQ2N@u8ptx{1?#Ht~KRY{B&Bp5D$nA9}Tw2g^!H7zI20G-j(DSz?8 z3lpD*8=7e11NczJeGV9$WWK$!vVYdh?>|3&0k3&lq{xg%rAUq$i#ryx7I!V~S<HFN zd)!wP-o#0qtt%$N<@bvGX1b>prAD0S?a`pCO(*IeijyBiaiW+FcN_cBQM7UxCH<9l zX5ys3W(SMybYyz^ZETzUjdtgyZ40<TAj2J_b-)7_0v@s$@Q7-_V~ZzL6<*V%eG?57 z<?H1;-F@B5Bw;-nY9k^a*4?F+&PFC_rKxy+xZK#5$ZN8so}^|^8^u(3>Dg|-Y4kt4 znGQ3j<^GiXCHv&$m5eB+MJ-5GQYW8{QRgBQH-!af9^g}=EZVk?Wz-J$ev<nzW};Cm zS1!oc%5#n{97~Ryjy1=oWA#73=k%_nv`k)5xT@Y&^{<0$$azR5$R`Q*nF@w^hVnfb lON@BV5wAFAl@r!EWs5W3@r4#&`N%iAe3$sQWJiwMe*qqqW)uJb literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Stack.java b/daikon equivalent mutations/Stack.java new file mode 100644 index 0000000..cfbd486 --- /dev/null +++ b/daikon equivalent mutations/Stack.java @@ -0,0 +1,128 @@ +// http://www.sanfoundry.com/csharp-program-stack-push-pop/ + +/* + * C# Program to Implement Stack with Push and Pop operations + */ + +class Program +{ + static void main(String[] args) + { + stack st = new stack(); + while (true) + { + System.out.println("\nStack MENU(size -- 10)"); + System.out.println("1. Add an element"); + System.out.println("2. See the Top element."); + System.out.println("3. Remove top element."); + System.out.println("4. Display stack elements."); + System.out.println("5. Exit"); + System.out.print("Select your choice: "); + int choice = System.in.read(); + switch (choice) + { + case 1: + System.out.println("Enter an Element : "); + st.Push(System.in.read()); + break; + + case 2: System.out.printf("Top element is: {0}", st.Peek()); + break; + + case 3: System.out.printf("Element removed: {0}", st.Pop()); + break; + + case 4: st.Display(); + break; + + case 5: System.exit(1); + break; + } + System.in.read(); + } + } + } + + interface StackADT + { + boolean isEmpty(); + void Push(Object element); + Object Pop(); + Object Peek(); + void Display(); + } + + class stack implements StackADT + { + public int StackSize; + public int top; + Object[] item; + + public stack() + { + this.StackSize = 10; + this.item = new Object[this.StackSize]; + this.top = -1; + } + public stack(int capacity) + { + this.StackSize = capacity; + this.item = new Object[this.StackSize]; + this.top = -1; + } + public boolean isEmpty() + { + if (this.top == -1) return true; + + return false; + } + public void Push(Object element) + { + if (this.top == (this.StackSize - 1)) + { + System.out.println("Stack is full!"); + } + + else + { + + this.item[++this.top] = element; + System.out.println("Item pushed successfully!"); + } + } + + public Object Pop() + { + if (this.isEmpty()) + { + System.out.println("Stack is empty!"); + return "No elements"; + } + else + { + return this.item[this.top--]; + } + } + public Object Peek() + { + if (this.isEmpty()) + { + System.out.println("Stack is empty!"); + return "No elements"; + } + else + { + return this.item[this.top]; + } + } + + + public void Display() + { + for (int i = this.top; i > -1; i--) + { + + System.out.printf("Item {0}: {1}", (i + 1), this.item[i]); + } + } +} diff --git a/daikon equivalent mutations/Tree.class b/daikon equivalent mutations/Tree.class new file mode 100644 index 0000000000000000000000000000000000000000..64be6a4a4679c2bbbca625f2edb16a53109c8b51 GIT binary patch literal 922 zcmaJ<+fEZv6kVsCcG_XMNJXRt1qE!UHw~Jo5R4TsjcsjcLqd!(y&Pe%v}Tz4LB9BE z6Ocp`9wqT7`~;s(h`P>Dk?=s8tiAU+d#}CDntuQN<p98KWDJ<N8pZ&ob<7y>tHO_K z3a%@dHF!6tU|zuu9dR8A0nO=jT!CPr)M?5^CQEkPc9#YG@x&UhAMsdVxL~(ssk>d5 zPPJBV@x)k_Zr5qAdefnJ;$%MG-jNO&wRm0;3|8D)<886_&YPn)fl%3z9j7TBfpGkI zPIc<}_P^6|XUFa5My1nr8uE#)mWFbbYG$kUzGh+=BPIqh#6?QE2@6RRDGZrNE0{pk zL`=aXqHL-<k_01aINPeVH?lA4Te6{a+OFId5P5+>OTKX%^uVz<Hr)oMX_QHOd8<}2 z3o_$o;ssU~e9QpD+J~^j9(+Bodz3gt&w*KJm_r!z?2F)He{PCV%>}Go_&%MCC~_b{ z9K$7|T5-S?0mkB2_}BNL6;rXj<GDi&SShajhy_JcO5fLF>0JaqAi@wVr4Rr7oY2@2 z?6KBW{llyEo>J+9QkmmhK*K`F@P%0_yh*<nFoV0)evf`G;ue;02g}SJFk8VxJm&8y zp5qw`C}Nxp<Is*UspIkyG!LW1U$jc757B>1j!S)P9!q{h#7a`+XM|ML8UJe<rDs5y zSfTq>YFhJl_#u>m{HEvdh5LNrvwZ91dr7`m<a>RZkAIJI_>4ZEah9)6z9#u3`8H4U KO;NlLSN;MyjESQF literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Vector.class b/daikon equivalent mutations/Vector.class new file mode 100644 index 0000000000000000000000000000000000000000..299a1e2258e383e56fd49b71b8749e89a4011330 GIT binary patch literal 976 zcmZuuTTc@~7(KJwc6OIm5U5&8xfF$72uNc307x{TNfXe78WMsp+jY|vdLgwC@yUlK zzWEnSNDPMffC-8bQs4a(#$Vt&QSi*R24mdp%zWQB=X{qlU(Y@_0o+2$f`xt)24WTl zFlf;lk{Gt&N56975+mxoE^$L3u<bhaYE3{}Tc9^vtQ6~W0{+C>LUKjGH(!0?3Un?O zEAE4>a^9^yvhyWI%z|5AX;XcPq#}oMb=%okvNt`5L{LByl`B3cUQZ;m^qp!s&r||E ziR@yFKa>1purUEESKX>P?){>w($RuUtlQgm5Fv~P(Se}ESP%&$g9zh_KwRBUmh4Jl zGFvLS1-o>&R@f@LmHNGBj=NbeRx3eVMmNW6rBj(M33OfX9_H6Mi`ONG{_7&Q^R(`k zIj&u+**i{kb4MVRSp1hcll@O9n_R&#g|_%E)K_&*%SW5#xp&gL%~#QQMp8!*sdV#1 zet?$NQ-{#>bn_GR_a3>6dpD_o<ZdvLiEB(O)LiXUtGrQ&xFR=aqbG7npNmCz(LEkh zq1e=NLl=AJKgJJ;(r}S8ga8||*w7H8J-iJ;JLCIF^ommkgc7=4W`L(4B;b{KM~i|f z--{~jRkr3$CvGyTrav722%m?4jgDjZSC0_*;`t|XI>1XgEu;Gc@@sIZ{5n^Edp*`O zhMqCQrpMVuENr|~X4ssHNNyX>tBlbwIovlNGnx@oCt~>+#%jbof_XrG*l3fZkwD81 z8;WgAIm-=$)bD%nivy1nP#o57iIkxnd?ECr4>3eB!oKcc5c8C4oiAKP9NUb(z$o5e u3~!OdKGL3$6EJ(vX&Vv|${ArIipn4O#d1`4<P_nb&}a>7O4&ZIZuB?3d9qvp literal 0 HcmV?d00001 diff --git a/daikon equivalent mutations/Vector.java b/daikon equivalent mutations/Vector.java new file mode 100644 index 0000000..24b4b6e --- /dev/null +++ b/daikon equivalent mutations/Vector.java @@ -0,0 +1,45 @@ + + +public class Vector { + + private double[] vector; + + public Vector(double[] vec) { + this.vector = new double[vec.length] ; + System.arraycopy(vec, 0, this.vector, 0, vec.length); + } + + public double[] getVector() { + int N = this.vector.length ; + double[] V = new double[N] ; + for (int k=0; k<N; k++) V[k] = this.vector[k] ; + return V ; + } + + public int getSize() { return this.vector.length ; } + + public Vector combine(int operation, Vector Z) { + final int ACCUMULATE = 1; + final int INPRODUCT = 2; + final int PLUS = 3; + if (Z.getSize() != this.vector.length) throw new IllegalArgumentException() ; + double[] result = new double[this.vector.length] ; + double[] vector2 = Z.getVector() ; + switch (operation) { + case ACCUMULATE: ; // does nothing, deliberately falling through to the code of INPRODUCT + case INPRODUCT: { + int r = 0 ; + for (int k1=0; k1<this.vector.length; k1++) r += this.vector[k1]*vector2[k1] ; + double[] rr = new double[1]; + rr[0] = r; + return new Vector(rr) ; + } + case PLUS: { + for (int k2=0; k2<this.vector.length; k2++) result[k2] = this.vector[k2] + vector2[k2] ; + break ; + } + default: return null ; + } + return new Vector(result) ; + } +} diff --git a/daikon equivalent mutations/Vectors01Generator.java b/daikon equivalent mutations/Vectors01Generator.java new file mode 100644 index 0000000..785438c --- /dev/null +++ b/daikon equivalent mutations/Vectors01Generator.java @@ -0,0 +1,39 @@ +//http://www.introprogramming.info/english-intro-csharp-book/read-online/chapter-10-recursion/#demos-source-code + +class Vectors01Generator +{ + static void Gen01(int index, int[] vector1) + { + if (index == -1) + { + Print(vector1); + } + else + { + for (int i1 = 0; i1 <= 1; i1++) + { + vector1[index] = i1; + Gen01(index - 1, vector1); + } + } + } + + static void Print(int[] vector2) + { + for (int i2 = 0; i2 < vector2.length; i2++) + { + System.out.printf("{0} ", i2); + } + System.out.println(); + } + + static void main() + { + System.out.print("n = "); + int number = System.in.read(); + + int[] vector3 = new int[number]; + + Gen01(number - 1, vector3); + } +} diff --git a/daikon equivalent mutations/twodmatrix.class b/daikon equivalent mutations/twodmatrix.class new file mode 100644 index 0000000000000000000000000000000000000000..f8fb249f0702d4a3d003edb0cf96791cf34a9533 GIT binary patch literal 1037 zcmZWnOHUI~6#nkav}J~tN5vw2fPexWpadi?6d?vAX@auAm}nPdS|(7WQ_>7*;+9{+ z#<dBBM2$N)u3fs+oeMW^2tK|uolq0goOABnp8Gw{y`O%+{QzJdGZqpUHPL|^l5WP3 zlsYD9++v!DAurXIG%0CH(sT?31yy4d86Lw?&`TxxDl2HRh%QvUs=ufZnJ5<XPZW&h z`j)HEy;k+yM+ddC+j#7h_qby<TxYB1_>JmIqD)9{V#9YT&mTJbVM}zsQT6;Sg;=HT z9l8x)!3?(Qp37aM=2WR7HBnmIbq<}GJ;&Rg*&v{|eOKVDjru{O;;vSOE-|;V>DM=B zR|?V_$5o``=t6fKJ(7BnjN=OW;>aP*qyCF}C{9{aaSTX*R??s}^t2h*%e!vH$90Y< z!2uf#;xa>^gG%(El7KbJASM+0xq1ejKcHZrLD`umG&|dbZrdkZok0HxLu(>(`MvYr zY9jiEClszRrvp5Tyqz#1o)VPUg=umtksb2vg*>*tkP+--jOh2W!f=cvOC&RwHP(+b z_4?2EBgOnhIJAE_lCY@1kE(Obqx6&~dWKy+FfO2}3z+I0sdGfg$ytTWC8CJK;Y;R$ zOJ*}5{235_YZE4eG3H1(M3@|hJN7?OqD90D3yEIwl#G8~UuY4~q^&RJS|-yh(F~cy zY<4bJSU=Kf^J}2sbDMh*F=FH?+U7W?cu@t6vrhB-7G?t-y)b^kP@&_&mJmLSP)Lz} zHG-t=Q^Z2oB4XzlW?=P4o31OE%{+zQ=55^x;7w>3h;o)mUg;3sx1P!pn*_H19Xg&y pqGvGICQo58IvH`nY`uvTZva^0`0n#1EEDDdZLIR&VeV@f`3uFKp?LrR literal 0 HcmV?d00001 -- GitLab