<commit_before>package net.yeputons.android239.rubikscube;

import min3d.core.Object3dContainer;
import min3d.objectPrimitives.Box;
import min3d.vos.Color4;
import min3d.vos.Light;
import min3d.vos.Number3d;

import java.util.Random;

public class RubiksCube extends Object3dContainer implements Cloneable {
    public static final Color4 COLORS[] = {
            new Color4(255, 0, 0, 255),
            new Color4(0, 0, 255, 255),
            new Color4(255, 128, 0, 255),
            new Color4(0, 255, 0, 255),
            new Color4(255, 255, 255, 255),
            new Color4(255, 255, 0, 255)
    };

    public static final int FRONT = 0;
    public static final int RIGHT = 1;
    public static final int BACK = 2;
    public static final int LEFT = 3;
    public static final int TOP = 4;
    public static final int BOTTOM = 5;

    protected int[][][] cols;
    protected int[][][] facesMsk;
    protected Box[][][] boxes;
    private OnCubeRotationDoneListener listener;

    protected int curTurnFace = -1;
    protected int curTurnProgress = 90;
    protected int curTurnDirection = 0;

    public RubiksCube() {
        super();

        cols = new int[6][3][3];
        for (int i = 0; i < 6; i++)
            for (int y = 0; y < 3; y++)
                for (int x = 0; x < 3; x++)
                    cols[i][y][x] = i;
        boxes = new Box[3][3][3];

        recreateBoxes();
    }

    @Override
    public RubiksCube clone() {
        if (curTurnFace >= 0) {
            throw new RotationIsInProgressException();
        }

        RubiksCube other = new RubiksCube();
        for (int i = 0; i < 6; i++)<commit_msg>RubiksCube: added serialization (colors only, no current rotation state)<commit_after>package net.yeputons.android239.rubikscube;

import min3d.core.Object3dContainer;
import min3d.objectPrimitives.Box;
import min3d.vos.Color4;
import min3d.vos.Light;
import min3d.vos.Number3d;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Random;

public class RubiksCube extends Object3dContainer implements Cloneable, Serializable {
    public static final Color4 COLORS[] = {
            new Color4(255, 0, 0, 255),
            new Color4(0, 0, 255, 255),
            new Color4(255, 128, 0, 255),
            new Color4(0, 255, 0, 255),
            new Color4(255, 255, 255, 255),
            new Color4(255, 255, 0, 255)
    };

    public static final int FRONT = 0;
    public static final int RIGHT = 1;
    public static final int BACK = 2;
    public static final int LEFT = 3;
    public static final int TOP = 4;
    public static final int BOTTOM = 5;

    protected int[][][] cols;
    protected int[][][] facesMsk;
    protected Box[][][] boxes;
    private OnCubeRotationDoneListener listener;

    protected int curTurnFace = -1;
    protected int curTurnProgress = 90;
    protected int curTurnDirection = 0;

    public RubiksCube() {
        super();

        cols = new int[6][3][3];
        for (int i = 0; i < 6; i++)
            for (int y = 0; y < 3; y++)
                for (int x = 0; x < 3; x++)
                    cols[i][y][x] = i;
        boxes = new Box[3][3][3];

        recreateBoxes();
    }

    private void writeObject(ObjectOutputStream out) throws IOException {
        for (int i = 0; i < 6; i++)
            for (int j = 0; j < 3; j++)
                for (int k = 0; k < 3; k++)
                    out.writeByte((byte) cols[i][j][k]);
    }
    private void readObject(ObjectInputStream in) throws IOException {
        cols = new int[6][3][3];
        for (int i = 0; i < 6; i++)
            for (int j = 0; j < 3; j++)
                for (int k = 0; k < 3; k++)
                    cols[i][j][k] = in.readByte();
        boxes = new Box[3][3][3];
        recreateBoxes();
        curTurnFace = -1;
        curTurnProgress = 90;
        curTurnDirection = 0;
    }

    @Override
    public RubiksCube clone() {
        if (curTurnFace >= 0) {
            throw new RotationIsInProgressException();
        }

        RubiksCube other = new RubiksCube();
        for (int i = 0; i < 6; i++)
{'fraction_non_alphanumeric': 0.12106653855392746, 'fraction_numerical': 0.05332692769637281, 'mean_word_length': 2.1713632901751714, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5213219', 'n_tokens_mistral': 1523, 'n_tokens_neox': 1326, 'n_words': 427}