summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2010-01-21 06:35:46 (EST)
committerCaspar De Groot2010-01-21 06:35:46 (EST)
commita02eb18accdb90adb1d17bef91bae1b84884f37b (patch)
treea542ab74b969840aef10fa737fdcda69f4f15b31
parent16a46d0a6981360e381e1846c1c56684969e3068 (diff)
downloadcdo-a02eb18accdb90adb1d17bef91bae1b84884f37b.zip
cdo-a02eb18accdb90adb1d17bef91bae1b84884f37b.tar.gz
cdo-a02eb18accdb90adb1d17bef91bae1b84884f37b.tar.bz2
[270716] Provide support for branching
https://bugs.eclipse.org/bugs/show_bug.cgi?id=270716
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/Triplet.java77
1 files changed, 77 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/Triplet.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/Triplet.java
new file mode 100644
index 0000000..db97b33
--- /dev/null
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/Triplet.java
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Caspar De Groot - initial API and implementation
+ */
+package org.eclipse.net4j.util.collection;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+/**
+ * @author Caspar De Groot
+ */
+public class Triplet<T1, T2, T3> extends Pair<T1, T2>
+{
+ private T3 element3;
+
+ public Triplet()
+ {
+ }
+
+ public Triplet(T1 element1, T2 element2, T3 element3)
+ {
+ super(element1, element2);
+ this.element3 = element3;
+ }
+
+ public Triplet(Triplet<T1, T2, T3> source)
+ {
+ super(source.getElement1(), source.getElement2());
+ element3 = source.element3;
+ }
+
+ public final T3 getElement3()
+ {
+ return element3;
+ }
+
+ public void setElement3(T3 element3)
+ {
+ this.element3 = element3;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+
+ if (obj instanceof Triplet<?, ?, ?>)
+ {
+ Triplet<?, ?, ?> that = (Triplet<?, ?, ?>)obj;
+ return ObjectUtil.equals(getElement1(), that.getElement1())
+ && ObjectUtil.equals(getElement2(), that.getElement2()) && ObjectUtil.equals(element3, that.element3);
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ObjectUtil.hashCode(getElement1()) ^ ObjectUtil.hashCode(getElement2()) ^ ObjectUtil.hashCode(element3);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Triplet[" + getElement1() + ", " + getElement2() + ", " + element3 + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+}