]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/routing/Terminal.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / routing / Terminal.java
diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/routing/Terminal.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/routing/Terminal.java
new file mode 100644 (file)
index 0000000..1e3f307
--- /dev/null
@@ -0,0 +1,71 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.g2d.routing;\r
+\r
+import java.awt.geom.Rectangle2D;\r
+import java.util.Arrays;\r
+\r
+public class Terminal {\r
+       public static final double[] ZEROS = new double[] { 0.0, 0.0, 0.0, 0.0 };\r
+       \r
+       public double x;\r
+       public double y;\r
+       public int directions;\r
+       public double[] minDist;\r
+       public Rectangle2D parentObstacle;\r
+       \r
+       public Terminal(double x, double y, int directions, double[] minDist,\r
+           Rectangle2D parentObstacle) {\r
+               this.x = x;\r
+               this.y = y;\r
+               this.directions = directions;\r
+               this.minDist = minDist;\r
+               this.parentObstacle = parentObstacle;\r
+       }\r
+\r
+       @Override\r
+       public int hashCode() {\r
+               final int prime = 31;\r
+               int result = 1;\r
+               result = prime * result + directions;\r
+               result = prime * result + Arrays.hashCode(minDist);\r
+               long temp;\r
+               temp = Double.doubleToLongBits(x);\r
+               result = prime * result + (int) (temp ^ (temp >>> 32));\r
+               temp = Double.doubleToLongBits(y);\r
+               result = prime * result + (int) (temp ^ (temp >>> 32));\r
+               return result;\r
+       }\r
+\r
+       @Override\r
+       public boolean equals(Object obj) {\r
+               if (this == obj)\r
+                       return true;\r
+               if (obj == null)\r
+                       return false;\r
+               if (getClass() != obj.getClass())\r
+                       return false;\r
+               Terminal other = (Terminal) obj;\r
+               if (directions != other.directions)\r
+                       return false;\r
+               if (!Arrays.equals(minDist, other.minDist))\r
+                       return false;\r
+               if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x))\r
+                       return false;\r
+               if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y))\r
+                       return false;\r
+               return true;\r
+       }       \r
+       \r
+       \r
+       \r
+}\r