//***********************************************************
//*
//* File:           Configuration.java
//* Author:         Abhinav Kamra
//* Contact:        kamra-at-cs.columbia.edu
//* Update:         9.5.2002
//*
//* Description:    Configuration object for Project 2, CS4444
//*                 Fall 2003
//*
//*
//***********************************************************

package ui;

public final class Configuration implements IFCConfiguration {

    int         _numrounds;
    int         _cookiecopies;
    int[]       _numroundsbounds;
    int[]       _numplayersbounds;
    Class[]     _classlist;
    Class[]     _playerlist;
    String[]    _gamefilelist;
    String      _gamefile;
    String      _logfile;

	public Configuration()
	{
		_cookiecopies = 1;
	}

    public void setNumRounds(int __numrounds) throws Exception {
        _numrounds = __numrounds;
    }
    
    public void setCookieCopies(int __cookiecopies) throws Exception {
        _cookiecopies = __cookiecopies;
    }
    
    public int cookieCopies() throws Exception {
        return _cookiecopies;
    }
    
    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 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[] gameFileList() throws Exception {
        int _MAX = _gamefilelist.length;
        String[] RET = new String[_MAX];
        
        System.arraycopy(_gamefilelist, 0, RET, 0, _MAX);
        return RET;
    }
    
    public void setGameFileList(String[] __list) throws Exception {
        int _MAX = __list.length;
        _gamefilelist = new String[_MAX];
        
        System.arraycopy(__list, 0, _gamefilelist, 0, _MAX);
    }
    
    public String gameFile() throws Exception {
        return _gamefile;
    }
    
    public void setGameFile(String __gamefile) throws Exception {
        _gamefile = __gamefile;
    }

    public String logFile() throws Exception {
        return _logfile;
    }

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