]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/connection/TerminalReference.java
Two rendering glitch fixes for time series charts
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / connection / TerminalReference.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g2d.connection;
13
14 import org.simantics.g2d.diagram.handler.Topology.Terminal;
15 import org.simantics.g2d.element.IElement;
16 import org.simantics.utils.datastructures.Pair;
17
18 /**
19  * @author Tuukka Lehtonen
20  */
21 public class TerminalReference {
22
23     private final Pair<IElement, Terminal> data;
24
25     public TerminalReference(IElement node, Terminal terminal) {
26         data = Pair.make(node, terminal);
27     }
28
29     public Object getNode() {
30         return data.first;
31     }
32
33     public Terminal getTerminal() {
34         return data.second;
35     }
36
37     @Override
38     public int hashCode() {
39         return data.hashCode();
40     }
41
42     @Override
43     public boolean equals(Object obj) {
44         if (this == obj)
45             return true;
46         if (obj == null)
47             return false;
48         if (!(obj instanceof TerminalReference))
49             return false;
50         TerminalReference other = (TerminalReference) obj;
51         return data.equals(other.data);
52     }
53
54     @Override
55     public String toString() {
56         return getClass().getSimpleName() + "[" + data + "]";
57     }
58
59 }