From c16f5c2e7c69c39b5cb3e5d23295dfd41bd53013 Mon Sep 17 00:00:00 2001 From: David Friedman Date: Thu, 25 Sep 2014 22:10:42 +0000 Subject: [PATCH] ASM #16783 - Warngen: Possible problem when there are two effective VTEC actions for a watch Change-Id: I76599d23396fe64c9448440787e67d752ed6b028 Former-commit-id: e82f96193e1b14b263473c173dd3841b7e3f8f57 [formerly 117c2f072b647e353456832f2f0088d51a660d65] Former-commit-id: 5755c120d5c8e2a1b72d385eb684a0e0768af16f --- .../com/raytheon/viz/warngen/gis/Watch.java | 20 +-------- .../raytheon/viz/warngen/gis/WatchUtil.java | 43 ++++++++----------- 2 files changed, 21 insertions(+), 42 deletions(-) diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Watch.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Watch.java index 1e699e1f1f..3c2fae4e63 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Watch.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Watch.java @@ -34,6 +34,7 @@ import java.util.List; * ------------ ---------- ----------- -------------------------- * Jul 16, 2014 3419 jsanchez Initial creation * Aug 28, 2014 ASM #15658 D. Friedman Add marine zone list. + * Sep 25, 2014 ASM #16783 D. Friedman Remove action field. * * * @@ -45,8 +46,6 @@ public class Watch { private String phenSig; - private String action; - private String etn; private Date startTime; @@ -61,10 +60,9 @@ public class Watch { private String marineArea; - public Watch(String state, String action, String phenSig, String etn, + public Watch(String state, String phenSig, String etn, Date startTime, Date endTime) { this.state = state; - this.action = action; this.phenSig = phenSig; this.etn = etn; this.startTime = startTime; @@ -119,14 +117,6 @@ public class Watch { this.partOfState = partOfState; } - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - public String getEtn() { return etn; } @@ -147,7 +137,6 @@ public class Watch { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((action == null) ? 0 : action.hashCode()); result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); result = prime * result + ((etn == null) ? 0 : etn.hashCode()); result = prime * result + ((phenSig == null) ? 0 : phenSig.hashCode()); @@ -166,11 +155,6 @@ public class Watch { if (getClass() != obj.getClass()) return false; Watch other = (Watch) obj; - if (action == null) { - if (other.action != null) - return false; - } else if (!action.equals(other.action)) - return false; if (endTime == null) { if (other.endTime != null) return false; diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java index 28ee8a73ce..df660c924e 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java @@ -84,7 +84,7 @@ import com.vividsolutions.jts.geom.Polygon; * from being used while CON/EXT is issued, and prevent duplicate * /missing (part of state, state abbreviation) which resulted from * extension of a watch to counties which are of same/different fe_area. - * + * Sep 25, 2014 ASM #16783 D. Friedman Do not use VTEC action to determine Watch uniqueness. * * * @author jsanchez @@ -369,7 +369,7 @@ public class WatchUtil { } } - Collections.sort(records, Comparators.PEUI); + Collections.sort(records, PEUI); // Filters out extra ActiveTableRecords that have same phenSig, etn, and ugcZone. Map atrMap = new LinkedHashMap(); @@ -428,14 +428,13 @@ public class WatchUtil { } } - String action = ar.getAct(); String phenSig = ar.getPhensig(); String etn = ar.getEtn(); Date startTime = ar.getStartTime().getTime(); Date endTime = ar.getEndTime().getTime(); if (validUgcZones.contains(ugcZone)) { - Watch watch = new Watch(state, action, phenSig, etn, startTime, + Watch watch = new Watch(state, phenSig, etn, startTime, endTime); List areas = map.get(watch); if (areas == null) { @@ -503,7 +502,7 @@ public class WatchUtil { Collections.sort(pos); String key = w.getPhenSig() + w.getEtn() + w.getState() + pos.toString() + w.getEndTime().toString(); if (w.getMarineArea() != null) { - key = key + w.getMarineArea(); + key = key + '.' + w.getMarineArea(); } watchMap.put(key, w); } @@ -540,9 +539,9 @@ public class WatchUtil { private List generateMarineWatchItems(Watch template, List areas) { ArrayList result = new ArrayList(); for (String area: areas) { - Watch watch = new Watch(template.getState(), template.getAction(), - template.getPhenSig(), template.getEtn(), - template.getStartTime(), template.getEndTime()); + Watch watch = new Watch(template.getState(), template.getPhenSig(), + template.getEtn(), template.getStartTime(), + template.getEndTime()); watch.setMarineArea(area); result.add(watch); } @@ -734,26 +733,22 @@ public class WatchUtil { return abrev; } - public static class Comparators { - - // ActiveTableRecord: phenSig, etn, ugcZone, issueTime - public static Comparator PEUI = new Comparator() { - @Override - public int compare(ActiveTableRecord o1, ActiveTableRecord o2) { - int i = o1.getPhensig().compareTo(o2.getPhensig()); + // ActiveTableRecord: phenSig, etn, ugcZone, issueTime + public static final Comparator PEUI = new Comparator() { + @Override + public int compare(ActiveTableRecord o1, ActiveTableRecord o2) { + int i = o1.getPhensig().compareTo(o2.getPhensig()); + if (i == 0) { + i = o1.getEtn().compareTo(o2.getEtn()); if (i == 0) { - i = o1.getEtn().compareTo(o2.getEtn()); + i = o1.getUgcZone().compareTo(o2.getUgcZone()); if (i == 0) { - i = o1.getUgcZone().compareTo(o2.getUgcZone()); - if (i == 0) { - i = o1.getIssueTime().compareTo(o2.getIssueTime()); - } + i = o1.getIssueTime().compareTo(o2.getIssueTime()); } } - return i; } - }; - - } + return i; + } + }; }