11adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov/**
211a89b445f3bde56bf07e6a0d04f0b0256dcb215Andrey Somov * Copyright (c) 2008, http://www.snakeyaml.org
31adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov *
41adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov * Licensed under the Apache License, Version 2.0 (the "License");
51adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov * you may not use this file except in compliance with the License.
61adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov * You may obtain a copy of the License at
71adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov *
81adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov *     http://www.apache.org/licenses/LICENSE-2.0
91adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov *
101adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov * Unless required by applicable law or agreed to in writing, software
111adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov * distributed under the License is distributed on an "AS IS" BASIS,
121adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov * See the License for the specific language governing permissions and
141adf3a94fce500e0bda933e4b495a004d5789bd7Andrey Somov * limitations under the License.
15ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov */
16ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somovpackage org.yaml.snakeyaml.immutable;
17ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov
18ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somovpublic class Point {
19ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov    private final double x;
20ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov    private final double y;
21ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov
22ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov    public double getX() {
23ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov        return x;
24ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov    }
25ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov
26ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov    public double getY() {
27ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov        return y;
28ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov    }
29ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov
30ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov    public Point(Double x, Double y) {
31ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov        this.x = x;
32ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov        this.y = y;
33ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov    }
34050c422c295a0ff956f79ba91c4c5a21b255f721Andrey Somov
35050c422c295a0ff956f79ba91c4c5a21b255f721Andrey Somov    @Override
36050c422c295a0ff956f79ba91c4c5a21b255f721Andrey Somov    public String toString() {
37050c422c295a0ff956f79ba91c4c5a21b255f721Andrey Somov        return "<Point x=" + String.valueOf(x) + " y=" + String.valueOf(y) + ">";
38050c422c295a0ff956f79ba91c4c5a21b255f721Andrey Somov    }
39db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov
40db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov    @Override
41db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov    public boolean equals(Object obj) {
42db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov        if (obj instanceof Point) {
43db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov            return toString().equals(obj.toString());
44db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov        } else {
45db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov            return false;
46db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov        }
47db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov    }
48db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov
49db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov    @Override
50db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov    public int hashCode() {
51db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov        return toString().hashCode();
52db75fd1aba1d5a7194d72cb553150436414f4fbdAndrey Somov    }
53ca2b4b3ee7101957d97334631216f6b52b030c1bAndrey Somov}
54