1 /*******************************************************************************
2 * Copyright (c) 2011 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.diagram.connection;
14 import gnu.trove.map.hash.THashMap;
16 import java.util.Comparator;
18 public abstract class RoutePoint {
20 public static final Comparator<RoutePoint> X_COMPARATOR = new Comparator<RoutePoint>() {
22 public int compare(RoutePoint a, RoutePoint b) {
23 return Double.compare(a.x, b.x);
27 public static final Comparator<RoutePoint> Y_COMPARATOR = new Comparator<RoutePoint>() {
29 public int compare(RoutePoint a, RoutePoint b) {
30 return Double.compare(a.y, b.y);
40 public RoutePoint(double x, double y) {
45 public double getX() {
49 public double getY() {
53 void removeFromOther(RouteLine routeLine) {
56 public boolean isNear(double x2, double y2, double tolerance) {
60 return dx*dx + dy*dy <= tolerance*tolerance;
63 abstract RoutePoint copy(THashMap<Object, Object> map);
66 public void setX(double x) {
70 public void setY(double y) {