/*
 * Copyright (c) 1999 Software Architects, All Rights Reserved.
 *
 * Permission to use, copy, modify, and distribute this software
 * and its documentation for NON-COMMERCIAL purposes and without
 * fee is hereby granted provided that this copyright notice
 * appears in all copies.
 *
 * SOFTWARE ARCHITECTS MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
 * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING
 * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SOFTWARE 
 * ARCHITECTS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE 
 * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS 
 * DERIVATIVES.
 */

//  package Java.TicTacToe.Game;

import java.awt.*;
import java.awt.image.*;

public class GameBoardPosition
    extends Rectangle {

    private Image image = null;
    private int positionState; // class Invariant: positionState > -1
    
    public GameBoardPosition(int newState){
	super();
	
	positionState = newState;
    }

    public GameBoardPosition(Image newImage){
	super();
	
	image = newImage;
	positionState = -1; // default value
    }

    public GameBoardPosition(Image newImage, Rectangle r) {
	super(r);
	
	image = newImage;
	positionState = -1;
    }

    public void setImage(Image newImage) {
	image = newImage;
    }

    public Image getImage(){
	return image;
    }

    public void drawImage(Graphics g, ImageObserver observer ){
	if (image != null )
  	    g.drawImage( image, x, y, observer );
    }
   
    // This is just a convience function
    // unfortunatly Graphics::drawRect does not use rectangle
    public void drawRect(Graphics g) {
	g.drawRect(x, y, width, height);
    }

    public void setPositionState(int newState) {
	    positionState = newState;
    }

    public int getPositionState(){
	return positionState;
    }
 
}
