--- /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.connection;\r
+\r
+import org.simantics.g2d.diagram.handler.Topology.Terminal;\r
+import org.simantics.g2d.element.IElement;\r
+import org.simantics.utils.datastructures.Pair;\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ */\r
+public class TerminalReference {\r
+\r
+ private final Pair<IElement, Terminal> data;\r
+\r
+ public TerminalReference(IElement node, Terminal terminal) {\r
+ data = Pair.make(node, terminal);\r
+ }\r
+\r
+ public Object getNode() {\r
+ return data.first;\r
+ }\r
+\r
+ public Terminal getTerminal() {\r
+ return data.second;\r
+ }\r
+\r
+ @Override\r
+ public int hashCode() {\r
+ return data.hashCode();\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 (!(obj instanceof TerminalReference))\r
+ return false;\r
+ TerminalReference other = (TerminalReference) obj;\r
+ return data.equals(other.data);\r
+ }\r
+\r
+ @Override\r
+ public String toString() {\r
+ return getClass().getSimpleName() + "[" + data + "]";\r
+ }\r
+\r
+}\r