diff --git a/src/main/java/com/trickl/math/ChainPermutator.java b/src/main/java/com/trickl/math/ChainPermutator.java index 0e131f8..425b5b3 100644 --- a/src/main/java/com/trickl/math/ChainPermutator.java +++ b/src/main/java/com/trickl/math/ChainPermutator.java @@ -23,6 +23,9 @@ /** * The ChainPermutator allows you to chain Permutators together. A common application of this is to * get ensure permutations apply to more than one set of data. + * + * @author tgee + * @version $Id: $Id */ public class ChainPermutator implements Permutator { @@ -30,22 +33,37 @@ public class ChainPermutator implements Permutator { private Permutator rhsPermutator = new StandardPermutator(); - /** @return the permutator */ + /** + *

Getter for the field lhsPermutator.

+ * + * @return a {@link com.trickl.math.Permutator} object. + */ public Permutator getLhsPermutator() { return lhsPermutator; } - /** @param rhsPermutator the permutator to set */ + /** + *

Setter for the field lhsPermutator.

+ * + * @param lhsPermutator a {@link com.trickl.math.Permutator} object. + */ public void setLhsPermutator(Permutator lhsPermutator) { this.lhsPermutator = lhsPermutator; } - /** @return the permutator */ + /** + *

Getter for the field rhsPermutator.

+ * + * @return a {@link com.trickl.math.Permutator} object. + */ public Permutator getRhsPermutator() { return rhsPermutator; } - /** @param rhsPermutator the permutator to set */ + /** + *

Setter for the field rhsPermutator.

+ * @param rhsPermutator a {@link com.trickl.math.Permutator} object. + */ public void setRhsPermutator(Permutator rhsPermutator) { this.rhsPermutator = rhsPermutator; } @@ -53,7 +71,8 @@ public void setRhsPermutator(Permutator rhsPermutator) { /** * Create a paired permutator. * - * @param pair The paired data. + * @param lhsPermutator a {@link com.trickl.math.Permutator} object. + * @param rhsPermutator a {@link com.trickl.math.Permutator} object. */ public ChainPermutator(Permutator lhsPermutator, Permutator rhsPermutator) { this.lhsPermutator = lhsPermutator; @@ -61,13 +80,9 @@ public ChainPermutator(Permutator lhsPermutator, Permutator rhsPermutator) { } /** - * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] */ @Override public short[] cycle(short[] S, int first, int second, int third) { @@ -76,13 +91,9 @@ public short[] cycle(short[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] */ @Override public char[] cycle(char[] S, int first, int second, int third) { @@ -91,13 +102,9 @@ public char[] cycle(char[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] */ @Override public float[] cycle(float[] S, int first, int second, int third) { @@ -106,13 +113,9 @@ public float[] cycle(float[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] */ @Override public double[] cycle(double[] S, int first, int second, int third) { @@ -121,13 +124,9 @@ public double[] cycle(double[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] */ @Override public int[] cycle(int[] S, int first, int second, int third) { @@ -136,14 +135,9 @@ public int[] cycle(int[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * {@inheritDoc} * - * @param The type of the array - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [ 1, 2, 3 ] -> [ 2, 3, 1 ] */ @Override public T[] cycle(T[] S, int first, int second, int third) { @@ -152,14 +146,9 @@ public T[] cycle(T[] S, int first, int second, int third) { } /** - * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] */ @Override public short[] cycle(short[] S, int first, int second, int third, int fourth) { @@ -168,14 +157,9 @@ public short[] cycle(short[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] */ @Override public char[] cycle(char[] S, int first, int second, int third, int fourth) { @@ -184,14 +168,9 @@ public char[] cycle(char[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] */ @Override public float[] cycle(float[] S, int first, int second, int third, int fourth) { @@ -200,14 +179,9 @@ public float[] cycle(float[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] */ @Override public double[] cycle(double[] S, int first, int second, int third, int fourth) { @@ -216,14 +190,9 @@ public double[] cycle(double[] S, int first, int second, int third, int fourth) } /** - * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] */ @Override public int[] cycle(int[] S, int first, int second, int third, int fourth) { @@ -232,15 +201,9 @@ public int[] cycle(int[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * {@inheritDoc} * - * @param The type of the array - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] */ @Override public T[] cycle(T[] S, int first, int second, int third, int fourth) { @@ -249,15 +212,9 @@ public T[] cycle(T[] S, int first, int second, int third, int fourth) { } /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] */ @Override public short[] cycle(short[] S, int first, int second, int third, int fourth, int fifth) { @@ -266,15 +223,9 @@ public short[] cycle(short[] S, int first, int second, int third, int fourth, in } /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] */ @Override public char[] cycle(char[] S, int first, int second, int third, int fourth, int fifth) { @@ -283,15 +234,9 @@ public char[] cycle(char[] S, int first, int second, int third, int fourth, int } /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] */ @Override public float[] cycle(float[] S, int first, int second, int third, int fourth, int fifth) { @@ -300,15 +245,9 @@ public float[] cycle(float[] S, int first, int second, int third, int fourth, in } /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] */ @Override public double[] cycle(double[] S, int first, int second, int third, int fourth, int fifth) { @@ -317,15 +256,9 @@ public double[] cycle(double[] S, int first, int second, int third, int fourth, } /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] */ @Override public int[] cycle(int[] S, int first, int second, int third, int fourth, int fifth) { @@ -334,16 +267,9 @@ public int[] cycle(int[] S, int first, int second, int third, int fourth, int fi } /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param The data type of the array - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] */ @Override public T[] cycle(T[] S, int first, int second, int third, int fourth, int fifth) { @@ -352,12 +278,9 @@ public T[] cycle(T[] S, int first, int second, int third, int fourth, int fi } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public short[] reverse(short[] S, int start, int end) { @@ -366,12 +289,9 @@ public short[] reverse(short[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public char[] reverse(char[] S, int start, int end) { @@ -380,12 +300,9 @@ public char[] reverse(char[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public double[] reverse(double[] S, int start, int end) { @@ -394,12 +311,9 @@ public double[] reverse(double[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public float[] reverse(float[] S, int start, int end) { @@ -408,12 +322,9 @@ public float[] reverse(float[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public int[] reverse(int[] S, int start, int end) { @@ -422,13 +333,9 @@ public int[] reverse(int[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param The data type of the array - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public T[] reverse(T[] S, int start, int end) { @@ -437,12 +344,9 @@ public T[] reverse(T[] S, int start, int end) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public short[] swap(short[] S, int first, int second) { @@ -451,12 +355,9 @@ public short[] swap(short[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public char[] swap(char[] S, int first, int second) { @@ -465,12 +366,9 @@ public char[] swap(char[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public double[] swap(double[] S, int first, int second) { @@ -479,12 +377,9 @@ public double[] swap(double[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public float[] swap(float[] S, int first, int second) { @@ -493,12 +388,9 @@ public float[] swap(float[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public int[] swap(int[] S, int first, int second) { @@ -507,13 +399,9 @@ public int[] swap(int[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param The data type of the array - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public T[] swap(T[] S, int first, int second) { diff --git a/src/main/java/com/trickl/math/IntArrayPermutator.java b/src/main/java/com/trickl/math/IntArrayPermutator.java index e09d9bb..09fb69f 100644 --- a/src/main/java/com/trickl/math/IntArrayPermutator.java +++ b/src/main/java/com/trickl/math/IntArrayPermutator.java @@ -25,6 +25,7 @@ * call. * * @author tgee + * @version $Id: $Id */ public class IntArrayPermutator implements Permutator { @@ -33,19 +34,16 @@ public class IntArrayPermutator implements Permutator { /** * Create an IntArrayPermutator. * - * @param pair The array to permutate + * @param array an array of int. */ public IntArrayPermutator(int[] array) { this.array = array; } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element - * @param second The index of the second element - * @return The supplied array + * Swap the elements in the array */ @Override public short[] swap(short[] S, int first, int second) { @@ -56,12 +54,9 @@ public short[] swap(short[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element - * @param second The index of the second element - * @return The supplied array + * Swap the elements in the array */ @Override public char[] swap(char[] S, int first, int second) { @@ -72,12 +67,9 @@ public char[] swap(char[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element - * @param second The index of the second element - * @return The supplied array + * Swap the elements in the array */ @Override public double[] swap(double[] S, int first, int second) { @@ -88,12 +80,9 @@ public double[] swap(double[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element - * @param second The index of the second element - * @return The supplied array + * Swap the elements in the array */ @Override public float[] swap(float[] S, int first, int second) { @@ -104,12 +93,9 @@ public float[] swap(float[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element - * @param second The index of the second element - * @return The supplied array + * Swap the elements in the array */ @Override public int[] swap(int[] S, int first, int second) { @@ -120,13 +106,9 @@ public int[] swap(int[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param The data type of the array - * @param S Ignored - * @param first The index of the first element - * @param second The index of the second element - * @return The supplied array + * Swap the elements in the array */ @Override public T[] swap(T[] S, int first, int second) { @@ -137,13 +119,9 @@ public T[] swap(T[] S, int first, int second) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The supplied array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public short[] cycle(short[] S, int first, int second, int third) { @@ -155,13 +133,9 @@ public short[] cycle(short[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The supplied array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public char[] cycle(char[] S, int first, int second, int third) { @@ -173,13 +147,9 @@ public char[] cycle(char[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The supplied array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public float[] cycle(float[] S, int first, int second, int third) { @@ -191,13 +161,9 @@ public float[] cycle(float[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The supplied array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public double[] cycle(double[] S, int first, int second, int third) { @@ -209,13 +175,9 @@ public double[] cycle(double[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The supplied array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public int[] cycle(int[] S, int first, int second, int third) { @@ -227,14 +189,9 @@ public int[] cycle(int[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param The type of the array - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The supplied array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public T[] cycle(T[] S, int first, int second, int third) { @@ -246,14 +203,9 @@ public T[] cycle(T[] S, int first, int second, int third) { } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The supplied array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public short[] cycle(short[] S, int first, int second, int third, int fourth) { @@ -266,14 +218,9 @@ public short[] cycle(short[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The supplied array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public char[] cycle(char[] S, int first, int second, int third, int fourth) { @@ -286,14 +233,9 @@ public char[] cycle(char[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The supplied array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public float[] cycle(float[] S, int first, int second, int third, int fourth) { @@ -306,14 +248,9 @@ public float[] cycle(float[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The supplied array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public double[] cycle(double[] S, int first, int second, int third, int fourth) { @@ -326,14 +263,9 @@ public double[] cycle(double[] S, int first, int second, int third, int fourth) } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The supplied array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public int[] cycle(int[] S, int first, int second, int third, int fourth) { @@ -346,15 +278,9 @@ public int[] cycle(int[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param The data type of the array - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The supplied array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public T[] cycle(T[] S, int first, int second, int third, int fourth) { @@ -367,15 +293,9 @@ public T[] cycle(T[] S, int first, int second, int third, int fourth) { } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The supplied array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public short[] cycle(short[] S, int first, int second, int third, int fourth, int fifth) { @@ -389,15 +309,9 @@ public short[] cycle(short[] S, int first, int second, int third, int fourth, in } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The supplied array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public char[] cycle(char[] S, int first, int second, int third, int fourth, int fifth) { @@ -411,15 +325,9 @@ public char[] cycle(char[] S, int first, int second, int third, int fourth, int } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The supplied array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public float[] cycle(float[] S, int first, int second, int third, int fourth, int fifth) { @@ -434,15 +342,9 @@ public float[] cycle(float[] S, int first, int second, int third, int fourth, in } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The supplied array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public double[] cycle(double[] S, int first, int second, int third, int fourth, int fifth) { @@ -456,15 +358,9 @@ public double[] cycle(double[] S, int first, int second, int third, int fourth, } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The supplied array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public int[] cycle(int[] S, int first, int second, int third, int fourth, int fifth) { @@ -478,16 +374,9 @@ public int[] cycle(int[] S, int first, int second, int third, int fourth, int fi } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param The data type of the array - * @param S Ignored - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The supplied array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public T[] cycle(T[] S, int first, int second, int third, int fourth, int fifth) { @@ -501,12 +390,9 @@ public T[] cycle(T[] S, int first, int second, int third, int fourth, int fi } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S Ignored - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The supplied array + * Reverse the elements in the array */ @Override public short[] reverse(short[] S, int start, int end) { @@ -517,12 +403,9 @@ public short[] reverse(short[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S Ignored - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The supplied array + * Reverse the elements in the array */ @Override public char[] reverse(char[] S, int start, int end) { @@ -533,12 +416,9 @@ public char[] reverse(char[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S Ignored - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The supplied array + * Reverse the elements in the array */ @Override public double[] reverse(double[] S, int start, int end) { @@ -549,12 +429,9 @@ public double[] reverse(double[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S Ignored - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The supplied array + * Reverse the elements in the array */ @Override public float[] reverse(float[] S, int start, int end) { @@ -565,12 +442,9 @@ public float[] reverse(float[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S Ignored - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The supplied array + * Reverse the elements in the array */ @Override public int[] reverse(int[] S, int start, int end) { @@ -581,13 +455,9 @@ public int[] reverse(int[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param The data type of the array - * @param S Ignored - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The supplied array + * Reverse the elements in the array */ @Override public T[] reverse(T[] S, int start, int end) { diff --git a/src/main/java/com/trickl/math/PairedPermutator.java b/src/main/java/com/trickl/math/PairedPermutator.java index 8c8e18d..57c0cac 100644 --- a/src/main/java/com/trickl/math/PairedPermutator.java +++ b/src/main/java/com/trickl/math/PairedPermutator.java @@ -13,9 +13,15 @@ * * @deprecated Use ChainPermutator directly * @author tgee + * @version $Id: $Id */ @Deprecated public class PairedPermutator extends ChainPermutator { + /** + *

Constructor for PairedPermutator.

+ * + * @param pair an array of int. + */ public PairedPermutator(int pair[]) { super(new IntArrayPermutator(pair), new StandardPermutator()); } diff --git a/src/main/java/com/trickl/math/Permutations.java b/src/main/java/com/trickl/math/Permutations.java index c163f22..9c11687 100644 --- a/src/main/java/com/trickl/math/Permutations.java +++ b/src/main/java/com/trickl/math/Permutations.java @@ -33,6 +33,7 @@ * 2) (4 3 1 2) (2 3 4 1) (3 2 4 1) (2 4 3 1) (4 2 3 1) (3 4 2 1) (4 3 2 1). * * @author tgee + * @version $Id: $Id */ public final class Permutations { diff --git a/src/main/java/com/trickl/math/Permutator.java b/src/main/java/com/trickl/math/Permutator.java index 9eec10d..2c87b6b 100644 --- a/src/main/java/com/trickl/math/Permutator.java +++ b/src/main/java/com/trickl/math/Permutator.java @@ -4,12 +4,13 @@ * Permutators are responsible for reordering the elements in arrays. * * @author tgee + * @version $Id: $Id */ public interface Permutator { /** * Perform a three cycle permutation. - * [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * [ 1, 2, 3 ] -> [ 2, 3, 1 ] * * @param S The array * @param first The index of the first element to swap @@ -21,7 +22,7 @@ public interface Permutator { /** * Perform a three cycle permutation. - * [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * [ 1, 2, 3 ] -> [ 2, 3, 1 ] * * @param S The array * @param first The index of the first element to swap @@ -33,7 +34,7 @@ public interface Permutator { /** * Perform a three cycle permutation. - * [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * [ 1, 2, 3 ] -> [ 2, 3, 1 ] * * @param S The array * @param first The index of the first element to swap @@ -45,7 +46,7 @@ public interface Permutator { /** * Perform a three cycle permutation. - * [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * [ 1, 2, 3 ] -> [ 2, 3, 1 ] * * @param S The array * @param first The index of the first element to swap @@ -57,7 +58,7 @@ public interface Permutator { /** * Perform a three cycle permutation. - * [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * [ 1, 2, 3 ] -> [ 2, 3, 1 ] * * @param S The array * @param first The index of the first element to swap @@ -69,7 +70,7 @@ public interface Permutator { /** * Perform a three cycle permutation. - * [ 1, 2, 3 ] -> [ 2, 3, 1 ] + * [ 1, 2, 3 ] -> [ 2, 3, 1 ] * * @param The type of the array * @param S The array @@ -82,7 +83,7 @@ public interface Permutator { /** * Perform a four cycle permutation. - * [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] * * @param S The array * @param first The index of the first element to swap @@ -95,7 +96,7 @@ public interface Permutator { /** * Perform a four cycle permutation. - * [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] * * @param S The array * @param first The index of the first element to swap @@ -107,7 +108,7 @@ public interface Permutator { char[] cycle(char[] S, int first, int second, int third, int fourth); /** - * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] * * @param S The array * @param first The index of the first element to swap @@ -119,7 +120,7 @@ public interface Permutator { float[] cycle(float[] S, int first, int second, int third, int fourth); /** - * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] * * @param S The array * @param first The index of the first element to swap @@ -131,7 +132,7 @@ public interface Permutator { double[] cycle(double[] S, int first, int second, int third, int fourth); /** - * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] * * @param S The array * @param first The index of the first element to swap @@ -143,7 +144,7 @@ public interface Permutator { int[] cycle(int[] S, int first, int second, int third, int fourth); /** - * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] + * Perform a four cycle permutation [ 1, 2, 3, 4] -> [ 2, 3, 4, 1] * * @param The type of the array * @param S The array @@ -156,7 +157,7 @@ public interface Permutator { T[] cycle(T[] S, int first, int second, int third, int fourth); /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] * * @param S The array * @param first The index of the first element to swap @@ -169,7 +170,7 @@ public interface Permutator { short[] cycle(short[] S, int first, int second, int third, int fourth, int fifth); /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] * * @param S The array * @param first The index of the first element to swap @@ -182,7 +183,7 @@ public interface Permutator { char[] cycle(char[] S, int first, int second, int third, int fourth, int fifth); /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] * * @param S The array * @param first The index of the first element to swap @@ -195,7 +196,7 @@ public interface Permutator { float[] cycle(float[] S, int first, int second, int third, int fourth, int fifth); /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] * * @param S The array * @param first The index of the first element to swap @@ -208,7 +209,7 @@ public interface Permutator { double[] cycle(double[] S, int first, int second, int third, int fourth, int fifth); /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] * * @param S The array * @param first The index of the first element to swap @@ -221,7 +222,7 @@ public interface Permutator { int[] cycle(int[] S, int first, int second, int third, int fourth, int fifth); /** - * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] + * Perform a five cycle permutation [ 1, 2, 3, 4, 5] -> [ 2, 3, 4, 5, 1] * * @param The data type of the array * @param S The array diff --git a/src/main/java/com/trickl/math/Quaternion.java b/src/main/java/com/trickl/math/Quaternion.java index bd9e6fc..4cdaf0a 100644 --- a/src/main/java/com/trickl/math/Quaternion.java +++ b/src/main/java/com/trickl/math/Quaternion.java @@ -24,6 +24,7 @@ * http://en.wikipedia.org/wiki/Quaternion * * @author tgee + * @version $Id: $Id */ public class Quaternion { @@ -32,10 +33,10 @@ public class Quaternion { /** * Create a quaternion * - * @param a - * @param b - * @param c - * @param d + * @param a a double. + * @param b a double. + * @param c a double. + * @param d a double. */ public Quaternion(double a, double b, double c, double d) { this.a = a; @@ -107,9 +108,9 @@ public Quaternion div(Quaternion other) { } /** - * Get the string representation of this quaternion, e.g. "1 + 2i + 3j + 4k". + * {@inheritDoc} * - * @return The string representation + * Get the string representation of this quaternion, e.g. "1 + 2i + 3j + 4k". */ @Override public String toString() { diff --git a/src/main/java/com/trickl/math/StandardPermutator.java b/src/main/java/com/trickl/math/StandardPermutator.java index 426d530..7ea9f0c 100644 --- a/src/main/java/com/trickl/math/StandardPermutator.java +++ b/src/main/java/com/trickl/math/StandardPermutator.java @@ -24,16 +24,14 @@ * The StandardPermutator simply reorders the elements in the array as requested. * * @author tgee + * @version $Id: $Id */ public class StandardPermutator implements Permutator { /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public short[] swap(short[] S, int first, int second) { @@ -44,12 +42,9 @@ public short[] swap(short[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public char[] swap(char[] S, int first, int second) { @@ -60,12 +55,9 @@ public char[] swap(char[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public double[] swap(double[] S, int first, int second) { @@ -76,12 +68,9 @@ public double[] swap(double[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public float[] swap(float[] S, int first, int second) { @@ -92,12 +81,9 @@ public float[] swap(float[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public int[] swap(int[] S, int first, int second) { @@ -108,13 +94,9 @@ public int[] swap(int[] S, int first, int second) { } /** - * Swap the elements in the array + * {@inheritDoc} * - * @param The data type of the array - * @param S The array - * @param first The index of the first element - * @param second The index of the second element - * @return The array + * Swap the elements in the array */ @Override public T[] swap(T[] S, int first, int second) { @@ -125,13 +107,9 @@ public T[] swap(T[] S, int first, int second) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public short[] cycle(short[] S, int first, int second, int third) { @@ -143,13 +121,9 @@ public short[] cycle(short[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public char[] cycle(char[] S, int first, int second, int third) { @@ -161,13 +135,9 @@ public char[] cycle(char[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public float[] cycle(float[] S, int first, int second, int third) { @@ -179,13 +149,9 @@ public float[] cycle(float[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public double[] cycle(double[] S, int first, int second, int third) { @@ -197,13 +163,9 @@ public double[] cycle(double[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public int[] cycle(int[] S, int first, int second, int third) { @@ -215,14 +177,9 @@ public int[] cycle(int[] S, int first, int second, int third) { } /** - * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] + * {@inheritDoc} * - * @param The type of the array - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @return The array + * Perform a three cycle permutation [1, 2, 3] -> [2, 3, 1] */ @Override public T[] cycle(T[] S, int first, int second, int third) { @@ -234,14 +191,9 @@ public T[] cycle(T[] S, int first, int second, int third) { } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public short[] cycle(short[] S, int first, int second, int third, int fourth) { @@ -254,14 +206,9 @@ public short[] cycle(short[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public char[] cycle(char[] S, int first, int second, int third, int fourth) { @@ -274,14 +221,9 @@ public char[] cycle(char[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public float[] cycle(float[] S, int first, int second, int third, int fourth) { @@ -294,14 +236,9 @@ public float[] cycle(float[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public double[] cycle(double[] S, int first, int second, int third, int fourth) { @@ -314,14 +251,9 @@ public double[] cycle(double[] S, int first, int second, int third, int fourth) } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public int[] cycle(int[] S, int first, int second, int third, int fourth) { @@ -334,15 +266,9 @@ public int[] cycle(int[] S, int first, int second, int third, int fourth) { } /** - * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] + * {@inheritDoc} * - * @param The data type of the array - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @return The array + * Perform a four cycle permutation [1, 2, 3, 4] -> [2, 3, 4, 1] */ @Override public T[] cycle(T[] S, int first, int second, int third, int fourth) { @@ -355,15 +281,9 @@ public T[] cycle(T[] S, int first, int second, int third, int fourth) { } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public short[] cycle(short[] S, int first, int second, int third, int fourth, int fifth) { @@ -377,15 +297,9 @@ public short[] cycle(short[] S, int first, int second, int third, int fourth, in } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public char[] cycle(char[] S, int first, int second, int third, int fourth, int fifth) { @@ -399,15 +313,9 @@ public char[] cycle(char[] S, int first, int second, int third, int fourth, int } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public float[] cycle(float[] S, int first, int second, int third, int fourth, int fifth) { @@ -422,15 +330,9 @@ public float[] cycle(float[] S, int first, int second, int third, int fourth, in } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public double[] cycle(double[] S, int first, int second, int third, int fourth, int fifth) { @@ -444,15 +346,9 @@ public double[] cycle(double[] S, int first, int second, int third, int fourth, } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public int[] cycle(int[] S, int first, int second, int third, int fourth, int fifth) { @@ -466,16 +362,9 @@ public int[] cycle(int[] S, int first, int second, int third, int fourth, int fi } /** - * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] + * {@inheritDoc} * - * @param The data type of the array - * @param S The array - * @param first The index of the first element to swap - * @param second The index of the second element to swap - * @param third The index of the third element to swap - * @param fourth The index of the fourth element to swap - * @param fifth The index of the fifth element to swap - * @return The array + * Perform a five cycle permutation [1, 2, 3, 4, 5] -> [2, 3, 4, 5, 1] */ @Override public T[] cycle(T[] S, int first, int second, int third, int fourth, int fifth) { @@ -489,12 +378,9 @@ public T[] cycle(T[] S, int first, int second, int third, int fourth, int fi } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public short[] reverse(short[] S, int start, int end) { @@ -505,12 +391,9 @@ public short[] reverse(short[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public char[] reverse(char[] S, int start, int end) { @@ -521,12 +404,9 @@ public char[] reverse(char[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public double[] reverse(double[] S, int start, int end) { @@ -537,12 +417,9 @@ public double[] reverse(double[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public float[] reverse(float[] S, int start, int end) { @@ -553,12 +430,9 @@ public float[] reverse(float[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public int[] reverse(int[] S, int start, int end) { @@ -569,13 +443,9 @@ public int[] reverse(int[] S, int start, int end) { } /** - * Reverse the elements in the array + * {@inheritDoc} * - * @param The data type of the array - * @param S The array - * @param start The first element in the range to be reversed - * @param end The last element in the range to be reversed - * @return The array + * Reverse the elements in the array */ @Override public T[] reverse(T[] S, int start, int end) { diff --git a/src/main/java/com/trickl/selection/MedianOfMedians.java b/src/main/java/com/trickl/selection/MedianOfMedians.java index d1dcca2..342db5d 100644 --- a/src/main/java/com/trickl/selection/MedianOfMedians.java +++ b/src/main/java/com/trickl/selection/MedianOfMedians.java @@ -18,6 +18,7 @@ * http://en.wikipedia.org/wiki/Selection_algorithm#Linear_general_selection_algorithm_-_Median_of_Medians_algorithm * * @author tgee + * @version $Id: $Id */ public class MedianOfMedians implements SelectionAlgorithm { @@ -27,14 +28,9 @@ public class MedianOfMedians implements SelectionAlgorithm { private static final ThreeWayPartitioner indexPairedPartitioner = new ThreeWayPartitioner(); /** - * Select the kth element in the range of an array + * {@inheritDoc} * - * @param S The array - * @param freq The frequency of elements in the array, if null freq(element) = 1 - * @param start The first element in the range - * @param end The last element in the range - * @param k - * @return The index of the kth element + * Select the kth element in the range of an array */ @Override public int select(char[] S, int[] freq, int start, int end, int k) { @@ -55,8 +51,9 @@ public int select(char[] S, int[] freq, int start, int end, int k) { * @param freq The frequency of elements in the array, if null freq(element) = 1 * @param start The first element in the range * @param end The last element in the range - * @param k + * @param k a int. * @return The index of the kth element + * @param index an array of int. */ protected int select(char[] S, int[] freq, int[] index, int start, int end, int k) { @@ -82,14 +79,9 @@ protected int select(char[] S, int[] freq, int[] index, int start, int end, int } /** - * Select the kth element in the range of an array + * {@inheritDoc} * - * @param S The array - * @param freq The frequency of elements in the array, if null freq(element) = 1 - * @param start The first element in the range - * @param end The last element in the range - * @param k - * @return The index of the kth element + * Select the kth element in the range of an array */ @Override public int select(short[] S, int[] freq, int start, int end, int k) { @@ -110,8 +102,9 @@ public int select(short[] S, int[] freq, int start, int end, int k) { * @param freq The frequency of elements in the array, if null freq(element) = 1 * @param start The first element in the range * @param end The last element in the range - * @param k + * @param k a int. * @return The index of the kth element + * @param index an array of int. */ protected int select(short[] S, int[] freq, int[] index, int start, int end, int k) { @@ -137,14 +130,9 @@ protected int select(short[] S, int[] freq, int[] index, int start, int end, int } /** - * Select the kth element in the range of an array + * {@inheritDoc} * - * @param S The array - * @param freq The frequency of elements in the array, if null freq(element) = 1 - * @param start The first element in the range - * @param end The last element in the range - * @param k - * @return The index of the kth element + * Select the kth element in the range of an array */ @Override public int select(double[] S, int[] freq, int start, int end, int k) { @@ -165,8 +153,9 @@ public int select(double[] S, int[] freq, int start, int end, int k) { * @param freq The frequency of elements in the array, if null freq(element) = 1 * @param start The first element in the range * @param end The last element in the range - * @param k + * @param k a int. * @return The index of the kth element + * @param index an array of int. */ protected int select(double[] S, int[] freq, int[] index, int start, int end, int k) { @@ -192,14 +181,9 @@ protected int select(double[] S, int[] freq, int[] index, int start, int end, in } /** - * Select the kth element in the range of an array + * {@inheritDoc} * - * @param S The array - * @param freq The frequency of elements in the array, if null freq(element) = 1 - * @param start The first element in the range - * @param end The last element in the range - * @param k - * @return The index of the kth element + * Select the kth element in the range of an array */ @Override public int select(float[] S, int[] freq, int start, int end, int k) { @@ -220,8 +204,9 @@ public int select(float[] S, int[] freq, int start, int end, int k) { * @param freq The frequency of elements in the array, if null freq(element) = 1 * @param start The first element in the range * @param end The last element in the range - * @param k + * @param k a int. * @return The index of the kth element + * @param index an array of int. */ protected int select(float[] S, int[] freq, int[] index, int start, int end, int k) { @@ -247,14 +232,9 @@ protected int select(float[] S, int[] freq, int[] index, int start, int end, int } /** - * Select the kth element in the range of an array + * {@inheritDoc} * - * @param S The array - * @param freq The frequency of elements in the array, if null freq(element) = 1 - * @param start The first element in the range - * @param end The last element in the range - * @param k - * @return The index of the kth element + * Select the kth element in the range of an array */ @Override public int select(int[] S, int[] freq, int start, int end, int k) { @@ -275,8 +255,9 @@ public int select(int[] S, int[] freq, int start, int end, int k) { * @param freq The frequency of elements in the array, if null freq(element) = 1 * @param start The first element in the range * @param end The last element in the range - * @param k + * @param k a int. * @return The index of the kth element + * @param index an array of int. */ protected int select(int[] S, int[] freq, int[] index, int start, int end, int k) { @@ -302,14 +283,9 @@ protected int select(int[] S, int[] freq, int[] index, int start, int end, int k } /** - * Select the kth element in the range of an array + * {@inheritDoc} * - * @param S The array - * @param freq The frequency of elements in the array, if null freq(element) = 1 - * @param start The first element in the range - * @param end The last element in the range - * @param k - * @return The index of the kth element + * Select the kth element in the range of an array */ @Override public int select(T[] S, int[] freq, int start, int end, int k, Comparator comparator) { @@ -332,8 +308,10 @@ public int select(T[] S, int[] freq, int start, int end, int k, Comparator a T object. */ protected int select( T[] S, int[] freq, int[] index, int start, int end, int k, Comparator comparator) { @@ -614,6 +592,8 @@ protected int partitionByMedian(int[] S, int[] freq, int[] indices, int low, int * @param low The first element in the range * @param high The last element in the range * @return The index of the kth element + * @param comparator a {@link java.util.Comparator} object. + * @param a T object. */ protected int partitionByMedian( T[] S, int[] freq, int[] indices, int low, int high, Comparator comparator) { diff --git a/src/main/java/com/trickl/selection/Selection.java b/src/main/java/com/trickl/selection/Selection.java index fa42e57..4e55249 100644 --- a/src/main/java/com/trickl/selection/Selection.java +++ b/src/main/java/com/trickl/selection/Selection.java @@ -12,6 +12,7 @@ * algorithm. * * @author tgee + * @version $Id: $Id */ public final class Selection { private static final NaturalOrderingComparator naturalOrderingComparator = @@ -24,7 +25,7 @@ private Selection() {} * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements */ @@ -67,7 +68,7 @@ public static int[] selectLast( * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements */ @@ -110,7 +111,7 @@ public static int[] selectLast( * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements */ @@ -153,7 +154,7 @@ public static int[] selectLast( * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements */ @@ -196,7 +197,7 @@ public static int[] selectLast( * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements */ @@ -239,9 +240,11 @@ public static int[] selectLast( * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements + * @param comparator a {@link java.util.Comparator} object. + * @param a T object. */ public static int[] selectLast( T[] S, @@ -257,9 +260,10 @@ public static int[] selectLast( * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements + * @param a T object. */ public static int[] selectFirst( char[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) { @@ -299,9 +303,10 @@ public static int[] selectFirst( * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements + * @param a T object. */ public static int[] selectFirst( short[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) { @@ -341,9 +346,10 @@ public static int[] selectFirst( * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements + * @param a T object. */ public static int[] selectFirst( double[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) { @@ -383,9 +389,10 @@ public static int[] selectFirst( * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements + * @param a T object. */ public static int[] selectFirst( float[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) { @@ -425,9 +432,10 @@ public static int[] selectFirst( * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements + * @param a T object. */ public static int[] selectFirst( int[] S, int[] freq, int k, SelectionAlgorithm selectionAlgorithm) { @@ -467,9 +475,11 @@ public static int[] selectFirst( * * @param S The array * @param freq The frequency of elements in the array - * @param k + * @param k a int. * @param selectionAlgorithm The algorithm to perform selection with * @return A size k array with the elements + * @param comparator a {@link java.util.Comparator} object. + * @param a T object. */ public static int[] selectFirst( T[] S, int[] freq, int k, Comparator comparator, SelectionAlgorithm selectionAlgorithm) { diff --git a/src/main/java/com/trickl/selection/SelectionAlgorithm.java b/src/main/java/com/trickl/selection/SelectionAlgorithm.java index 55831a7..49bbb26 100644 --- a/src/main/java/com/trickl/selection/SelectionAlgorithm.java +++ b/src/main/java/com/trickl/selection/SelectionAlgorithm.java @@ -6,6 +6,7 @@ * http://en.wikipedia.org/wiki/Selection_algorithm * * @author tgee + * @version $Id: $Id */ public interface SelectionAlgorithm { /** @@ -15,7 +16,7 @@ public interface SelectionAlgorithm { * @param freq The frequency of elements in the array, if null freq(element) = 1 * @param start The first element in the range * @param end The last element in the range - * @param k + * @param k a int. * @return The index of the kth element */ int select(char[] arr, int[] freq, int start, int end, int k); @@ -27,7 +28,7 @@ public interface SelectionAlgorithm { * @param freq The frequency of elements in the array, if null freq(element) = 1 * @param start The first element in the range * @param end The last element in the range - * @param k + * @param k a int. * @return The index of the kth element */ int select(short[] arr, int[] freq, int start, int end, int k); @@ -39,7 +40,7 @@ public interface SelectionAlgorithm { * @param freq The frequency of elements in the array, if null freq(element) = 1 * @param start The first element in the range * @param end The last element in the range - * @param k + * @param k a int. * @return The index of the kth element */ int select(double[] arr, int[] freq, int start, int end, int k); @@ -51,7 +52,7 @@ public interface SelectionAlgorithm { * @param freq The frequency of elements in the array, if null freq(element) = 1 * @param start The first element in the range * @param end The last element in the range - * @param k + * @param k a int. * @return The index of the kth element */ int select(float[] arr, int[] freq, int start, int end, int k); @@ -63,7 +64,7 @@ public interface SelectionAlgorithm { * @param freq The frequency of elements in the array, if null freq(element) = 1 * @param start The first element in the range * @param end The last element in the range - * @param k + * @param k a int. * @return The index of the kth element */ int select(int[] arr, int[] freq, int start, int end, int k); @@ -75,8 +76,10 @@ public interface SelectionAlgorithm { * @param freq The frequency of elements in the array, if null freq(element) = 1 * @param start The first element in the range * @param end The last element in the range - * @param k + * @param k a int. * @return The index of the kth element + * @param comparator a {@link java.util.Comparator} object. + * @param a T object. */ int select(T[] arr, int[] freq, int start, int end, int k, Comparator comparator); } diff --git a/src/main/java/com/trickl/sort/FiveElementSort.java b/src/main/java/com/trickl/sort/FiveElementSort.java index b7673f9..aaf15af 100644 --- a/src/main/java/com/trickl/sort/FiveElementSort.java +++ b/src/main/java/com/trickl/sort/FiveElementSort.java @@ -8,6 +8,7 @@ * An optimal five element sort that only uses seven comparisons. * * @author tgee + * @version $Id: $Id */ public class FiveElementSort implements Sorter { @@ -16,12 +17,9 @@ public class FiveElementSort implements Sorter { private Permutator permutator = new StandardPermutator(); /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 4 is always the last element in the range. - * @return The array + * Sort a range in the array. */ @Override public char[] sort(char[] arr, int start, int end) { @@ -138,12 +136,9 @@ public char[] sort(char[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 4 is always the last element in the range. - * @return The array + * Sort a range in the array. */ @Override public short[] sort(short[] arr, int start, int end) { @@ -260,12 +255,9 @@ public short[] sort(short[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 4 is always the last element in the range. - * @return The array + * Sort a range in the array. */ @Override public double[] sort(double[] arr, int start, int end) { @@ -382,12 +374,9 @@ public double[] sort(double[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 4 is always the last element in the range. - * @return The array + * Sort a range in the array. */ @Override public float[] sort(float[] arr, int start, int end) { @@ -504,12 +493,9 @@ public float[] sort(float[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 4 is always the last element in the range. - * @return The array + * Sort a range in the array. */ @Override public int[] sort(int[] arr, int start, int end) { @@ -625,14 +611,9 @@ public int[] sort(int[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param The data type of the array - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 4 is always the last element in the range. - * @param comparator The comparator to define the sort order - * @return The array + * Sort a range in the array. */ @Override public T[] sort(T[] arr, int start, int end, Comparator comparator) { diff --git a/src/main/java/com/trickl/sort/FourElementSort.java b/src/main/java/com/trickl/sort/FourElementSort.java index c2d2bf5..f464af8 100644 --- a/src/main/java/com/trickl/sort/FourElementSort.java +++ b/src/main/java/com/trickl/sort/FourElementSort.java @@ -8,6 +8,7 @@ * An optimal four element sort that only uses 5 comparisons. * * @author tgee + * @version $Id: $Id */ public class FourElementSort implements Sorter { @@ -17,12 +18,9 @@ public class FourElementSort implements Sorter { private Permutator permutator = new StandardPermutator(); /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 3 is always the last element in the range. - * @return The array + * Sort a range in the array. */ @Override public char[] sort(char[] arr, int start, int end) { @@ -53,12 +51,9 @@ public char[] sort(char[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 3 is always the last element in the range. - * @return The array + * Sort a range in the array. */ @Override public short[] sort(short[] arr, int start, int end) { @@ -89,12 +84,9 @@ public short[] sort(short[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 3 is always the last element in the range. - * @return The array + * Sort a range in the array. */ @Override public double[] sort(double[] arr, int start, int end) { @@ -125,12 +117,9 @@ public double[] sort(double[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 3 is always the last element in the range. - * @return The array + * Sort a range in the array. */ @Override public float[] sort(float[] arr, int start, int end) { @@ -161,12 +150,9 @@ public float[] sort(float[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 3 is always the last element in the range. - * @return The array + * Sort a range in the array. */ @Override public int[] sort(int[] arr, int start, int end) { @@ -197,13 +183,9 @@ public int[] sort(int[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param The data type of the array - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end Unused, instead start + 3 is always the last element in the range. - * @return The array + * Sort a range in the array. */ @Override public T[] sort(T[] arr, int start, int end, Comparator comparator) { diff --git a/src/main/java/com/trickl/sort/GreaterOrEqualPartitioner.java b/src/main/java/com/trickl/sort/GreaterOrEqualPartitioner.java index 2f291fc..f4010cb 100644 --- a/src/main/java/com/trickl/sort/GreaterOrEqualPartitioner.java +++ b/src/main/java/com/trickl/sort/GreaterOrEqualPartitioner.java @@ -5,11 +5,12 @@ import java.util.Comparator; /** - * A partitioner that divides the data set into two sets according to a pivot. - * A : a < pivot B : * b >= pivot + * A partitioner that divides the data set into two sets according to a pivot. + * A : a < pivot B : * b >= pivot * Note: values equal to the pivot are not guaranteed to be contiguous. * * @author tgee + * @version $Id: $Id */ public final class GreaterOrEqualPartitioner { diff --git a/src/main/java/com/trickl/sort/InsertionSort.java b/src/main/java/com/trickl/sort/InsertionSort.java index 6d9958e..08484cc 100644 --- a/src/main/java/com/trickl/sort/InsertionSort.java +++ b/src/main/java/com/trickl/sort/InsertionSort.java @@ -8,6 +8,7 @@ * http://en.wikipedia.org/wiki/Insertion_sort * * @author tgee + * @version $Id: $Id */ public class InsertionSort { @@ -121,6 +122,7 @@ public T[] sort(T[] arr, int start, int end) { * @param start The index of the first element in the range to sort * @param end The index of the last element in the range to sort * @return The array + * @param comparator a {@link java.util.Comparator} object. */ public T[] sort(T[] arr, int start, int end, Comparator comparator) { if (comparator == null) { diff --git a/src/main/java/com/trickl/sort/NaturalOrderingComparator.java b/src/main/java/com/trickl/sort/NaturalOrderingComparator.java index 4bfb50e..c70d449 100644 --- a/src/main/java/com/trickl/sort/NaturalOrderingComparator.java +++ b/src/main/java/com/trickl/sort/NaturalOrderingComparator.java @@ -7,15 +7,14 @@ * * @author tgee * @param type of element + * @version $Id: $Id */ public class NaturalOrderingComparator implements Comparator { /** - * Compare two elements. + * {@inheritDoc} * - * @param lhs Left hand side - * @param rhs Right hand side - * @return 1 if lhs > rhs, 0 if lhs == rhs, -1 if lhs < rhs + * Compare two elements. */ @Override public int compare(T lhs, T rhs) { diff --git a/src/main/java/com/trickl/sort/QuickSort.java b/src/main/java/com/trickl/sort/QuickSort.java index 3e0ec9a..cf7cfd1 100644 --- a/src/main/java/com/trickl/sort/QuickSort.java +++ b/src/main/java/com/trickl/sort/QuickSort.java @@ -8,6 +8,7 @@ * http://en.wikipedia.org/wiki/Quicksort. * * @author tgee + * @version $Id: $Id */ public final class QuickSort implements Sorter { @@ -18,12 +19,9 @@ public final class QuickSort implements Sorter { private Permutator permutator = new StandardPermutator(); /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end The index of the last element in the range to sort - * @return The array + * Sort a range in the array. */ @Override public char[] sort(char[] arr, int start, int end) { @@ -50,12 +48,9 @@ public char[] sort(char[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end The index of the last element in the range to sort - * @return The array + * Sort a range in the array. */ @Override public short[] sort(short[] arr, int start, int end) { @@ -82,12 +77,9 @@ public short[] sort(short[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end The index of the last element in the range to sort - * @return The array + * Sort a range in the array. */ @Override public double[] sort(double[] arr, int start, int end) { @@ -114,12 +106,9 @@ public double[] sort(double[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end The index of the last element in the range to sort - * @return The array + * Sort a range in the array. */ @Override public float[] sort(float[] arr, int start, int end) { @@ -146,12 +135,9 @@ public float[] sort(float[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end The index of the last element in the range to sort - * @return The array + * Sort a range in the array. */ @Override public int[] sort(int[] arr, int start, int end) { @@ -178,13 +164,9 @@ public int[] sort(int[] arr, int start, int end) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param The data type of the array - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end The index of the last element in the range to sort - * @return The array + * Sort a range in the array. */ @Override public T[] sort(T[] arr, int start, int end, Comparator comparator) { @@ -215,13 +197,9 @@ public T[] sort(T[] arr, int start, int end, Comparator comparator) { } /** - * Sort a range in the array. + * {@inheritDoc} * - * @param The data type of the array - * @param arr The array - * @param start The index of the first element in the range to sort - * @param end The index of the last element in the range to sort - * @return The array + * Sort a range in the array. */ public T[] sort(T[] arr, int start, int end) { return sort(arr, start, end, null); diff --git a/src/main/java/com/trickl/sort/Sorter.java b/src/main/java/com/trickl/sort/Sorter.java index 1384d18..a1fa64d 100644 --- a/src/main/java/com/trickl/sort/Sorter.java +++ b/src/main/java/com/trickl/sort/Sorter.java @@ -6,6 +6,7 @@ * Defines a standard interface for many sorting algorithms. * * @author tgee + * @version $Id: $Id */ public interface Sorter { /** diff --git a/src/main/java/com/trickl/sort/ThreeWayPartitioner.java b/src/main/java/com/trickl/sort/ThreeWayPartitioner.java index 62466ad..bef0f8c 100644 --- a/src/main/java/com/trickl/sort/ThreeWayPartitioner.java +++ b/src/main/java/com/trickl/sort/ThreeWayPartitioner.java @@ -6,9 +6,10 @@ /** * A partitioner that divides the data set into three partitions according to a pivot. - * A : a < * pivot B : b = pivot C : c > pivot + * A : a < * pivot B : b = pivot C : c > pivot * * @author tgee + * @version $Id: $Id */ public final class ThreeWayPartitioner {