import javax.swing.*;
import java.awt.*;
/**
 *   This class holds is used with Board to maintain 
 *   squares for a checker or chess board
 *   @author Casey Daughtery, Joshua Canter, Yvon Feaster
 *   @version 1.0
*/

public class Square
{
   protected int col, row, width;
   protected int xpos, ypos;
   protected Color color;
   protected boolean isOccupiable;
   protected boolean hasChecker;

   /**
    *   This method constructs the square variables
    *   @param int, int, int
    *   @return none
   */
   public Square(int x, int y, int w)
   {
      col = x;
      row = y;
      xpos = x * w;
      ypos = y * w;
      width = w;
      isOccupiable = false;
      hasChecker = false;
      color = new Color(128, 128, 128);
      color = Color.gray;
      
      /* determines which of the 64 squares can have a 
         checker or chess piece on it
      */
            
      if (x % 2 != y % 2)
      {
         isOccupiable = true;   
      }   
      else
      {
         isOccupiable = false;
      }
   } 
        
   /**
    *   This method gets protected information from the square class.
    *   (row - the row in the 8 X 8 board)
    *   @param none
    *   @return int
   */
   public int getRow()
   {
      return row;
   }
 
   /**
    *   This method sets row.
    *   @param int
    *   @return int
   */
    public int setRow (int r)
   {
      return row = r;
   }
 
   /**
    *   This method gets protected information from the square class.
    *   (col - the column in the 8 X 8 board)
    *   @param none
    *   @return int
   */  
   public int getCol()
   {
      return col;
   }

   /**
    *   This method sets col.
    *   @param int
    *   @return int
   */ 
   public int setCol (int c)
   {
      return col = c;
   }

   /**
    *   This method gets protected information from the square class.
    *   (xpos - the "x" postion of the square)
    *   @param none
    *   @return int
   */   
   public int getXpos()
   {
      return xpos;
   }
   /**
    *   This method sets xpos.
    *   @param int
    *   @return int
   */   
   public int setXpos (int x)
   {
      return xpos = x;
   }

   /**
    *   This method gets protected information from the square class.
    *   (ypos - the "y" position of the square)
    *   public
    *   @param none
    *   @return int
   */   
   public int getYpos()
   {
      return ypos;
   }

   /**
    *   This method sets ypos.
    *   public
    *   @param int
    *   @return int
   */
   public int setYpos (int y)
   {
      return ypos = y;
   }

   /**
    *   This method gets protected information from the square class.
    *   (width - the width of the square)
    *   public
    *   @param none
    *   @return int
   */   
   public int getWidth()
   {
      return width;
   }
 
    /**
    *   This method sets width.
    *   public
    *   @param int
    *   @return int
   */  
   public int setWidth (int w)
   {
      return width = w;
   }
   
   /**
    *   This method gets protected information from the square class.
    *   public
    *   (color - the color of the square)
    *   @param none
    *   @return Color
   */   
   public Color getColor ()
   {
      return color;
   }

   /**
    *   This method sets color.
    *   public
    *   @param Color
    *   @return Color
   */   
   public Color setColor (Color c)
   {
      return color = c;
   }

   /**
    *   This method gets protected information from the square class.
    *   (isOccupieable - can the square recieve a checker)
    *   public
    *   @param none
    *   @return boolean
   */   
   public boolean getIsOccupiable ()
   {
      return isOccupiable;
   }

    /**
    *   This method sets isOccupiable.
    *   public
    *   @param boolean
    *   @return boolean
   */  
   public boolean setIsOccupiable (boolean is)
   {
      return isOccupiable = is;
   }

   /**
    *   This method gets protected information from the square class.
    *   (hasChecker - does this square have a checker)
    *   public
    *   @param none
    *   @return boolean
   */
   public boolean getHasChecker ()
   {
      return hasChecker;
   }

   /**
    *   This method sets hasChecker.
    *   pubilc
    *   @param boolean
    *   @return boolean
   */
   public boolean setHasChecker (boolean has)
   {
      return hasChecker = has;
   }
}//end class    