Examples of PermutationsProvider


Examples of cc.redberry.core.combinatorics.PermutationsProvider

    public static boolean compareArrays(final Object[] array1, final Object[] array2) {
        int size;
        if ((size = array1.length) != array2.length)
            return false;
        PermutationsProvider provider = generateProvider(array1);
        int[] nonPermutablePositions = PermutationsProvider.Util.getNonpermutablePositions(size, provider);
        for (int i : nonPermutablePositions)
            if (!array1[i].equals(array2[i]))
                return false;
        int[] targetPositions = provider.targetPositions();
        out_for:
        for (Permutation permutation : provider.allPermutations()) {
            for (int i = 0; i < targetPositions.length; ++i)
                if (!array1[targetPositions[i]].equals(array2[targetPositions[permutation.newIndexOf(i)]]))
                    continue out_for;
            return true;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.