private int x;
private int y;
public Point(int x,
int y
) { this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
@Override
public boolean equals
(Object o
) { if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (x != point.x) return false;
if (y != point.y) return false;
return true;
}
@Override
public int hashCode() {
int result = x;
result = 31 * result + y;
return result;
}
}
cHVibGljIGNsYXNzIFBvaW50IHsKCiAgICBwcml2YXRlIGludCB4OwogICAgcHJpdmF0ZSBpbnQgeTsKCiAgICBwdWJsaWMgUG9pbnQoaW50IHgsIGludCB5KSB7CiAgICAgICAgdGhpcy54ID0geDsKICAgICAgICB0aGlzLnkgPSB5OwogICAgfQoKICAgIHB1YmxpYyBpbnQgZ2V0WCgpIHsKICAgICAgICByZXR1cm4geDsKICAgIH0KCiAgICBwdWJsaWMgdm9pZCBzZXRYKGludCB4KSB7CiAgICAgICAgdGhpcy54ID0geDsKICAgIH0KCiAgICBwdWJsaWMgaW50IGdldFkoKSB7CiAgICAgICAgcmV0dXJuIHk7CiAgICB9CgogICAgcHVibGljIHZvaWQgc2V0WShpbnQgeSkgewogICAgICAgIHRoaXMueSA9IHk7CiAgICB9CgogICAgQE92ZXJyaWRlCiAgICBwdWJsaWMgYm9vbGVhbiBlcXVhbHMoT2JqZWN0IG8pIHsKICAgICAgICBpZiAodGhpcyA9PSBvKSByZXR1cm4gdHJ1ZTsKICAgICAgICBpZiAobyA9PSBudWxsIHx8IGdldENsYXNzKCkgIT0gby5nZXRDbGFzcygpKSByZXR1cm4gZmFsc2U7CgogICAgICAgIFBvaW50IHBvaW50ID0gKFBvaW50KSBvOwoKICAgICAgICBpZiAoeCAhPSBwb2ludC54KSByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKHkgIT0gcG9pbnQueSkgcmV0dXJuIGZhbHNlOwoKICAgICAgICByZXR1cm4gdHJ1ZTsKICAgIH0KCiAgICBAT3ZlcnJpZGUKICAgIHB1YmxpYyBpbnQgaGFzaENvZGUoKSB7CiAgICAgICAgaW50IHJlc3VsdCA9IHg7CiAgICAgICAgcmVzdWx0ID0gMzEgKiByZXN1bHQgKyB5OwogICAgICAgIHJldHVybiByZXN1bHQ7CiAgICB9Cn0K