package com.mojang.math;

import net.minecraft.Util;
import java.util.Arrays;

public enum SymmetricGroup3 {
    P123(0, 1, 2), 
    P213(1, 0, 2), 
    P132(0, 2, 1), 
    P231(1, 2, 0), 
    P312(2, 0, 1), 
    P321(2, 1, 0);
    
    private final int[] permutation;
    private final Matrix3f transformation;
    private static final SymmetricGroup3[][] cayleyTable;
    
    private SymmetricGroup3(final int integer3, final int integer4, final int integer5) {
        this.permutation = new int[] { integer3, integer4, integer5 };
        (this.transformation = new Matrix3f()).set(0, this.permutation(0), 1.0f);
        this.transformation.set(1, this.permutation(1), 1.0f);
        this.transformation.set(2, this.permutation(2), 1.0f);
    }
    
    public SymmetricGroup3 compose(final SymmetricGroup3 e) {
        return SymmetricGroup3.cayleyTable[this.ordinal()][e.ordinal()];
    }
    
    public int permutation(final int integer) {
        return this.permutation[integer];
    }
    
    public Matrix3f transformation() {
        return this.transformation;
    }
    
    static {
        final SymmetricGroup3[] array;
        int length;
        int i = 0;
        SymmetricGroup3 e2;
        final SymmetricGroup3[] array2;
        int length2;
        int j = 0;
        SymmetricGroup3 e3;
        int[] arr2;
        int integer11;
        SymmetricGroup3 e4;
        cayleyTable = Util.<SymmetricGroup3[][]>make(new SymmetricGroup3[values().length][values().length], arr -> {
            values();
            for (length = array.length; i < length; ++i) {
                e2 = array[i];
                values();
                for (length2 = array2.length; j < length2; ++j) {
                    e3 = array2[j];
                    arr2 = new int[3];
                    for (integer11 = 0; integer11 < 3; ++integer11) {
                        arr2[integer11] = e2.permutation[e3.permutation[integer11]];
                    }
                    e4 = Arrays.<SymmetricGroup3>stream(values()).filter(e -> Arrays.equals(e.permutation, arr2)).findFirst().get();
                    arr[e2.ordinal()][e3.ordinal()] = e4;
                }
            }
        });
    }
}
