--- /dev/null
+/*******************************************************************************\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