# HG changeset patch # User Felix Wolfsteller # Date 1378237823 -7200 # Node ID 7aa5ac17d72880cfb7b20aa383a9ea66e3c82517 # Parent c80671932461fd6bf5a0dc1c04b0cdd04d0f9b7f Implement ManagedFacet.isSame to determine whether two facets are the same. diff -r c80671932461 -r 7aa5ac17d728 artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacet.java Tue Sep 03 21:49:30 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacet.java Tue Sep 03 21:50:23 2013 +0200 @@ -16,7 +16,7 @@ import org.dive4elements.artifactdatabase.state.Facet; import org.dive4elements.artifacts.ArtifactNamespaceContext; import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; - +import org.dive4elements.river.utils.CompareUtil; /** * Facet with user-supplied theme-control-information (pos in list, @@ -140,5 +140,24 @@ return 0; } } + + /** + * Returns true if the other is likely the same facet. + * This happens if a facet is defined for two outs. + */ + public boolean isSame(Object other) { + if (!(other instanceof ManagedFacet)) { + return false; + } + ManagedFacet otherFacet = (ManagedFacet) other; + return this.getVisible() == otherFacet.getVisible() && + this.getActive() == otherFacet.getActive() && + CompareUtil.areSame(this.getArtifact(), otherFacet.getArtifact()) && + this.getIndex() == otherFacet.getIndex() && + CompareUtil.areSame(this.getName(), otherFacet.getName()) && + CompareUtil.areSame(this.getBoundToOut(), otherFacet.getBoundToOut()) && + CompareUtil.areSame(this.getDescription(), otherFacet.getDescription()); + // Missing properties are blackboard, data, position. + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :