Issue #2243 Resolved timing issues.

Change-Id: Ia0386bf21087cb2a00175e35ecfeae5206797a34

Former-commit-id: 78b655fd1f [formerly 2b849d7003] [formerly 78b655fd1f [formerly 2b849d7003] [formerly bc30396b63 [formerly 5833ecad04c31502b4e2991853e6aabeda4919f2]]]
Former-commit-id: bc30396b63
Former-commit-id: 19853a4b57 [formerly fca67fb4ca]
Former-commit-id: dbb60f2c13
This commit is contained in:
Jonathan Sanchez 2013-08-15 10:56:37 -05:00
parent 0e62a4243e
commit a1dc6ac50b
3 changed files with 25 additions and 20 deletions

View file

@ -36,7 +36,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* Initial creation * Initial creation
* May 7, 2013 1973 rferrel Changes to properly display Issue Time. * May 7, 2013 1973 rferrel Changes to properly display Issue Time.
* Aug 7, 2013 2243 jsanchez Set all the attributes of an AbstractWarningRecord and added an expiration string. Removed calendar object. * Aug 7, 2013 2243 jsanchez Set all the attributes of an AbstractWarningRecord and added an expiration string. Removed calendar object.
* * Aug 15,2013 2243 jsanchez Improved the expiration string off by one minute.
* </pre> * </pre>
* *
* @author rferrel * @author rferrel
@ -139,9 +139,11 @@ public class FollowupData extends WarningRecord {
StringBuilder rval = new StringBuilder(); StringBuilder rval = new StringBuilder();
long timeInMillis = SimulatedTime.getSystemTime().getMillis(); long timeInMillis = SimulatedTime.getSystemTime().getMillis();
if (status != WarningAction.COR) { if (status != WarningAction.COR) {
// Positive means not yet expired // use double to keep precision until it's casted to an integer
long diffMins = (record.getEndTime().getTimeInMillis() - timeInMillis) double diffMillis = record.getEndTime().getTimeInMillis()
/ TimeUtil.MILLIS_PER_MINUTE; - timeInMillis;
int diffMins = (int) Math.round(diffMillis
/ TimeUtil.MILLIS_PER_MINUTE);
if (diffMins == 0) { if (diffMins == 0) {
rval.append(" Expired"); rval.append(" Expired");
} else if (diffMins > 0) { } else if (diffMins > 0) {
@ -150,8 +152,12 @@ public class FollowupData extends WarningRecord {
rval.append(" Exp ").append(-diffMins).append(" min ago"); rval.append(" Exp ").append(-diffMins).append(" min ago");
} }
} else { } else {
long diffMins = (timeInMillis - record.getIssueTime() // use double to keep precision until it's casted to an integer
.getTimeInMillis()) / TimeUtil.MILLIS_PER_MINUTE; double diffMillis = timeInMillis
- record.getIssueTime().getTimeInMillis();
int diffMins = (int) Math.round(diffMillis
/ TimeUtil.MILLIS_PER_MINUTE);
if (diffMins == 0) { if (diffMins == 0) {
rval.append(" Just Issued"); rval.append(" Just Issued");
} else { } else {

View file

@ -936,6 +936,7 @@ public class WarngenDialog extends CaveSWTDialog implements
// Select the previously selected item. // Select the previously selected item.
invalidFollowUpAction = false; invalidFollowUpAction = false;
if (currentSelection != null) { if (currentSelection != null) {
// isValid checks if the current selection is still in the list
boolean isValid = false; boolean isValid = false;
for (int i = 0; i < updateListCbo.getItemCount(); i++) { for (int i = 0; i < updateListCbo.getItemCount(); i++) {
if (updateListCbo.getItem(i).startsWith( if (updateListCbo.getItem(i).startsWith(
@ -954,7 +955,9 @@ public class WarngenDialog extends CaveSWTDialog implements
// up option could be removed due to an action such as a CAN or an // up option could be removed due to an action such as a CAN or an
// EXP. If an action removes the follow up, then no warning message // EXP. If an action removes the follow up, then no warning message
// should be displayed. // should be displayed.
if (!timeRange.contains(SimulatedTime.getSystemTime().getTime())) { if (!isValid
&& !timeRange.contains(SimulatedTime.getSystemTime()
.getTime())) {
invalidFollowUpAction = true; invalidFollowUpAction = true;
preventFollowUpAction(currentSelection); preventFollowUpAction(currentSelection);
} }

View file

@ -32,6 +32,7 @@ import com.raytheon.viz.warngen.text.ICommonPatterns;
* Mar 13, 2013 DR 15892 D. Friedman Handle SMW format in canceledAreasFromText * Mar 13, 2013 DR 15892 D. Friedman Handle SMW format in canceledAreasFromText
* Aug 6, 2013 2243 jsanchez Updated the time ranges to be removed from the follow up list correctly. * Aug 6, 2013 2243 jsanchez Updated the time ranges to be removed from the follow up list correctly.
* Aug 13, 2013 2243 jsanchez Removed calendar object. * Aug 13, 2013 2243 jsanchez Removed calendar object.
* Aug 15, 2013 2243 jsanchez Reset the time ranges to the correct values.
* *
* </pre> * </pre>
* *
@ -314,45 +315,40 @@ public class FollowUpUtil {
TimeRange rval = null; TimeRange rval = null;
// The time ranges are offset by 1 minute so that after a refresh and on
// the final minute of the time range the follow up data will be
// removed. For example, if a CON is only a available until 5 minutes
// before a warnings expiration, when the time reaches 5 minutes the
// follow up data for a CON is correctly removed.
if (action == WarningAction.NEW) { if (action == WarningAction.NEW) {
/* Calculate NEW Time Range */ /* Calculate NEW Time Range */
start.setTime(record.getEndTime().getTime()); start.setTime(record.getEndTime().getTime());
start.add(Calendar.MINUTE, -21); start.add(Calendar.MINUTE, -20);
end.setTime(record.getEndTime().getTime()); end.setTime(record.getEndTime().getTime());
end.add(Calendar.MINUTE, 29); end.add(Calendar.MINUTE, 30);
rval = new TimeRange(start, end); rval = new TimeRange(start, end);
} else if (action == WarningAction.COR) { } else if (action == WarningAction.COR) {
/* Calculate COR Time Range */ /* Calculate COR Time Range */
end.setTime(record.getIssueTime().getTime()); end.setTime(record.getIssueTime().getTime());
end.add(Calendar.MINUTE, 9); end.add(Calendar.MINUTE, 10);
rval = new TimeRange(record.getStartTime(), end); rval = new TimeRange(record.getStartTime(), end);
} else if (action == WarningAction.CAN) { } else if (action == WarningAction.CAN) {
/* Calculate CAN Time Range */ /* Calculate CAN Time Range */
end.setTime(record.getEndTime().getTime()); end.setTime(record.getEndTime().getTime());
end.add(Calendar.MINUTE, -11); end.add(Calendar.MINUTE, -10);
rval = new TimeRange(record.getStartTime(), end); rval = new TimeRange(record.getStartTime(), end);
} else if (action == WarningAction.CON) { } else if (action == WarningAction.CON) {
/* Calculate CON Time Range */ /* Calculate CON Time Range */
end.setTime(record.getEndTime().getTime()); end.setTime(record.getEndTime().getTime());
end.add(Calendar.MINUTE, -6); end.add(Calendar.MINUTE, -5);
rval = new TimeRange(record.getStartTime(), end); rval = new TimeRange(record.getStartTime(), end);
} else if (action == WarningAction.EXP) { } else if (action == WarningAction.EXP) {
/* Calculate EXP Time Range */ /* Calculate EXP Time Range */
start.setTime(record.getEndTime().getTime()); start.setTime(record.getEndTime().getTime());
start.add(Calendar.MINUTE, -11); start.add(Calendar.MINUTE, -10);
end.setTime(record.getEndTime().getTime()); end.setTime(record.getEndTime().getTime());
end.add(Calendar.MINUTE, 9); end.add(Calendar.MINUTE, 10);
rval = new TimeRange(start, end); rval = new TimeRange(start, end);
} else if (action == WarningAction.EXT) { } else if (action == WarningAction.EXT) {
/* Calculate EXT Time Range */ /* Calculate EXT Time Range */
start.setTime(record.getStartTime().getTime()); start.setTime(record.getStartTime().getTime());
end.setTime(record.getEndTime().getTime()); end.setTime(record.getEndTime().getTime());
end.add(Calendar.MINUTE, -6); end.add(Calendar.MINUTE, -5);
rval = new TimeRange(start, end); rval = new TimeRange(start, end);
} }