001: //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/framework/util/Pair.java $
002: /*---------------- FILE HEADER ------------------------------------------
003: This file is part of deegree.
004: Copyright (C) 2001-2008 by:
005: Department of Geography, University of Bonn
006: http://www.giub.uni-bonn.de/deegree/
007: lat/lon GmbH
008: http://www.lat-lon.de
009:
010: This library is free software; you can redistribute it and/or
011: modify it under the terms of the GNU Lesser General Public
012: License as published by the Free Software Foundation; either
013: version 2.1 of the License, or (at your option) any later version.
014: This library is distributed in the hope that it will be useful,
015: but WITHOUT ANY WARRANTY; without even the implied warranty of
016: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: Lesser General Public License for more details.
018: You should have received a copy of the GNU Lesser General Public
019: License along with this library; if not, write to the Free Software
020: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021: Contact:
022:
023: Andreas Poth
024: lat/lon GmbH
025: Aennchenstr. 19
026: 53177 Bonn
027: Germany
028: E-Mail: poth@lat-lon.de
029:
030: Prof. Dr. Klaus Greve
031: Department of Geography
032: University of Bonn
033: Meckenheimer Allee 166
034: 53115 Bonn
035: Germany
036: E-Mail: greve@giub.uni-bonn.de
037: ---------------------------------------------------------------------------*/
038:
039: package org.deegree.framework.util;
040:
041: /**
042: * <code>Pair</code> is a convenience class, which pairs two objects.
043: *
044: * @author <a href="mailto:bezema@lat-lon.de">Rutger Bezema</a>
045: *
046: * @author last edited by: $Author: otonnhofer $
047: *
048: * @version $Revision: 10328 $, $Date: 2008-02-27 05:17:45 -0800 (Wed, 27 Feb 2008) $
049: * @param <T>
050: * the first Object of the pair
051: * @param <U>
052: * the second Object of the pair
053: *
054: */
055:
056: public class Pair<T, U> {
057: /**
058: * first value of the pair.
059: */
060: public T first;
061:
062: /**
063: * second value of the pair.
064: */
065: public U second;
066:
067: /**
068: * @param first
069: * value of the pair.
070: * @param second
071: * value of the pair.
072: */
073: public Pair(T first, U second) {
074: this .first = first;
075: this .second = second;
076: }
077:
078: /**
079: * Create a pair with null objects.
080: */
081: public Pair() {
082: // nothing to do here
083: }
084:
085: @SuppressWarnings("unchecked")
086: @Override
087: public boolean equals(Object other) {
088: if (other != null && other instanceof Pair) {
089: // what ever, unchecked.
090: final Pair that = (Pair) other;
091: return (first == null ? that.first == null : first
092: .equals(that.first))
093: && (second == null ? that.second == null : second
094: .equals(that.second));
095: }
096: return false;
097: }
098:
099: @Override
100: public String toString() {
101: return "<" + first + ", " + second + ">";
102: }
103:
104: }
|