home *** CD-ROM | disk | FTP | other *** search
- package java.awt;
-
- public class Rectangle {
- // $FF: renamed from: x int
- public int field_0;
- // $FF: renamed from: y int
- public int field_1;
- public int width;
- public int height;
-
- public Rectangle() {
- }
-
- public Rectangle(int x, int y, int width, int height) {
- this.field_0 = x;
- this.field_1 = y;
- this.width = width;
- this.height = height;
- }
-
- public Rectangle(int width, int height) {
- this(0, 0, width, height);
- }
-
- public Rectangle(Point p, Dimension d) {
- this(p.x, p.y, d.width, d.height);
- }
-
- public Rectangle(Point p) {
- this(p.x, p.y, 0, 0);
- }
-
- public Rectangle(Dimension d) {
- this(0, 0, d.width, d.height);
- }
-
- public void reshape(int x, int y, int width, int height) {
- this.field_0 = x;
- this.field_1 = y;
- this.width = width;
- this.height = height;
- }
-
- public void move(int x, int y) {
- this.field_0 = x;
- this.field_1 = y;
- }
-
- public void translate(int x, int y) {
- this.field_0 += x;
- this.field_1 += y;
- }
-
- public void resize(int width, int height) {
- this.width = width;
- this.height = height;
- }
-
- public boolean inside(int x, int y) {
- return x >= this.field_0 && x - this.field_0 < this.width && y >= this.field_1 && y - this.field_1 < this.height;
- }
-
- public boolean intersects(Rectangle r) {
- return r.field_0 + r.width >= this.field_0 && r.field_1 + r.height >= this.field_1 && r.field_0 < this.field_0 + this.width && r.field_1 < this.field_1 + this.height;
- }
-
- public Rectangle intersection(Rectangle r) {
- int x1 = Math.max(this.field_0, r.field_0);
- int x2 = Math.min(this.field_0 + this.width, r.field_0 + r.width);
- int y1 = Math.max(this.field_1, r.field_1);
- int y2 = Math.min(this.field_1 + this.height, r.field_1 + r.height);
- return new Rectangle(x1, y1, x2 - x1, y2 - y1);
- }
-
- public Rectangle union(Rectangle r) {
- int x1 = Math.min(this.field_0, r.field_0);
- int x2 = Math.max(this.field_0 + this.width, r.field_0 + r.width);
- int y1 = Math.min(this.field_1, r.field_1);
- int y2 = Math.max(this.field_1 + this.height, r.field_1 + r.height);
- return new Rectangle(x1, y1, x2 - x1, y2 - y1);
- }
-
- public void add(int newx, int newy) {
- int x1 = Math.min(this.field_0, newx);
- int x2 = Math.max(this.field_0 + this.width, newx);
- int y1 = Math.min(this.field_1, newy);
- int y2 = Math.max(this.field_1 + this.height, newy);
- this.field_0 = x1;
- this.field_1 = y1;
- this.width = x2 - x1;
- this.height = y2 - y1;
- }
-
- public void add(Point pt) {
- this.add(pt.x, pt.y);
- }
-
- public void add(Rectangle r) {
- int x1 = Math.min(this.field_0, r.field_0);
- int x2 = Math.max(this.field_0 + this.width, r.field_0 + r.width);
- int y1 = Math.min(this.field_1, r.field_1);
- int y2 = Math.max(this.field_1 + this.height, r.field_1 + r.height);
- this.field_0 = x1;
- this.field_1 = y1;
- this.width = x2 - x1;
- this.height = y2 - y1;
- }
-
- public void grow(int h, int v) {
- this.field_0 -= h;
- this.field_1 -= v;
- this.width += h * 2;
- this.height += v * 2;
- }
-
- public boolean isEmpty() {
- return this.width <= 0 || this.height <= 0;
- }
-
- public int hashCode() {
- return this.field_0 ^ this.field_1 * 37 ^ this.width * 43 ^ this.height * 47;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof Rectangle) {
- Rectangle r = (Rectangle)obj;
- return this.field_0 == r.field_0 && this.field_1 == r.field_1 && this.width == r.width && this.height == r.height;
- } else {
- return false;
- }
- }
-
- public String toString() {
- return this.getClass().getName() + "[x=" + this.field_0 + ",y=" + this.field_1 + ",width=" + this.width + ",height=" + this.height + "]";
- }
- }
-