]> gcc.gnu.org Git - gcc.git/blob - libjava/java/awt/Point.java
natThrowable.cc: Don't use `#pragma implementation'.
[gcc.git] / libjava / java / awt / Point.java
1 /* Copyright (C) 1999 Red Hat, Inc.
2
3 This file is part of libjava.
4
5 This software is copyrighted work licensed under the terms of the
6 Libjava License. Please consult the file "LIBJAVA_LICENSE" for
7 details. */
8
9 package java.awt;
10 import java.awt.geom.Point2D;
11
12 /**
13 * @author Per Bothner <bothner@cygnus.com>
14 * @date February 8, 1999.
15 */
16
17 /* Written using "Java Class Libraries", 2nd edition, plus online
18 * API docs for JDK 1.2 beta from http://www.javasoft.com.
19 * Status: Believed complete and correct, except that neither toString
20 * nor hashCode have been compared with JDK output.
21 */
22
23 public class Point extends Point2D implements java.io.Serializable
24 {
25 public int x;
26 public int y;
27
28 public Point () { }
29
30 public Point (Point p) { this.x = p.x; this.y = p.y; }
31
32 public Point (int x, int y) { this.x = x; this.y = y; }
33
34 public boolean equals (Object obj)
35 {
36 if (! (obj instanceof Point))
37 return false;
38 Point p = (Point) obj;
39 return this.x == p.x && this.y == p.y;
40 }
41
42 public int hashCode () { return x ^ y; }
43
44 public Point getLocation () { return new Point(this); }
45
46 public void move (int x, int y) { this.x = x; this.y = y; }
47
48 public void setLocation (int x, int y) { this.x = x; this.y = y; }
49
50 public void setLocation (Point pt) { this.x = pt.x; this.y = pt.y; }
51
52 public void translate (int x, int y) { this.x += x; this.y += y; }
53
54 public String toString ()
55 {
56 return "Point[x:"+x+",y:"+y+']';
57 }
58
59 public double getX() { return x; }
60 public double getY() { return y; }
61
62 public void setLocation (double x, double y)
63 { this.x = (int) x; this.y = (int) y; }
64
65 }
This page took 0.040086 seconds and 5 git commands to generate.