01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.data.vpf;
17:
18: import org.geotools.feature.AttributeType;
19:
20: /**
21: * This class encapsulates a join between two columns. It was originally intended to
22: * join two VPFColumn types, but there should not be anything about it which
23: * constrains it to those two types.
24: * @author <a href="mailto:jeff@ionicenterprise.com">Jeff Yutzler</a>
25: *
26: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/vpf/src/main/java/org/geotools/data/vpf/ColumnPair.java $
27: */
28: class ColumnPair {
29: /**
30: * The first column to join
31: */
32: public AttributeType column1;
33: /**
34: * The second column to join
35: */
36: public AttributeType column2;
37:
38: /**
39: * The only constructor
40: * @param c1 the first column
41: * @param c2 the second column
42: */
43: public ColumnPair(AttributeType c1, AttributeType c2) {
44: column1 = c1;
45: column2 = c2;
46: }
47:
48: /* (non-Javadoc)
49: * @see java.lang.Object#hashCode()
50: */
51: public int hashCode() {
52: int result = 78236951;
53: if (column1 != null)
54: result = result * 37 + column1.hashCode();
55: if (column2 != null)
56: result ^= result * 37 + column2.hashCode();
57:
58: return result;
59: }
60:
61: /* (non-Javadoc)
62: * @see java.lang.Object#equals(java.lang.Object)
63: */
64: public boolean equals(Object arg0) {
65: boolean result = false;
66:
67: if (arg0 == this ) {
68: result = true;
69: } else {
70: ColumnPair columnPair = (ColumnPair) arg0;
71:
72: if ((columnPair != null)
73: && columnPair.column1.equals(this .column1)
74: && columnPair.column2.equals(this .column2)) {
75: result = true;
76: }
77: }
78:
79: return result;
80: }
81: }
|