From dba1fb3fc12cb83529d3e08dbb570f2986e38715 Mon Sep 17 00:00:00 2001 From: Brian Clements Date: Wed, 9 Jul 2014 14:13:47 -0500 Subject: [PATCH] Omaha #3214 fixed cache object usage in lightning resource pulse and cloud flashes were not updated properly in the cache Change-Id: Idf17aeb444f93c73901c26da9640f0a8f4a6a486 Former-commit-id: ac8f8611124edfeafeb9f7bbccb87d32e774bee4 [formerly 206fd1556b6b7bdfcf432b0c13af9b38d1f1d393] Former-commit-id: 994226e82ba73fe15962b94257650ad9e923eb0a --- .../viz/lightning/LightningResource.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java index 09a6dd8303..52c636c5e5 100644 --- a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java @@ -102,6 +102,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; * Jun 05, 2014 3226 bclement reference datarecords by LightningConstants * Jun 06, 2014 DR 17367 D. Friedman Fix cache object usage. * Jun 19, 2014 3214 bclement added pulse and could flash support + * Jul 09, 2014 3214 bclement fixed cache object usage for pulse and cloud flash * * * @@ -207,18 +208,28 @@ public class LightningResource extends int doubleCount = 0; if (object != null) { synchronized (object) { - for (double[] arr : object.posLatLonList) { - doubleCount += arr.length; - } - for (double[] arr : object.negLatLonList) { - doubleCount += arr.length; - } + doubleCount += getSize(object.posLatLonList); + doubleCount += getSize(object.negLatLonList); + doubleCount += getSize(object.cloudLatLonList); + doubleCount += getSize(object.pulseLatLonList); } } // 8 bytes per double return doubleCount * 8; } + /** + * @param lonLatList + * @return total number of doubles in list + */ + private static int getSize(List lonLatList) { + int rval = 0; + for (double[] arr : lonLatList) { + rval += arr.length; + } + return rval; + } + /* * (non-Javadoc) * @@ -642,6 +653,8 @@ public class LightningResource extends .retrieveObject(frame); existing.posLatLonList.addAll(newBundle.posLatLonList); existing.negLatLonList.addAll(newBundle.negLatLonList); + existing.cloudLatLonList.addAll(newBundle.cloudLatLonList); + existing.pulseLatLonList.addAll(newBundle.pulseLatLonList); } } }