Revision 25230 branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java

View differences:

DefaultFeatureReference.java
139 139
			this.pk[i] = state.get("pk.item" + i);
140 140
		}
141 141
	}
142

  
143
	public boolean equals(Object obj) {
144
		if (!(obj instanceof DefaultFeatureReference)) {
145
			return false;
146
		}
147
		DefaultFeatureReference other = (DefaultFeatureReference) obj;
148

  
149
		FeatureStore otherStore = (FeatureStore) other.storeRef.get();
150
		FeatureStore myrStore = (FeatureStore) this.storeRef.get();
151
		if (otherStore == null || myrStore == null) {
152
			return false;
153
		}
154
		if (!myrStore.equals(otherStore)) {
155
			return false;
156
		}
157
		if (this.oid != null) {
158
			return this.oid.equals(other.oid);
159
		}
160

  
161
		for (int i = 0; i < this.pk.length; i++) {
162
			if (!this.pk[i].equals(other.pk[i])) {
163
				return false;
164
			}
165
		}
166
		return true;
167
	}
168

  
169
	public int hashCode() {
170
		if (this.oid != null) {
171
			return this.oid.hashCode();
172
		} else {
173
			StringBuffer buff = new StringBuffer();
174

  
175
			for (int i = 0; i < this.pk.length; i++) {
176
				buff.append(this.pk[i].hashCode());
177
				buff.append("$");
178
			}
179
			return buff.toString().hashCode();
180

  
181
		}
182
	}
183

  
184

  
142 185
}

Also available in: Unified diff