//***********************************************************
//*
//* File:           Configuration.java
//* Author:         Srikant Krishna
//* Contact:        srikant@cs.columbia.edu
//* Update:         9.5.2002
//*
//* Description:    Configuration object for Project 1, CS4444
//*                 Fall 2002
//*
//*
//***********************************************************

package ui;

public final class Configuration implements IFCConfiguration {

    int[] _numroundsbounds;
    int[] _numplayersbounds;
    int[] _numrobotsbounds;
    int[] _sizebounds;
    int _numrounds;
    int _numrobots;
    int _size;
    Class[] _classlist;
    Class[] _playerlist;
    String _logfile;
    
    
    public void setNumRounds(int __numrounds) throws Exception {
        _numrounds = __numrounds;
    }

    public int numRounds() throws Exception {
        return _numrounds;
    }
    
    public void setNumRoundsBounds(int __min, int __max) throws Exception {
        _numroundsbounds = new int[2];
        _numroundsbounds[0] = __min;
        _numroundsbounds[1] = __max;
    }
    
    public int numRoundsMin() throws Exception {
        return _numroundsbounds[0];
    }

    public int numRoundsMax() throws Exception {
        return _numroundsbounds[1];
    }

    public int numPlayers() throws Exception {
        return _playerlist.length;
    }
    
    public void setNumPlayersBounds(int __min, int __max) throws Exception {
        _numplayersbounds = new int[2];
        _numplayersbounds[0] = __min;
        _numplayersbounds[1] = __max;
    }
    
    public int numPlayersMin() throws Exception {
        return _numplayersbounds[0];
    }

    public int numPlayersMax() throws Exception {
        return _numplayersbounds[1];
    }
    
    public void setNumRobots(int __numrobots) throws Exception {
        _numrobots = __numrobots;
    }
    
    public int numRobots() throws Exception {
        return _numrobots;
    }

    public void setNumRobotsBounds(int __min, int __max) throws Exception {
        _numrobotsbounds = new int[2];
        _numrobotsbounds[0] = __min;
        _numrobotsbounds[1] = __max;
    }
    
    public int numRobotsMin() throws Exception {
        return _numrobotsbounds[0];
    }
    
    public int numRobotsMax() throws Exception {
        return _numrobotsbounds[1];
    }

    public void setSize(int __size) throws Exception {
        _size = __size;
    }
    
    public int size() throws Exception {
        return _size;
    }
    
    public void setSizeBounds(int __min, int __max) throws Exception {
        _sizebounds = new int[2];
        _sizebounds[0] = __min;
        _sizebounds[1] = __max;
    }

    public int sizeMin() throws Exception {
        return _sizebounds[0];
    }
    
    public int sizeMax() throws Exception {
        return _sizebounds[1];
    }
    
    public void setClassList(Class[] __list) throws Exception {
        int _MAX = __list.length;
        
        _classlist = new Class[_MAX];
        System.arraycopy(__list, 0, _classlist, 0, _MAX);    
    }    
    
    public Class[] classList() throws Exception {
        int _MAX = _classlist.length;
        Class[] RET = new Class[_MAX];
        
        System.arraycopy(_classlist, 0, RET, 0, _MAX);
        return RET;    
    }
    
    public Class getClass(int __pos) throws Exception {
        return _classlist[__pos];
    }
    
    public void setClass(int __pos, Class __class) throws Exception {
        _classlist[__pos] = __class;
    }
    
    public void setPlayerList(Class[] __list) throws Exception {
        int _MAX = __list.length;
        
        if (_MAX < _numplayersbounds[0] || _MAX > _numplayersbounds[1]) {
            throw new Exception("Error:  Number of Players Out of Range: "+_MAX);
        }
        _playerlist = new Class[_MAX];
        System.arraycopy(__list, 0, _playerlist, 0, _MAX);
    }        
    
    public Class[] playerList() throws Exception {
        int _MAX = _playerlist.length;
        Class[] RET = new Class[_MAX];
        
        System.arraycopy(_playerlist, 0, RET, 0, _MAX);
        return RET;
    }

    public Class player(int __pos) throws Exception {
        return _playerlist[__pos];
    }

    public void setPlayer(int __pos, Class __class) throws Exception {
        _playerlist[__pos] = __class;
    }
    
    public String logFile() throws Exception {
        return _logfile;
    }

    public void setLogFile(String __logfile) throws Exception {
        _logfile = __logfile;
    }
}
