X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Frouting%2FTerminal.java;fp=bundles%2Forg.simantics.g2d%2Fsrc%2Forg%2Fsimantics%2Fg2d%2Frouting%2FTerminal.java;h=1e3f307436aedc52177f161ee8ab3d12e9b9e374;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git 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 index 000000000..1e3f30743 --- /dev/null +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/routing/Terminal.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * 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; + +import java.awt.geom.Rectangle2D; +import java.util.Arrays; + +public class Terminal { + public static final double[] ZEROS = new double[] { 0.0, 0.0, 0.0, 0.0 }; + + public double x; + public double y; + public int directions; + public double[] minDist; + public Rectangle2D parentObstacle; + + public Terminal(double x, double y, int directions, double[] minDist, + Rectangle2D parentObstacle) { + this.x = x; + this.y = y; + this.directions = directions; + this.minDist = minDist; + this.parentObstacle = parentObstacle; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + directions; + result = prime * result + Arrays.hashCode(minDist); + long temp; + temp = Double.doubleToLongBits(x); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits(y); + 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; + Terminal other = (Terminal) obj; + if (directions != other.directions) + return false; + if (!Arrays.equals(minDist, other.minDist)) + return false; + if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x)) + return false; + if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y)) + return false; + return true; + } + + + +}