From 22153d43bbd10320ec98d2a7ee79ec3189991f6f Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Mon, 3 Mar 2014 14:44:16 -0600 Subject: [PATCH] Issue #2792 enforce getDensity() will not return above max Change-Id: I3d9f8587f73f50083436900b9f8d058bfdc20af1 Former-commit-id: a502a64219e869401b1bff82fbb73e67565a6dae --- .../core/rsc/capabilities/DensityCapability.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/DensityCapability.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/DensityCapability.java index 1bb957765d..5603f56175 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/DensityCapability.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/DensityCapability.java @@ -27,14 +27,17 @@ import com.raytheon.uf.viz.core.VizConstants; import com.raytheon.uf.viz.core.globals.VizGlobalsManager; /** - * TODO Add Description + * A capability representing density of displayed items * *
  * 
  * SOFTWARE HISTORY
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * Apr 26, 2010            bsteffen     Initial creation
+ * Apr 26, 2010            bsteffen    Initial creation
+ * Mar 03, 2014 2792       njensen     Enforce getDensity() will never return
+ *                                        above MAX
+ * 
  * 
  * 
* @@ -83,7 +86,11 @@ public class DensityCapability extends AbstractCapability { * @return the density */ public Double getDensity() { - return density; + if (density < MAX_THRESHOLD) { + return density; + } else { + return MAX_THRESHOLD; + } } /** @@ -91,7 +98,7 @@ public class DensityCapability extends AbstractCapability { * the density to set */ public void setDensity(Double density) { - if (this.density != density) { + if (!this.density.equals(density)) { this.density = density; this.capabilityChanged(); }