@@ -930,118 +930,4 @@ public boolean equals(Object other) {
930930 public int hashCode () {
931931 return Arrays .hashCode (permutation );
932932 }
933-
934- /**
935- * <p>The Permutation.Mechanic class provides a means of adding application-specific
936- * operations on Permutations without the need to directly alter the Permutation
937- * class. It is similar to a Visitor from the Visitor pattern.</p>
938- *
939- * <p>The methods of the Permutation.Mechanic class are unsafe, and if used incorrectly
940- * can result in invalid Permutation state, and/or runtime exceptions. The methods of
941- * this nested class do not perform any bounds checks. Additionally, they do not check
942- * whether the usage produces a valid permutation.</p>
943- *
944- * <p>The Permutation.Mechanic class cannot be instantiated directly. To use, you must
945- * define a subtype by extending the Permutation.Mechanic class. It is the responsibility
946- * of the subclass to ensure that all of the methods of the subclass are safe. For example,
947- * one of the set methods of the Permutation.Mechanic class enables setting a specific
948- * index of a Permutation to any integer value. Individual calls to that method will
949- * produce an invalid Permutation. It is the responsibility of any public method of the subclass to ensure
950- * that a combination of calls to the set method is performed that results in a valid Permutation by the
951- * time that subclass method returns.</p>
952- *
953- * <p>Here's the Mechanic analogy: Imagine that you take your car in for service. The mechanic
954- * opens the hood, and starts disconnecting and removing stuff. During much of that time,
955- * your car is inoperable. However, by the time you pick up your car, it has been put back
956- * together properly, and is in functioning order. Perhaps it has new tires, or a new timing belt, etc,
957- * so its state has changed.</p>
958- *
959- * <p>Consider a subclass, Subclass, of the Permutation.Mechanic. An object of Subclass is like a mechanic,
960- * and the Permutation passed to its methods is the car. Each call to a public method of Subclass is like
961- * a visit to the service station. Just like a mechanic can take your car apart during that service visit,
962- * a public method of Subclass can similarly, temporarily, create a non-functioning Permutation. However,
963- * that public method is expected to ensure that the Permutation is fully valid before returning.</p>
964- *
965- * @deprecated This class will be removed in the next major release, 4.0.0, and you should instead
966- * use the functionality provided by the {@link Permutation#apply(PermutationUnaryOperator)} and
967- * {@link Permutation#apply(PermutationBinaryOperator,Permutation)} methods, and the related
968- * {@link PermutationUnaryOperator} and {@link PermutationBinaryOperator} interfaces.
969- *
970- * @author <a href=https://www.cicirello.org/ target=_top>Vincent A. Cicirello</a>,
971- * <a href=https://www.cicirello.org/ target=_top>https://www.cicirello.org/</a>
972- */
973- @ Deprecated public static class Mechanic {
974-
975- /**
976- * The default constructor can only be called by subclasses.
977- */
978- protected Mechanic () {}
979-
980- /**
981- * Changes the state of the Permutation according to the contents
982- * of an array of int values. The caller of this method is responsible
983- * to ensure that the array is the same length as the Permutation,
984- * and that the elements are a valid permutation of the integers from the
985- * set { 0, 1, ..., n-1 } where n is the length of the permutation.
986- * The behavior of the Permutation object may become unstable otherwise.
987- *
988- * @param p Permutation object to change.
989- * @param permutation An array of int values, assumed the be a valid permutation
990- * of the integers from 0 to n-1.
991- */
992- protected final void set (Permutation p , int [] permutation ) {
993- System .arraycopy (permutation , 0 , p .permutation , 0 , permutation .length );
994- }
995-
996- /**
997- * Changes the integer in one specific location of a Permutation. Individual calls
998- * to this method will, in most cases, produce an invalid Permutation. The caller
999- * is responsible for making a combination of calls to this method that together produce
1000- * a valid Permutation. The behavior of the Permutation object may become unstable otherwise.
1001- * The caller should not return until the state of the Permutation object is again valid.
1002- *
1003- * @param p Permutation object to change.
1004- * @param index The index of the position to change.
1005- * @param value The value to change that position to.
1006- */
1007- protected final void set (Permutation p , int index , int value ) {
1008- p .permutation [index ] = value ;
1009- }
1010-
1011- /**
1012- * Changes a range of permutation elements. This method does not verify that the
1013- * change produces a valid permutation. The caller is responsible for making a combination
1014- * of calls to this method and/or the other methods of the Permutation.Mechanic class that
1015- * together produce a valid Permutation.
1016- * The behavior of the Permutation object may become unstable otherwise.
1017- * The caller should not return until the state of the Permutation object is again valid.
1018- *
1019- * @param p Permutation object to change.
1020- * @param index The index for the start of the new elements.
1021- * @param subpermutation The new elements, which are copied into the permutation beginning
1022- * at position index of the permutation.
1023- */
1024- protected final void set (Permutation p , int index , int [] subpermutation ) {
1025- System .arraycopy (subpermutation , 0 , p .permutation , index , subpermutation .length );
1026- }
1027-
1028- /**
1029- * Changes a range of permutation elements. This method does not verify that the
1030- * change produces a valid permutation. The caller is responsible for making a combination
1031- * of calls to this method and/or the other methods of the Permutation.Mechanic class that
1032- * together produce a valid Permutation.
1033- * The behavior of the Permutation object may become unstable otherwise.
1034- * The caller should not return until the state of the Permutation object is again valid.
1035- *
1036- * @param p Permutation object to change.
1037- * @param source An array to copy elements from.
1038- * @param fromIndex An index into source where copying begins, e.g., the first element
1039- * copied is source[fromIndex].
1040- * @param toIndex An index into the Permutation p, where the elements will be copied to.
1041- * @param numElementsToSet The number of elements to copy from source to p.
1042- */
1043- protected final void set (Permutation p , int [] source , int fromIndex , int toIndex , int numElementsToSet ) {
1044- System .arraycopy (source , fromIndex , p .permutation , toIndex , numElementsToSet );
1045- }
1046- }
1047933}
0 commit comments