2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package org.apache.lucene.spatial.geometry.shape;
22 * Point class. This type is mutable.
24 * <p><font color="red"><b>NOTE:</b> This API is still in
25 * flux and might change in incompatible ways in the next
28 public class Point2D {
32 public Point2D(double x, double y) {
42 public Point2D(Point2D other) {
48 public String toString() {
49 return "(" + x + "," + y + ")";
52 public double getX() {
56 public double getY() {
68 public void x(double x) {
72 public void y(double y) {
76 public void setX(double x) {
80 public void setY(double y) {
84 public void set(double x, double y) {
89 public void add(Vector2D v) {
94 public void set(Point2D p1) {
99 public void add(Point2D a) {
104 public void set(Vector2D v) {
110 public int hashCode() {
111 final int prime = 31;
114 temp = Double.doubleToLongBits(x);
115 result = prime * result + (int) (temp ^ (temp >>> 32));
116 temp = Double.doubleToLongBits(y);
117 result = prime * result + (int) (temp ^ (temp >>> 32));
122 public boolean equals(Object obj) {
127 if (getClass() != obj.getClass())
129 Point2D other = (Point2D) obj;
130 if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x))
132 if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y))