//***********************************************************
//*
//* File:           MoveResult.java
//* Author:         Srikant Krishna
//* Contact:        srikant@cs.columbia.edu
//* Update:         10.16..2002
//*
//* Description:    History entry object for Project 3,
//*                 CS4444 Fall 2002.
//*
//***********************************************************

package Rectangles;

import java.io.Serializable;

public final class MoveResult implements Serializable {

    int[]     _winners;
    double[]  _scores;
    char[][]  _moves;
    
    public void setMoves(char[][] __moves) throws Exception {
        int _MAXI = __moves.length;
        int _MAXJ;
        
        _moves = new char[_MAXI][];
        for (int i=0; i < _MAXI; i++) {
            if (__moves[i] == null) {
                continue;
            }
            _MAXJ = __moves[i].length;
            _moves[i] = new char[_MAXJ];
            System.arraycopy(__moves[i], 0, _moves[i], 0, _MAXJ);
        }
    }

    public char[][] moves() throws Exception {
        char[][] RET;
        int _MAXI = _moves.length;
        int _MAXJ;

        RET = new char[_MAXI][];
        for (int i=0; i < _MAXI; i++) {
            if (_moves[i] == null) {
                continue;
            }
            _MAXJ = _moves[i].length;
            RET[i] = new char[_MAXJ];
            System.arraycopy(_moves[i], 0, RET[i], 0, _MAXJ);
        }
        return RET;
    }
    
    public void setWinners(int[] __winners) throws Exception {
        if (__winners == null) {
            _winners = null;
            return;
        }
        int _MAX = __winners.length;
        
        _winners = new int[_MAX];
        System.arraycopy(__winners, 0, _winners, 0, _MAX);
    }

    public int[] winners() throws Exception {
        if (_winners == null) {
            return null;
        }

        int[] RET;
        int _MAX = _winners.length;

        RET = new int[_MAX];
        System.arraycopy(_winners, 0, RET, 0, _MAX);
        return RET;
    }

    public void setScores(double[] __scores) throws Exception {
        int _MAX = __scores.length;

        _scores = new double[_MAX];
        System.arraycopy(__scores, 0, _scores, 0, _MAX);
    }

    public double[] scores() throws Exception {
        int _MAX = _scores.length;
        double[] RET;

        RET = new double[_MAX];
        System.arraycopy(_scores, 0, RET, 0, _MAX);
        return RET;
    }

    public MoveResult copy() throws Exception {
            
        MoveResult RET = new MoveResult();
        RET._winners = winners();
        RET._scores = scores();
        RET._moves = moves();
        return RET;
    }
}
