01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2005-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;
09: * version 2.1 of the License.
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.styling;
17:
18: import org.geotools.event.AbstractGTComponent;
19: import org.geotools.resources.Utilities;
20:
21: public class LayerFeatureConstraintsImpl extends AbstractGTComponent
22: implements LayerFeatureConstraints {
23:
24: private FeatureTypeConstraint[] constraints;
25:
26: public FeatureTypeConstraint[] getFeatureTypeConstraints() {
27: return constraints;
28: }
29:
30: public void setFeatureTypeConstraints(
31: FeatureTypeConstraint[] constraints) {
32: FeatureTypeConstraint[] old = this .constraints;
33: this .constraints = constraints;
34:
35: fireChildChanged("featureTypeConstraints", this .constraints,
36: old);
37: }
38:
39: public boolean equals(Object obj) {
40: if (this == obj) {
41: return true;
42: }
43:
44: if (obj instanceof FeatureTypeConstraintImpl) {
45: LayerFeatureConstraintsImpl other = (LayerFeatureConstraintsImpl) obj;
46: return Utilities.equals(constraints, other.constraints);
47: }
48:
49: return false;
50: }
51:
52: public int hashCode() {
53: final int PRIME = 1000003;
54: int result = 0;
55:
56: if (constraints != null) {
57: result = (PRIME * result) + constraints.hashCode();
58: }
59:
60: return result;
61: }
62:
63: }
|