annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacet.java @ 7300:83bb52fa0c32

(issue1529) Be more tolerant in the fitting. The invalid value warning is removed because invalid data is expected there when datapoints are not valid for this KM
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 11 Oct 2013 18:40:33 +0200
parents 7aa5ac17d728
children 5e38e2924c07
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4736
diff changeset
9 package org.dive4elements.river.artifacts.model;
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
11 import org.w3c.dom.Document;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
12 import org.w3c.dom.Element;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
13 import org.w3c.dom.Node;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
14
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4736
diff changeset
15 import org.dive4elements.artifactdatabase.state.DefaultFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4736
diff changeset
16 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4736
diff changeset
17 import org.dive4elements.artifacts.ArtifactNamespaceContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4736
diff changeset
18 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
6960
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
19 import org.dive4elements.river.utils.CompareUtil;
1624
238145ef67da Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
20
238145ef67da Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
21 /**
238145ef67da Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
22 * Facet with user-supplied theme-control-information (pos in list,
238145ef67da Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
23 * active/disabled etc) attached.
238145ef67da Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
24 */
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
25 public class ManagedFacet extends DefaultFacet implements Comparable {
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
1624
238145ef67da Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
27 /** The uuid of the owner artifact. */
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 protected String uuid;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
1624
238145ef67da Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
30 /** A property that determines the position of this facet. */
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 protected int position;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
1624
238145ef67da Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
33 /** A property that determines if this facet is active or not. */
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 protected int active;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
1715
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
36 /** A property that determines if this facet is visible or not. */
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
37 protected int visible;
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
38
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 949
diff changeset
39 public ManagedFacet() {
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 949
diff changeset
40 }
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
42 public ManagedFacet(String name, int index, String desc, String uuid,
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
43 int pos, int active, int visible) {
6139
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
44 this(name, index, desc, uuid, pos, active, visible, null);
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
45 }
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
46
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
47 public ManagedFacet(String name, int index, String desc, String uuid,
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
48 int pos, int active, int visible, String boundToOut) {
694
68c6c75a6f7c Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
49 super(index, name, desc);
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
51 this.uuid = uuid;
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 this.position = pos;
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
53 this.active = active;
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
54 this.visible = visible;
6139
7c2a30198592 Add boundToOut handling to ManagedFacets.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
55 this.boundToOut = boundToOut;
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57
1721
eb35570df0e8 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
58 /**
eb35570df0e8 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
59 * Sets position (will be merged to position in ThemeList).
eb35570df0e8 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
60 */
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 public void setPosition(int pos) {
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 this.position = pos;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 public int getPosition() {
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 return position;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 public void setActive(int active) {
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 this.active = active;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 public int getActive() {
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 return active;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
1715
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
77 public void setVisible(int visible) {
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
78 this.visible = visible;
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
79 }
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
80
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
81 public int getVisible() {
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
82 return visible;
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
83 }
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
84
1721
eb35570df0e8 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
85 /**
eb35570df0e8 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
86 * Get uuid of related artifact.
4736
b195fede1c3b Remove trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4255
diff changeset
87 *
1721
eb35570df0e8 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
88 * @return uuid of related artifact.
eb35570df0e8 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1715
diff changeset
89 */
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 public String getArtifact() {
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 return uuid;
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
93
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
94 public Node toXML(Document doc) {
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
95 ElementCreator ec = new ElementCreator(doc,
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
96 ArtifactNamespaceContext.NAMESPACE_URI,
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
97 ArtifactNamespaceContext.NAMESPACE_PREFIX);
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
98
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
99 Element facet = ec.create("theme");
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
100 ec.addAttr(facet, "artifact", getArtifact(), true);
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
101 ec.addAttr(facet, "facet", getName(), true);
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
102 ec.addAttr(facet, "pos", String.valueOf(getPosition()), true);
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
103 ec.addAttr(facet, "active", String.valueOf(getActive()), true);
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
104 ec.addAttr(facet, "index", String.valueOf(getIndex()), true);
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
105 ec.addAttr(facet, "description", getDescription(), true);
1715
a70e0cbc5e02 Added support for removing themes from output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1624
diff changeset
106 ec.addAttr(facet, "visible", String.valueOf(getVisible()), true);
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
107
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
108 return facet;
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 694
diff changeset
109 }
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 949
diff changeset
110
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 949
diff changeset
111 public void set(ManagedFacet other) {
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
112 uuid = other.uuid;
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 949
diff changeset
113 position = other.position;
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
114 active = other.active;
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 949
diff changeset
115 }
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 949
diff changeset
116
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1721
diff changeset
117 @Override
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 949
diff changeset
118 public Facet deepCopy() {
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 949
diff changeset
119 ManagedFacet copy = new ManagedFacet();
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
120 copy.set((DefaultFacet) this);
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
121 copy.set((ManagedFacet) this);
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 949
diff changeset
122 return copy;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 949
diff changeset
123 }
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
124
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
125 @Override
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
126 public int compareTo(Object o) {
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
127 if (!(o instanceof ManagedFacet)) {
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
128 return -1;
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
129 }
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
130
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
131 ManagedFacet other = (ManagedFacet) o;
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
132
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
133 if (position < other.position) {
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
134 return -1;
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
135 }
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
136 else if (position > other.position) {
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
137 return 1;
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
138 }
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
139 else {
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
140 return 0;
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
141 }
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
142 }
6960
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
143
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
144 /**
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
145 * Returns true if the other is likely the same facet.
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
146 * This happens if a facet is defined for two outs.
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
147 */
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
148 public boolean isSame(Object other) {
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
149 if (!(other instanceof ManagedFacet)) {
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
150 return false;
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
151 }
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
152 ManagedFacet otherFacet = (ManagedFacet) other;
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
153 return this.getVisible() == otherFacet.getVisible() &&
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
154 this.getActive() == otherFacet.getActive() &&
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
155 CompareUtil.areSame(this.getArtifact(), otherFacet.getArtifact()) &&
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
156 this.getIndex() == otherFacet.getIndex() &&
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
157 CompareUtil.areSame(this.getName(), otherFacet.getName()) &&
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
158 CompareUtil.areSame(this.getBoundToOut(), otherFacet.getBoundToOut()) &&
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
159 CompareUtil.areSame(this.getDescription(), otherFacet.getDescription());
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
160 // Missing properties are blackboard, data, position.
7aa5ac17d728 Implement ManagedFacet.isSame to determine whether two facets are the same.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6139
diff changeset
161 }
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org