// An abstract class for two-dimensional shapes that has a draw method.
// Barry Cornelius, 20 June 2000
import java.awt. Graphics;
abstract public class Shape
{
   private int iX;
   private int iY;
   public Shape(final int pX, final int pY)
   {
      iX = pX;
      iY = pY;
   }
   public Shape()           { this(0, 0); }
   public int getX()        { return iX; }
   public int getY()        { return iY; }
   public void translate(final int pX, final int pY)
   { 
      iX += pX; 
      iY += pY;
   }
   public boolean equals(final Object pObject)
   {
      if ( pObject==null || getClass()!=pObject.getClass() )
      {
         return false;
      }
      return iX==((Shape)pObject).iX && iY==((Shape)pObject).iY;
   }
   public int hashCode()    { return iX + iY; }
   public String toString() 
   {
      return iX + ":" + iY; 
   }
   abstract public void draw(Graphics pGraphics);
}
