]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/routing/Terminal.java
Let the request processor handle the exceptions
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / routing / Terminal.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g2d.routing;
13
14 import java.awt.geom.Rectangle2D;
15 import java.util.Arrays;
16
17 public class Terminal {
18         public static final double[] ZEROS = new double[] { 0.0, 0.0, 0.0, 0.0 };
19         
20         public double x;
21         public double y;
22         public int directions;
23         public double[] minDist;
24         public Rectangle2D parentObstacle;
25         
26         public Terminal(double x, double y, int directions, double[] minDist,
27             Rectangle2D parentObstacle) {
28                 this.x = x;
29                 this.y = y;
30                 this.directions = directions;
31                 this.minDist = minDist;
32                 this.parentObstacle = parentObstacle;
33         }
34
35         @Override
36         public int hashCode() {
37                 final int prime = 31;
38                 int result = 1;
39                 result = prime * result + directions;
40                 result = prime * result + Arrays.hashCode(minDist);
41                 long temp;
42                 temp = Double.doubleToLongBits(x);
43                 result = prime * result + (int) (temp ^ (temp >>> 32));
44                 temp = Double.doubleToLongBits(y);
45                 result = prime * result + (int) (temp ^ (temp >>> 32));
46                 return result;
47         }
48
49         @Override
50         public boolean equals(Object obj) {
51                 if (this == obj)
52                         return true;
53                 if (obj == null)
54                         return false;
55                 if (getClass() != obj.getClass())
56                         return false;
57                 Terminal other = (Terminal) obj;
58                 if (directions != other.directions)
59                         return false;
60                 if (!Arrays.equals(minDist, other.minDist))
61                         return false;
62                 if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x))
63                         return false;
64                 if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y))
65                         return false;
66                 return true;
67         }       
68         
69         
70         
71 }