/******************************************************
  FILE: "Point.java"

  Simple Graphics Utility
  
  Point Class

	@author K.Becker
	@version March 2002
	Simple Graphics Utility

<pre>
  This is a very simple class so almost all member
  functions are defined inline.

  INCLUDES: 
      constructor
      copy constructor
      set functions
      null point 
      access X
      access Y
      assignment = (copyFrom)
      relational equality == (equalTo)
      relational inequality != (notEqual)
</pre>
  *****************************************************/

public class Point 
{
  /** simple constructor;  */
  public Point (int i, int j) { xp = i; yp = j; } 

  /** simple copy constructor; inline */
  public Point ( Point P) { xp = P.xp; yp = P.yp; }

  /** set the Point to specified values: not checked */
  public void set (int i, int j) { xp = i; yp = j; }
  public void setX (int x) { xp = x; }
  public void setY (int y) { yp = y; }

  /** Return equivalent of NULL point */
  public Point NullPoint() { return new Point(-1,-1); }

  /** What is the value of X? */
  public int X() { return xp; }
  
  /** What is the value of Y? */
  public int Y() { return yp; }

  /** assignment: */
  public void copyFrom ( Point P)  {
    if (P == this)
      return;
    xp = P.xp;
    yp = P.yp;
  }

  /** test for equality: */
  public boolean equalTo ( Point P)  {
    if (P == this)
      return true;
    if ((xp == P.xp) && (yp == P.yp))
      return true;
    else
      return false;

  }

  /** test for IN-equality: */
  public boolean notEqual ( Point P)  {
    if (P == this)
      return false;
    if ((xp == P.xp) && (yp == P.yp))
      return false;
    else
      return true;

  }
  /** printable representation: */
  public String toString ()  {
     return new String("Point["+xp+","+yp+"]");
  }

  // the two points:
   /** the point on the X-axis */
   private int xp;           
   /** the point on the Y-axis */
   private int yp;   

}

// end Point.java


