comparison org.eclipse.draw2d/src/org/eclipse/draw2d/graph/NodePair.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children 6f068362a363
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
1 /*******************************************************************************
2 * Copyright (c) 2003, 2005 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module org.eclipse.draw2d.graph.NodePair;
14
15 import java.lang.all;
16 import org.eclipse.draw2d.graph.Node;
17 import tango.text.convert.Format;
18
19 /**
20 * @author hudsonr
21 * @since 2.1
22 */
23 class NodePair {
24
25 public Node n1;
26 public Node n2;
27
28 public this() { }
29
30 public this(Node n1, Node n2) {
31 this.n1 = n1;
32 this.n2 = n2;
33 }
34
35 public override int opEquals(Object obj) {
36 if (auto np = cast(NodePair) obj ) {
37 return np.n1 is n1 && np.n2 is n2;
38 }
39 return false;
40 }
41
42 public override hash_t toHash() {
43 return n1.toHash() ^ n2.toHash();
44 }
45
46 /**
47 * @see java.lang.Object#toString()
48 */
49 public String toString() {
50 return Format("[{}, {}]", n1, n2 ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
51 }
52
53 }