ASM #16783 - Warngen: Possible problem when there are two effective VTEC actions for a watch

Change-Id: I76599d23396fe64c9448440787e67d752ed6b028

Former-commit-id: e82f96193e [formerly 117c2f072b647e353456832f2f0088d51a660d65]
Former-commit-id: 5755c120d5
This commit is contained in:
David Friedman 2014-09-25 22:10:42 +00:00
parent 973d0b9a55
commit c16f5c2e7c
2 changed files with 21 additions and 42 deletions

View file

@ -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.
*
* </pre>
*
@ -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;

View file

@ -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.
* </pre>
*
* @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<String, ActiveTableRecord> atrMap = new LinkedHashMap<String, ActiveTableRecord>();
@ -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<String> 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<Watch> generateMarineWatchItems(Watch template, List<String> areas) {
ArrayList<Watch> result = new ArrayList<Watch>();
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,10 +733,8 @@ public class WatchUtil {
return abrev;
}
public static class Comparators {
// ActiveTableRecord: phenSig, etn, ugcZone, issueTime
public static Comparator<ActiveTableRecord> PEUI = new Comparator<ActiveTableRecord>() {
public static final Comparator<ActiveTableRecord> PEUI = new Comparator<ActiveTableRecord>() {
@Override
public int compare(ActiveTableRecord o1, ActiveTableRecord o2) {
int i = o1.getPhensig().compareTo(o2.getPhensig());
@ -755,5 +752,3 @@ public class WatchUtil {
};
}
}