-/*******************************************************************************\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.algorithm1;\r
-\r
-import org.simantics.g2d.routing.algorithm1.StaticRouter.Cost;\r
-\r
-public class Penalty {\r
- static final double BEND_PENALTY = 1.0;\r
- static final double CONNECTION_MARGINAL = 10.0;\r
- static final Cost INFINITE_COST = new Cost(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);\r
- \r
- static final Penalty OBSTACLE_PENALTY = new Penalty(20.0, 0.0);\r
- static final Penalty CONNECTION_SIDE_PENALTY = new Penalty(10.0, 0.0);\r
- static final Penalty CONNECTION_CROSS_PENALTY = new Penalty(0.4, 2*CONNECTION_MARGINAL);\r
- \r
- double penalty;\r
- double minDistance; \r
- \r
- public Penalty(double penalty, double minDistance) {\r
- this.penalty = penalty;\r
- this.minDistance = minDistance;\r
- }\r
- \r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = 1;\r
- long temp;\r
- temp = Double.doubleToLongBits(minDistance);\r
- result = prime * result + (int) (temp ^ (temp >>> 32));\r
- temp = Double.doubleToLongBits(penalty);\r
- result = prime * result + (int) (temp ^ (temp >>> 32));\r
- return result;\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
- Penalty other = (Penalty) obj;\r
- if (Double.doubleToLongBits(minDistance) != Double\r
- .doubleToLongBits(other.minDistance))\r
- return false;\r
- if (Double.doubleToLongBits(penalty) != Double\r
- .doubleToLongBits(other.penalty))\r
- return false;\r
- return true;\r
- }\r
- \r
- \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.routing.algorithm1;
+
+import org.simantics.g2d.routing.algorithm1.StaticRouter.Cost;
+
+public class Penalty {
+ static final double BEND_PENALTY = 1.0;
+ static final double CONNECTION_MARGINAL = 10.0;
+ static final Cost INFINITE_COST = new Cost(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
+
+ static final Penalty OBSTACLE_PENALTY = new Penalty(20.0, 0.0);
+ static final Penalty CONNECTION_SIDE_PENALTY = new Penalty(10.0, 0.0);
+ static final Penalty CONNECTION_CROSS_PENALTY = new Penalty(0.4, 2*CONNECTION_MARGINAL);
+
+ double penalty;
+ double minDistance;
+
+ public Penalty(double penalty, double minDistance) {
+ this.penalty = penalty;
+ this.minDistance = minDistance;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(minDistance);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(penalty);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Penalty other = (Penalty) obj;
+ if (Double.doubleToLongBits(minDistance) != Double
+ .doubleToLongBits(other.minDistance))
+ return false;
+ if (Double.doubleToLongBits(penalty) != Double
+ .doubleToLongBits(other.penalty))
+ return false;
+ return true;
+ }
+
+
+}