[jboss-cvs] JBoss Messaging SVN: r7574 - branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/utils.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 15 08:38:12 EDT 2009
Author: timfox
Date: 2009-07-15 08:38:12 -0400 (Wed, 15 Jul 2009)
New Revision: 7574
Added:
branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/utils/Triple.java
Log:
MT replication
Added: branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/utils/Triple.java
===================================================================
--- branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/utils/Triple.java (rev 0)
+++ branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/utils/Triple.java 2009-07-15 12:38:12 UTC (rev 7574)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.utils;
+
+import java.io.Serializable;
+
+public class Triple<A, B, C> implements Serializable
+{
+ private static final long serialVersionUID = -7217401396900064760L;
+
+ public Triple(A a, B b, C c)
+ {
+ this.a = a;
+
+ this.b = b;
+
+ this.c = c;
+ }
+
+ public A a;
+
+ public B b;
+
+ public C c;
+
+ private int hash = -1;
+
+ public int hashCode()
+ {
+ if (hash == -1)
+ {
+ if (a == null && b == null && c == null)
+ {
+ return super.hashCode();
+ }
+ else
+ {
+ hash = 37 * 37 * (a == null ? 0 : a.hashCode()) + 37 * (b == null ? 0 : b.hashCode()) + (c == null ? 0 : c.hashCode());
+ }
+ }
+
+ return hash;
+ }
+
+ public boolean equals(Object other)
+ {
+ if (other == this)
+ {
+ return true;
+ }
+
+ if (other instanceof Triple == false)
+ {
+ return false;
+ }
+
+ Triple<A, B, C> tother = (Triple<A, B, C>)other;
+
+ return (tother.a == null ? a == null : tother.a.equals(a)) &&
+ (tother.b == null ? b == null : tother.b.equals(b)) &&
+ (tother.c == null ? c == null : tother.c.equals(c));
+
+ }
+}
More information about the jboss-cvs-commits
mailing list