/* @(#)GameImageData.java    25 September 2007 */


/**
 * <p>The class for the Concentration game web image data.</p>
 * 
 * <p>Class <code>GameImageData</code> manages the string data for
 * the images URL and images list file name for the images
 * used in the Concentration game.</p>
 * 
 * <p>This data is fed to the JPT class <code>WebImageTools</code>
 * when the images are retrieved as <code>Paintable</code> objects
 * by the class <code>GamePaintables</code>.</p>
 * 
 * <p>Uses Java Power Tools 2.6.0.</p>
 * 
 * <p>Copyright, Richard Rasala, 2007.</p>
 * 
 * @author Richard Rasala
 */
public class GameImageData {
    
    /** The default constructor. */
    public GameImageData() { }
    
    
    /** 
     * <p>The constructor that
     * sets the images URL provided that the given url
     * is non-<code>null</code> and of positive length.</p>
     */
    public GameImageData(String url) {
        setImagesURL(url);
    }
    
    
    /** 
     * <p>The constructor that
     * sets the images URL
     * provided that the given url
     * is non-<code>null</code> and of positive length
     * and sets the image list file name
     * provided that the given name
     * is non-<code>null</code> and of positive length.</p>
     */
    public GameImageData(String url, String name) {
        setImagesURL(url);
        setImageListFileName(name);
    }
    
    
    /**
     * <p>The constructor that
     * uses the given args array to set
     * the images URL and the image list file name.</p>
     */
    public GameImageData(String[] args) {
        if (args == null)
            return;
        
        if (args.length == 0)
            return;
        
        setImagesURL(args[0]);
        
        if (args.length == 1)
            return;
        
        setImageListFileName(args[1]);
    }
    
    
    /**
     * <p>The images URL.</p>
     * 
     * <p>Default:
     *    <code>http://www.ccs.neu.edu/jpt/images/concentration/</code>
     * </p>
     */
    protected String imagesURL  =
        "http://www.ccs.neu.edu/jpt/images/concentration/";
    
    
    /**
     * <p>The name of the images file list.</p>
     * 
     * <p>Default: <code>imagelist.txt</code></p>
     */
    protected String filelist = "imagelist.txt";
    
    
    
    /**
     * <p>Sets the images URL
     * provided that the given url
     * is non-<code>null</code> and of positive length.</p>
     */
    public void setImagesURL(String url) {
        if ((url != null) && (url.length() > 0))
            imagesURL = url;
    }
    
    
    /** <p>Gets the images URL.</p> */
    public String getImagesURL() {
        return imagesURL;
    }
    
    
    /**
     * <p>Sets the image list file name
     * provided that the given name
     * is non-<code>null</code> and of positive length.</p>
     */
    public void setImageListFileName(String name) {
        if ((name != null) && (name.length() > 0))
            filelist = name;
    }
    
    
    /** <p>Gets the images URL.</p> */
    public String getImageListFileName() {
        return filelist;
    }
    
}

