/*
 * MyFirst solo Project Spring 2014
 * Matching Card Game
 */

package view;
import java.awt.EventQueue;
import java.util.ArrayList;
import java.util.List;

/**
 * This class is the Main which makes a call to gui.start() which starts the construction of 
 * the GUI.
 * 
 * @author Brian Dennis
 * @version 3-25-2014
 */
public final class MatchingGameMain {

    /** the default values that will be made into cards. */
    private static final String[] MY_DEFAULT_VALUES 
        = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace"};
    
    /** A list I use to put the default values into, which I use because the rest of the
      program uses ArrayLists to manipulate data. */
    private static List<String> myValueNames = new ArrayList<String>();
    
    /**
     * Private constructor, to prevent instantiation of this class.
     */
    private MatchingGameMain() {
        
        throw new IllegalStateException();
    }
    
    /**
     * The main method, invokes the MatchingGameGUI.
     * 
     * @param theArgs theArgs
     */
    public static void main(final String[] theArgs) {
        
        if (myValueNames.isEmpty()) {
            
            for (final String value : MY_DEFAULT_VALUES) {
                
                myValueNames.add(value);
            }
        }
        
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                
                final MatchingGameGUI gui = new MatchingGameGUI(myValueNames);
                gui.start();    
            }
        });
    }
    
    /**
     * For changing the cards to have specified values.
     * 
     * @param theNewValues the new values to make a new game with
     */
    public static void changeValues(final List<String> theNewValues) {
        
        final String[] noArgs1 = {};
        myValueNames = theNewValues;
        main(noArgs1);
    }
}