// Path: app/src/main/java/com/derek/android/rubik/Cube3.java
// public class Layer {
//     public static final short axisX = 0;
//     public static final short axisY = 1;
//     public static final short axisZ = 3;
//     public static final float twoPI = (float)Math.PI * 2.0f;
// 
//     public Cube[][] cubes = new Cube[3][3];
//     private final Matrix3 transform = new Matrix3();
//     short axis;
// 
//     public void setFaceColor(int position, Color color) {
//         int i, j;
//         for (i = 0; i < 3; i++) {
//             for (j = 0; j < 3; j++) {
//                 cubes[i][j].setFaceColor(position, color);
//             }
//         }
//     }
// 
//     public void update(Matrix3 M, IntBuffer vertexBuffer) {
//         int i, j;
//         for (i = 0; i < 3; i++) {
//             for (j = 0; j < 3; j++) {
//                 cubes[i][j].update(M, vertexBuffer);
//             }
//         }
//     }
// 
//     public void addAngle(float angle) {
//         while (angle >= twoPI) {
//             angle -= twoPI;
//         }
//         while (angle < 0.0f) {
//             angle += twoPI;
//         }
//         float sin = (float)Math.sin(angle);
//         float cos = (float)Math.cos(angle);
//         switch (axis) {
//         case Layer.axisX:
//             transform.m[1][1] = cos;
//             transform.m[1][2] = sin;
//             transform.m[2][1] = -sin;
//             transform.m[2][2] = cos;
//             transform.m[0][0] = 1.0f;
//             transform.m[0][1] = transform.m[0][2] = transform.m[1][0] = transform.m[2][0] = 0f;
//             break;
//         case Layer.axisY:
//             transform.m[0][0] = cos;
//             transform.m[0][2] = sin;
//             transform.m[2][0] = -sin;
//             transform.m[2][2] = cos;
//             transform.m[1][1] = 1f;
//             transform.m[0][1] = transform.m[1][0] = transform.m[1][2] = transform.m[2][1] = 0f;
//             break;
//         case Layer.axisZ:
//             transform.m[0][0] = cos;
//             transform.m[0][1] = sin;
//             transform.m[1][0] = -sin;
//             transform.m[1][1] = cos;
//             transform.m[2][2] = 1f;
//             transform.m[2][0] = transform.m[2][1] = transform.m[0][2] = transform.m[1][2] = 0f;
//             break;
//         }
//         this.update(transform, Cube3.getInstance().vertexBuffer);
//     }
// 
//     public void saveRotation() {
//         int i, j;
//         for (i = 0; i < 3; i++) {
//             for (j = 0; j < 3; j++) {
//                 cubes[i][j].saveRotation(transform);
//             }
//         }
//     }
// 
//     public void saveRotation(Matrix3 M) {
//         int i, j;
//         for (i = 0; i < 3; i++) {
//             for (j = 0; j < 3; j++) {
//                 cubes[i][j].saveRotation(M);
//             }
//         }
//     }
// }


import com.derek.android.rubik.Cube3.Layer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;

        faces[Cube.left] = new Square(leftBottomBack,leftTopBack,leftTopFront,leftBottomFront);
        faces[Cube.right] = new Square(rightBottomBack, rightTopBack, rightTopFront, rightBottomFront);
        faces[Cube.bottom] = new Square(rightBottomBack, rightBottomFront, leftBottomFront, leftBottomBack);
        faces[Cube.top] = new Square(rightTopFront, leftTopFront, leftTopBack, rightTopBack);
        faces[Cube.back] = new Square(leftBottomBack, leftTopBack, rightTopBack, rightBottomBack);
        faces[Cube.front] = new Square(rightBottomFront, leftBottomFront, leftTopFront, rightTopFront);
    }

    public void setFaceColor(int position, Color color) {
        faces[position].setColor(color);
    }

    public Color getFaceColor(int position) {
        return faces[position].getColor();
    }

    public Square getFace(int position){
        return faces[position];
    }

    public void put(IntBuffer vertexBuffer, IntBuffer colorBuffer, ShortBuffer indexBuffer) {
        for (Square square : faces) {
            square.put(vertexBuffer, colorBuffer, indexBuffer);
        }
    }

    public void updateFace(short axis, boolean direction) {
        Square temp;
        switch (axis) {
// Path: app/src/main/java/com/derek/android/rubik/Cube3.java
// public class Layer {
//     public static final short axisX = 0;
//     public static final short axisY = 1;
//     public static final short axisZ = 3;
//     public static final float twoPI = (float)Math.PI * 2.0f;
// 
//     public Cube[][] cubes = new Cube[3][3];
//     private final Matrix3 transform = new Matrix3();
//     short axis;
// 
//     public void setFaceColor(int position, Color color) {
//         int i, j;
//         for (i = 0; i < 3; i++) {
//             for (j = 0; j < 3; j++) {
//                 cubes[i][j].setFaceColor(position, color);
//             }
//         }
//     }
// 
//     public void update(Matrix3 M, IntBuffer vertexBuffer) {
//         int i, j;
//         for (i = 0; i < 3; i++) {
//             for (j = 0; j < 3; j++) {
//                 cubes[i][j].update(M, vertexBuffer);
//             }
//         }
//     }
// 
//     public void addAngle(float angle) {
//         while (angle >= twoPI) {
//             angle -= twoPI;
//         }
//         while (angle < 0.0f) {
//             angle += twoPI;
//         }
//         float sin = (float)Math.sin(angle);
//         float cos = (float)Math.cos(angle);
//         switch (axis) {
//         case Layer.axisX:
//             transform.m[1][1] = cos;
//             transform.m[1][2] = sin;
//             transform.m[2][1] = -sin;
//             transform.m[2][2] = cos;
//             transform.m[0][0] = 1.0f;
//             transform.m[0][1] = transform.m[0][2] = transform.m[1][0] = transform.m[2][0] = 0f;
//             break;
//         case Layer.axisY:
//             transform.m[0][0] = cos;
//             transform.m[0][2] = sin;
//             transform.m[2][0] = -sin;
//             transform.m[2][2] = cos;
//             transform.m[1][1] = 1f;
//             transform.m[0][1] = transform.m[1][0] = transform.m[1][2] = transform.m[2][1] = 0f;
//             break;
//         case Layer.axisZ:
//             transform.m[0][0] = cos;
//             transform.m[0][1] = sin;
//             transform.m[1][0] = -sin;
//             transform.m[1][1] = cos;
//             transform.m[2][2] = 1f;
//             transform.m[2][0] = transform.m[2][1] = transform.m[0][2] = transform.m[1][2] = 0f;
//             break;
//         }
//         this.update(transform, Cube3.getInstance().vertexBuffer);
//     }
// 
//     public void saveRotation() {
//         int i, j;
//         for (i = 0; i < 3; i++) {
//             for (j = 0; j < 3; j++) {
//                 cubes[i][j].saveRotation(transform);
//             }
//         }
//     }
// 
//     public void saveRotation(Matrix3 M) {
//         int i, j;
//         for (i = 0; i < 3; i++) {
//             for (j = 0; j < 3; j++) {
//                 cubes[i][j].saveRotation(M);
//             }
//         }
//     }
// }


// Path: app/src/main/java/com/derek/android/rubik/Cube.java
import com.derek.android.rubik.Cube3.Layer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;


        faces[Cube.left] = new Square(leftBottomBack,leftTopBack,leftTopFront,leftBottomFront);
        faces[Cube.right] = new Square(rightBottomBack, rightTopBack, rightTopFront, rightBottomFront);
        faces[Cube.bottom] = new Square(rightBottomBack, rightBottomFront, leftBottomFront, leftBottomBack);
        faces[Cube.top] = new Square(rightTopFront, leftTopFront, leftTopBack, rightTopBack);
        faces[Cube.back] = new Square(leftBottomBack, leftTopBack, rightTopBack, rightBottomBack);
        faces[Cube.front] = new Square(rightBottomFront, leftBottomFront, leftTopFront, rightTopFront);
    }

    public void setFaceColor(int position, Color color) {
        faces[position].setColor(color);
    }

    public Color getFaceColor(int position) {
        return faces[position].getColor();
    }

    public Square getFace(int position){
        return faces[position];
    }

    public void put(IntBuffer vertexBuffer, IntBuffer colorBuffer, ShortBuffer indexBuffer) {
        for (Square square : faces) {
            square.put(vertexBuffer, colorBuffer, indexBuffer);
        }
    }

    public void updateFace(short axis, boolean direction) {
        Square temp;
        switch (axis) {
        case Layer.axisX: