comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacet.java @ 6960:7aa5ac17d728

Implement ManagedFacet.isSame to determine whether two facets are the same.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 03 Sep 2013 21:50:23 +0200
parents 7c2a30198592
children 5e38e2924c07
comparison
equal deleted inserted replaced
6959:c80671932461 6960:7aa5ac17d728
14 14
15 import org.dive4elements.artifactdatabase.state.DefaultFacet; 15 import org.dive4elements.artifactdatabase.state.DefaultFacet;
16 import org.dive4elements.artifactdatabase.state.Facet; 16 import org.dive4elements.artifactdatabase.state.Facet;
17 import org.dive4elements.artifacts.ArtifactNamespaceContext; 17 import org.dive4elements.artifacts.ArtifactNamespaceContext;
18 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; 18 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
19 19 import org.dive4elements.river.utils.CompareUtil;
20 20
21 /** 21 /**
22 * Facet with user-supplied theme-control-information (pos in list, 22 * Facet with user-supplied theme-control-information (pos in list,
23 * active/disabled etc) attached. 23 * active/disabled etc) attached.
24 */ 24 */
138 } 138 }
139 else { 139 else {
140 return 0; 140 return 0;
141 } 141 }
142 } 142 }
143
144 /**
145 * Returns true if the other is likely the same facet.
146 * This happens if a facet is defined for two outs.
147 */
148 public boolean isSame(Object other) {
149 if (!(other instanceof ManagedFacet)) {
150 return false;
151 }
152 ManagedFacet otherFacet = (ManagedFacet) other;
153 return this.getVisible() == otherFacet.getVisible() &&
154 this.getActive() == otherFacet.getActive() &&
155 CompareUtil.areSame(this.getArtifact(), otherFacet.getArtifact()) &&
156 this.getIndex() == otherFacet.getIndex() &&
157 CompareUtil.areSame(this.getName(), otherFacet.getName()) &&
158 CompareUtil.areSame(this.getBoundToOut(), otherFacet.getBoundToOut()) &&
159 CompareUtil.areSame(this.getDescription(), otherFacet.getDescription());
160 // Missing properties are blackboard, data, position.
161 }
143 } 162 }
144 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 163 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org