fiore@0: /* fiore@0: CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool fiore@0: fiore@0: Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/) fiore@0: fiore@0: This program is free software: you can redistribute it and/or modify fiore@0: it under the terms of the GNU General Public License as published by fiore@0: the Free Software Foundation, either version 3 of the License, or fiore@0: (at your option) any later version. fiore@0: fiore@0: This program is distributed in the hope that it will be useful, fiore@0: but WITHOUT ANY WARRANTY; without even the implied warranty of fiore@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fiore@0: GNU General Public License for more details. fiore@0: fiore@0: You should have received a copy of the GNU General Public License fiore@0: along with this program. If not, see . fiore@0: */ fiore@0: fiore@0: package uk.ac.qmul.eecs.ccmi.utils; fiore@0: fiore@0: /** fiore@0: * fiore@0: * A Pair of objects. fiore@0: * fiore@0: * @param The first item type fiore@0: * @param The second item type fiore@0: */ fiore@0: public class Pair { fiore@0: public Pair(T1 first, T2 second){ fiore@0: this.first = first; fiore@0: this.second = second; fiore@0: } fiore@0: fiore@0: @Override fiore@0: public int hashCode() { fiore@0: final int prime = 31; fiore@0: int result = 1; fiore@0: result = prime * result + ((first == null) ? 0 : first.hashCode()); fiore@0: result = prime * result + ((second == null) ? 0 : second.hashCode()); fiore@0: return result; fiore@0: } fiore@0: fiore@0: @Override fiore@0: public boolean equals(Object obj) { fiore@0: if (this == obj) fiore@0: return true; fiore@0: if (obj == null) fiore@0: return false; fiore@0: if (getClass() != obj.getClass()) fiore@0: return false; fiore@0: @SuppressWarnings("rawtypes") fiore@0: Pair other = (Pair) obj; fiore@0: if (first == null) { fiore@0: if (other.first != null) fiore@0: return false; fiore@0: } else if (!first.equals(other.first)) fiore@0: return false; fiore@0: if (second == null) { fiore@0: if (other.second != null) fiore@0: return false; fiore@0: } else if (!second.equals(other.second)) fiore@0: return false; fiore@0: return true; fiore@0: } fiore@0: fiore@5: /** fiore@5: * the first item of the pair fiore@5: */ fiore@0: public T1 first; fiore@5: /** fiore@5: * the second item of the pair fiore@5: */ fiore@0: public T2 second; fiore@0: }