diff --git a/edexOsgi/com.raytheon.edex.plugin.obs/src/com/raytheon/edex/plugin/obs/metar/MetarPointDataTransform.java b/edexOsgi/com.raytheon.edex.plugin.obs/src/com/raytheon/edex/plugin/obs/metar/MetarPointDataTransform.java index c22ff487b6..4d7f706a2e 100644 --- a/edexOsgi/com.raytheon.edex.plugin.obs/src/com/raytheon/edex/plugin/obs/metar/MetarPointDataTransform.java +++ b/edexOsgi/com.raytheon.edex.plugin.obs/src/com/raytheon/edex/plugin/obs/metar/MetarPointDataTransform.java @@ -31,6 +31,10 @@ import java.util.List; import java.util.Map; import java.util.Set; +import javax.measure.converter.UnitConverter; +import javax.measure.unit.NonSI; +import javax.measure.unit.SI; + import com.raytheon.edex.plugin.obs.ObsDao; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.obs.metar.MetarRecord; @@ -42,7 +46,6 @@ import com.raytheon.uf.common.pointdata.PointDataView; import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.util.TimeUtil; -import com.raytheon.uf.edex.decodertools.core.DecoderTools; /** * Provides a transform from MetarRecords to PointDataContainer and vice versa. @@ -63,6 +66,7 @@ import com.raytheon.uf.edex.decodertools.core.DecoderTools; * Dec 16, 2013 DR 16920 D. Friemdan Fix type of tempFromTenths access. * May 14, 2014 2536 bclement removed TimeTools usage * Jul 23, 2014 3410 bclement location changed to floats + * Sep 18, 2014 3627 mapeters Convert units using {@link UnitConverter}. * * * @@ -72,6 +76,9 @@ import com.raytheon.uf.edex.decodertools.core.DecoderTools; public class MetarPointDataTransform { + public static final UnitConverter inToPa = NonSI.INCH_OF_MERCURY + .getConverterTo(SI.PASCAL); + public static final String ALTIMETER = "altimeter"; public static final String SEA_LEVEL_PRESS = "seaLevelPress"; @@ -416,7 +423,7 @@ public class MetarPointDataTransform { mr.setSeaLevelPress(pdv.getNumber(SEA_LEVEL_PRESS).floatValue()); mr.setAltimeter(pdv.getNumber(ALTIMETER).floatValue()); - double pa = DecoderTools.inToPa(pdv.getNumber(ALTIMETER).doubleValue()); + double pa = inToPa.convert(pdv.getNumber(ALTIMETER).doubleValue()); mr.setAltimeterInPa((float) pa); mr.setPressChange3Hour(pdv.getNumber(PRESS_CHANGE3_HOUR).floatValue()); mr.setPressChangeChar(pdv.getString(PRESS_CHANGE_CHAR)); diff --git a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/buoy/DRIBUSec1Decoder.java b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/buoy/DRIBUSec1Decoder.java index fbaa5d628e..b3ad7669f6 100644 --- a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/buoy/DRIBUSec1Decoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/buoy/DRIBUSec1Decoder.java @@ -34,6 +34,7 @@ import com.raytheon.edex.plugin.sfcobs.decoder.synoptic.AbstractSectionDecoder; import com.raytheon.edex.plugin.sfcobs.decoder.synoptic.AbstractSynopticDecoder; import com.raytheon.edex.plugin.sfcobs.decoder.synoptic.SynopticGroups; import com.raytheon.uf.common.dataplugin.sfcobs.ObsCommon; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.decodertools.core.DataItem; import com.raytheon.uf.edex.decodertools.core.ReportParser; import com.raytheon.uf.edex.decodertools.time.TimeTools; @@ -49,6 +50,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 20071010 391 jkorman Initial coding. + * Sep 18, 2014 3627 mapeters Updated deprecated {@link TimeTools} usage. * * * @@ -152,9 +154,10 @@ public class DRIBUSec1Decoder extends AbstractSectionDecoder { closeGroup(4); } else if ("5".equals(s) && doGroup(5)) { Integer val = getInt(element, 1, 2); - changeCharacter = new DataItem("int", "changeCharacter", 1); + changeCharacter = new DataItem("changeCharacter"); changeCharacter.setDataValue(val.doubleValue()); - changeCharacter.setDataPeriod(3 * TimeTools.SECONDS_HOUR); + changeCharacter + .setDataPeriod(3 * TimeUtil.SECONDS_PER_HOUR); pressureChange = SynopticGroups.decodePressureChange( element, 1); closeGroup(5); diff --git a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticGroups.java b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticGroups.java index 70ff11e4b8..2360c8c745 100644 --- a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticGroups.java +++ b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticGroups.java @@ -22,10 +22,12 @@ package com.raytheon.edex.plugin.sfcobs.decoder.synoptic; import static com.raytheon.edex.plugin.sfcobs.decoder.AbstractSfcObsDecoder.getInt; import static com.raytheon.edex.plugin.sfcobs.decoder.AbstractSfcObsDecoder.matchElement; +import javax.measure.converter.UnitConverter; +import javax.measure.unit.SI; + +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.decodertools.core.DataItem; -import com.raytheon.uf.edex.decodertools.core.DecoderTools; import com.raytheon.uf.edex.decodertools.core.IDecoderConstants; -import com.raytheon.uf.edex.decodertools.time.TimeTools; /** * Various methods for decoding specific common data from the synoptic @@ -52,6 +54,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * ------------ ---------- ----------- -------------------------- * 20070925 391 jkorman Initial Coding. * 20071109 391 jkorman Factored out time constants. + * Sep 18, 2014 #3627 mapeters Convert units using {@link UnitConverter}. * * * @author jkorman @@ -67,6 +70,12 @@ public class SynopticGroups { // TODO : This needs to be external. private static int[] precipHours = { -1, 6, 12, 18, 24, 1, 2, 3, 9, 15 }; + private static final UnitConverter cToK = SI.CELSIUS + .getConverterTo(SI.KELVIN); + + private static final UnitConverter hPaToPa = SI.HECTO(SI.PASCAL) + .getConverterTo(SI.PASCAL); + /** * Decode the relative humidity group. * @@ -86,8 +95,7 @@ public class SynopticGroups { if (lookingForSect == 1) { if (RH_PREFIX.equals(groupData.substring(PREFIX_START, RH_PREFIX.length()))) { - decodedItem = new DataItem("Percent", "relHum", - lookingForSect); + decodedItem = new DataItem("relHum"); decodedItem.setDataValue(val.doubleValue()); } } @@ -127,11 +135,9 @@ public class SynopticGroups { case '0': { if (lookingForSect == 2) { if ((sign = getSign(sn)) != 0) { - decodedItem = new DataItem("Kelvin", "seaSfcTemp", - lookingForSect); - decodedItem.setDataValue(DecoderTools - .celsiusToKelvin(val, sign, - defaultTempScale)); + decodedItem = new DataItem("seaSfcTemp"); + decodedItem.setDataValue(cToK.convert(val * sign + / defaultTempScale)); } } break; @@ -144,10 +150,9 @@ public class SynopticGroups { } if ((dataItemName != null) && ((sign = getSign(sn)) != 0)) { - decodedItem = new DataItem("Kelvin", dataItemName, - lookingForSect); - decodedItem.setDataValue(DecoderTools.celsiusToKelvin( - val, sign, defaultTempScale)); + decodedItem = new DataItem(dataItemName); + decodedItem.setDataValue(cToK.convert(val * sign + / defaultTempScale)); } break; } @@ -161,21 +166,18 @@ public class SynopticGroups { } if ((dataItemName != null) && ((sign = getSign(sn)) != 0)) { - decodedItem = new DataItem("Kelvin", dataItemName, - lookingForSect); - decodedItem.setDataValue(DecoderTools.celsiusToKelvin( - val, sign, defaultTempScale)); + decodedItem = new DataItem(dataItemName); + decodedItem.setDataValue(cToK.convert(val * sign + / defaultTempScale)); } break; } case '8': { if (lookingForSect == 2) { if ((sign = getSign(sn)) != 0) { - decodedItem = new DataItem("Kelvin", "wetBulbTemp", - lookingForSect); - decodedItem.setDataValue(DecoderTools - .celsiusToKelvin(val, sign, - defaultTempScale)); + decodedItem = new DataItem("wetBulbTemp"); + decodedItem.setDataValue(cToK.convert(val * sign + / defaultTempScale)); } } break; @@ -205,17 +207,14 @@ public class SynopticGroups { Integer val = getInt(groupData, 1, 5); if ((val != null) && (val >= 0)) { - decodedItem = new DataItem("Pascals", "stationPressure", - lookingForSect); + decodedItem = new DataItem("stationPressure"); // RULE : If the value is between 0 and 100, assume the // value // is above 1000 hPa i.e. 0132 --> 1013.2 hPa --> 101320 Pa if (val < 1000) { - decodedItem - .setDataValue(DecoderTools.hPaToPascals(val) + 100000); + decodedItem.setDataValue(hPaToPa.convert(val) + 100000); } else { - decodedItem - .setDataValue(DecoderTools.hPaToPascals(val)); + decodedItem.setDataValue(hPaToPa.convert(val)); } } } @@ -242,17 +241,14 @@ public class SynopticGroups { Integer val = getInt(groupData, 1, 5); if ((val != null) && (val >= 0)) { - decodedItem = new DataItem("Pascals", "seaLevelPressure", - lookingForSect); + decodedItem = new DataItem("seaLevelPressure"); // RULE : If the value is between 0 and 100, assume the // value // is above 1000 hPa i.e. 0132 --> 1013.2 hPa --> 101320 Pa if (val < 1000) { - decodedItem - .setDataValue(DecoderTools.hPaToPascals(val) + 100000); + decodedItem.setDataValue(hPaToPa.convert(val) + 100000); } else { - decodedItem - .setDataValue(DecoderTools.hPaToPascals(val)); + decodedItem.setDataValue(hPaToPa.convert(val)); } } } @@ -279,10 +275,9 @@ public class SynopticGroups { Integer val = getInt(groupData, 2, 5); if ((val != null) && (val >= 0)) { - decodedItem = new DataItem("Pascals", "3HRChange", - lookingForSect); - decodedItem.setDataValue(DecoderTools.hPaToPascals(val)); - decodedItem.setDataPeriod(3 * TimeTools.SECONDS_HOUR); + decodedItem = new DataItem("3HRChange"); + decodedItem.setDataValue(hPaToPa.convert(val)); + decodedItem.setDataPeriod(3 * TimeUtil.SECONDS_PER_HOUR); } } } @@ -307,8 +302,7 @@ public class SynopticGroups { if ((lookingForSect == 1) || (lookingForSect == 3)) { Integer val = getInt(groupData, 1, 4); if (val != null) { - decodedItem = new DataItem("millimeters", "precip", - lookingForSect); + decodedItem = new DataItem("precip"); if ((val >= 0) && (val < 990)) { decodedItem.setDataValue(val.doubleValue()); } else { @@ -319,7 +313,7 @@ public class SynopticGroups { val = getInt(groupData, 4, 5); if ((val != null) && (val >= 0)) { decodedItem.setDataPeriod(precipHours[val] - * TimeTools.SECONDS_HOUR); + * TimeUtil.SECONDS_PER_HOUR); } } } @@ -327,19 +321,17 @@ public class SynopticGroups { Integer val = getInt(groupData, 1, 5); if ((val != null) && (val >= 0)) { - decodedItem = new DataItem("millimeters", "precip", - lookingForSect); + decodedItem = new DataItem("precip"); if (val > 9998) { val = 0; } decodedItem.setDataValue(val.doubleValue() / 10.0); - decodedItem.setDataPeriod(TimeTools.SECONDS_DAY); + decodedItem.setDataPeriod(TimeUtil.SECONDS_PER_DAY); } } else if ((groupData.charAt(0) == '2') && (lookingForSect == 5)) { Integer val = getInt(groupData, 1, 5); if ((val != null) && (val >= 0)) { - decodedItem = new DataItem("millimeters", "cityPrecip", - lookingForSect); + decodedItem = new DataItem("cityPrecip"); if (!IDecoderConstants.VAL_MISSING.equals(val)) { // convert 1/100ths of an inch to millimeters. decodedItem @@ -347,7 +339,7 @@ public class SynopticGroups { } else { decodedItem.setDataValue(val.doubleValue()); } - decodedItem.setDataPeriod(TimeTools.SECONDS_DAY); + decodedItem.setDataPeriod(TimeUtil.SECONDS_PER_DAY); } } } @@ -412,12 +404,12 @@ public class SynopticGroups { if ("minTemp".equals(di.getDataName())) { int p = minTbl[regionIdx][hourTbl[obsHour]]; if (p != 99) { - period = new Integer(p * TimeTools.SECONDS_HOUR); + period = new Integer(p * TimeUtil.SECONDS_PER_HOUR); } } else if ("maxTemp".equals(di.getDataName())) { int p = maxTbl[regionIdx][hourTbl[obsHour]]; if (p != 99) { - period = new Integer(p * TimeTools.SECONDS_HOUR); + period = new Integer(p * TimeUtil.SECONDS_PER_HOUR); } } } diff --git a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticSec1Decoder.java b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticSec1Decoder.java index f2c7bb63c5..527df7e938 100644 --- a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticSec1Decoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticSec1Decoder.java @@ -53,6 +53,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * 20071109 391 jkorman Added guard for short data. * 20080123 757 jkorman Ensure that the group 9 obs time has * the correct day of month. + * Sep 18, 2014 #3627 mapeters Updated deprecated {@link TimeTools} usage, + * removed unused lowCloudAmount field. * * * @@ -102,8 +104,6 @@ public class SynopticSec1Decoder extends AbstractSectionDecoder { private Integer loCloudHeight = null; - private Integer lowCloudAmount = null; - private Integer lowCloudType = null; private Integer midCloudType = null; @@ -233,7 +233,7 @@ public class SynopticSec1Decoder extends AbstractSectionDecoder { winds = true; } else if ("5".equals(element.substring(0, 1)) && doGroup(5)) { Integer val = getInt(element, 1, 2); - changeCharacter = new DataItem("int", "changeCharacter", 1); + changeCharacter = new DataItem("changeCharacter"); changeCharacter.setDataValue(val.doubleValue()); changeCharacter.setDataPeriod(3 * 3600); pressureChange = SynopticGroups @@ -254,10 +254,6 @@ public class SynopticSec1Decoder extends AbstractSectionDecoder { winds = true; } else if ("8".equals(element.substring(0, 1)) && doGroup(8)) { if (!winds && matchElement(element, "8[/0-9]{4}")) { - - if ((lowCloudAmount = getInt(element, 1, 2)) < 0) { - lowCloudAmount = null; - } if ((lowCloudType = getInt(element, 2, 3)) < 0) { lowCloudType = null; } @@ -385,7 +381,7 @@ public class SynopticSec1Decoder extends AbstractSectionDecoder { long delta = newT.getTimeInMillis() - obsT.getTimeInMillis(); // Allow up to the reference hour + 30 minutes. if (delta > 30 * 60 * 1000) { - TimeTools.rollByDays(newT, -1); + newT.add(Calendar.DAY_OF_MONTH, -1); } receiver.setTimeObs(newT); diff --git a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticSec3Decoder.java b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticSec3Decoder.java index 93f6e76857..a977b0336d 100644 --- a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticSec3Decoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/SynopticSec3Decoder.java @@ -27,6 +27,9 @@ import static com.raytheon.edex.plugin.sfcobs.decoder.synoptic.ISynoptic.SEC_5_L import static com.raytheon.uf.edex.decodertools.core.IDecoderConstants.VAL_ERROR; import static com.raytheon.uf.edex.decodertools.core.IDecoderConstants.VAL_MISSING; +import javax.measure.converter.UnitConverter; +import javax.measure.unit.SI; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -35,10 +38,9 @@ import com.raytheon.uf.common.dataplugin.sfcobs.AncPrecip; import com.raytheon.uf.common.dataplugin.sfcobs.AncPressure; import com.raytheon.uf.common.dataplugin.sfcobs.AncTemp; import com.raytheon.uf.common.dataplugin.sfcobs.ObsCommon; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.decodertools.core.DataItem; -import com.raytheon.uf.edex.decodertools.core.DecoderTools; import com.raytheon.uf.edex.decodertools.core.ReportParser; -import com.raytheon.uf.edex.decodertools.time.TimeTools; /** * TODO Add Description @@ -58,6 +60,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * 20071010 391 jkorman Initial coding. * 20071203 410 jkorman JavaDoc complaints. * 20080116 798 jkorman Changed logging levels. + * Sep 18, 2014 #3627 mapeters Convert units using {@UnitConverter}, + * removed unused duration field. * * * @@ -86,7 +90,8 @@ public class SynopticSec3Decoder extends AbstractSectionDecoder { private Double windGust912 = null; - private Integer duration = null; + private static final UnitConverter hPaToPa = SI.HECTO(SI.PASCAL) + .getConverterTo(SI.PASCAL); /** * @@ -135,7 +140,6 @@ public class SynopticSec3Decoder extends AbstractSectionDecoder { break; } - // String s = null; if ("1".equals(element.substring(0, 1)) && doGroup(1)) { maxTemperature = SynopticGroups.decodeTemperature(element, 3); @@ -161,10 +165,10 @@ public class SynopticSec3Decoder extends AbstractSectionDecoder { } Integer val = getInt(element, 2, 5); if ((val != null) && (val >= 0)) { - pressure24 = new DataItem("Pascals", "24HRChange", 3); - pressure24.setDataValue(DecoderTools.hPaToPascals(val + pressure24 = new DataItem("24HRChange"); + pressure24.setDataValue(hPaToPa.convert(val * sign)); - pressure24.setDataPeriod(TimeTools.SECONDS_DAY); + pressure24.setDataPeriod(TimeUtil.SECONDS_PER_DAY); } closeGroup(5); } else if ("6".equals(element.substring(0, 1)) && doGroup(6)) { @@ -178,16 +182,7 @@ public class SynopticSec3Decoder extends AbstractSectionDecoder { // Group 8 doesn't get closed here, there may be more than // one group. } else if (matchElement(element, "907\\d{2}")) { - Integer temp = getInt(element, 3, 5); - if ((temp != null) && (temp >= 0)) { - if (temp < 61) { - duration = 6 * temp; - } else if (temp < 67) { - duration = (60 * (temp - 60)) + 360; - } else { - duration = 1080; - } - } + // TODO : Should something be done here? } else if (matchElement(element, "910\\d{2}")) { Integer temp = getInt(element, 3, 5); if ((temp != null) && (temp >= 0)) { diff --git a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/regional/Sec5Block72Decoder.java b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/regional/Sec5Block72Decoder.java index 1b3f9d27d2..e7a1cca947 100644 --- a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/regional/Sec5Block72Decoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/regional/Sec5Block72Decoder.java @@ -25,15 +25,18 @@ import static com.raytheon.edex.plugin.sfcobs.decoder.synoptic.ISynoptic.SEC_5_7 import static com.raytheon.edex.plugin.sfcobs.decoder.synoptic.ISynoptic.SEC_5_72_CTEMP; import static com.raytheon.edex.plugin.sfcobs.decoder.synoptic.ISynoptic.SEC_5_LEAD; +import javax.measure.converter.UnitConverter; +import javax.measure.unit.NonSI; +import javax.measure.unit.SI; + import com.raytheon.edex.exception.DecoderException; -import com.raytheon.uf.common.dataplugin.sfcobs.AncPrecip; -import com.raytheon.uf.common.dataplugin.sfcobs.AncTemp; -import com.raytheon.uf.common.dataplugin.sfcobs.ObsCommon; import com.raytheon.edex.plugin.sfcobs.decoder.synoptic.AbstractSynopticDecoder; import com.raytheon.edex.plugin.sfcobs.decoder.synoptic.SynopticGroups; import com.raytheon.edex.plugin.sfcobs.decoder.synoptic.SynopticSec5Decoder; +import com.raytheon.uf.common.dataplugin.sfcobs.AncPrecip; +import com.raytheon.uf.common.dataplugin.sfcobs.AncTemp; +import com.raytheon.uf.common.dataplugin.sfcobs.ObsCommon; import com.raytheon.uf.edex.decodertools.core.DataItem; -import com.raytheon.uf.edex.decodertools.core.DecoderTools; import com.raytheon.uf.edex.decodertools.core.ReportParser; /** @@ -46,6 +49,7 @@ import com.raytheon.uf.edex.decodertools.core.ReportParser; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 20071010 391 jkorman Initial coding. + * Sep 18, 2014 #3627 mapeters Convert units using {@link UnitConverter}. * * * @@ -62,6 +66,9 @@ public class Sec5Block72Decoder extends SynopticSec5Decoder { private DataItem city24HrPrecip = null; + private static final UnitConverter fToK = NonSI.FAHRENHEIT + .getConverterTo(SI.KELVIN); + /** * Construct this decoder using a specified decoder parent. * @@ -111,7 +118,7 @@ public class Sec5Block72Decoder extends SynopticSec5Decoder { // City temperature. Double val = decodeFahrenheit(element.substring(1, 4)); if (val != null) { - cityTemperature = new DataItem("K", "cityTemp", 5); + cityTemperature = new DataItem("cityTemp"); cityTemperature.setDataValue(val); cityTemperature.setDataPeriod(0); } @@ -119,15 +126,13 @@ public class Sec5Block72Decoder extends SynopticSec5Decoder { // City maximum/minimum temperature. Double val = decodeFahrenheit(element.substring(0, 3)); if (val != null) { - cityMaxTemperature = new DataItem("K", - "cityMaxTemp", 5); + cityMaxTemperature = new DataItem("cityMaxTemp"); cityMaxTemperature.setDataValue(val); cityMaxTemperature.setDataPeriod(0); } val = decodeFahrenheit(element.substring(3, 6)); if (val != null) { - cityMinTemperature = new DataItem("K", - "cityMinTemp", 5); + cityMinTemperature = new DataItem("cityMinTemp"); cityMinTemperature.setDataValue(val); cityMinTemperature.setDataPeriod(0); } @@ -222,8 +227,7 @@ public class Sec5Block72Decoder extends SynopticSec5Decoder { int sign = SynopticGroups.getSign(element.charAt(0)); Integer val = getInt(element, 1, 3); if ((val != null) && (val >= 0)) { - double f = (((double) val * sign) - 32) * 5.0 / 9.0; - decodedValue = DecoderTools.celsiusToKelvin(f, 1, 1); + decodedValue = fToK.convert((double) val * sign); } else { decodedValue = null; } diff --git a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/regional/Sec5MaritimeDecoder.java b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/regional/Sec5MaritimeDecoder.java index d018e4efe3..8a0ff8353a 100644 --- a/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/regional/Sec5MaritimeDecoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/decoder/synoptic/regional/Sec5MaritimeDecoder.java @@ -26,12 +26,16 @@ import static com.raytheon.edex.plugin.sfcobs.decoder.synoptic.ISynoptic.SEC_5_L import java.util.Arrays; import java.util.Calendar; +import javax.measure.converter.UnitConverter; +import javax.measure.unit.NonSI; +import javax.measure.unit.SI; + import com.raytheon.edex.exception.DecoderException; import com.raytheon.edex.plugin.sfcobs.decoder.synoptic.AbstractSynopticDecoder; import com.raytheon.edex.plugin.sfcobs.decoder.synoptic.SynopticSec5Decoder; import com.raytheon.uf.common.dataplugin.sfcobs.InterWinds; import com.raytheon.uf.common.dataplugin.sfcobs.ObsCommon; -import com.raytheon.uf.edex.decodertools.core.DecoderTools; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.decodertools.core.ReportParser; import com.raytheon.uf.edex.decodertools.time.TimeTools; @@ -51,6 +55,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 20071010 391 jkorman Initial coding. + * Sep 18, 2014 #3627 mapeters Convert units using {@link UnitConverter}, + * updated deprecated {@link TimeTools} usage. * * * @@ -58,6 +64,10 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * @version 1.0 */ public class Sec5MaritimeDecoder extends SynopticSec5Decoder { + + private static final UnitConverter knotsToMSec = NonSI.KNOT + .getConverterTo(SI.METERS_PER_SECOND); + private static final int NUM_WINDS = 6; private Double wind10mSpeed = null; @@ -230,14 +240,14 @@ public class Sec5MaritimeDecoder extends SynopticSec5Decoder { if (wind10mSpeed > -9999.0) { wSpeed = wind10mSpeed; if (inKnots) { - wSpeed = DecoderTools.knotsToMSec(wSpeed); + wSpeed = knotsToMSec.convert(wSpeed); } receiver.setWind10mSpeed(wSpeed); } if (wind20mSpeed > -9999.0) { wSpeed = wind20mSpeed; if (inKnots) { - wSpeed = DecoderTools.knotsToMSec(wSpeed); + wSpeed = knotsToMSec.convert(wSpeed); } receiver.setWind20mSpeed(wSpeed); } @@ -265,7 +275,7 @@ public class Sec5MaritimeDecoder extends SynopticSec5Decoder { wSpeed = pkWindSpeed; if (wSpeed > -9999) { if (inKnots) { - wSpeed = DecoderTools.knotsToMSec(wSpeed); + wSpeed = knotsToMSec.convert(wSpeed); } } receiver.setPeakWindSpeed(wSpeed); @@ -298,7 +308,7 @@ public class Sec5MaritimeDecoder extends SynopticSec5Decoder { wSpeed = windSpeeds[i]; if (wSpeed >= 0) { if (inKnots) { - wSpeed = DecoderTools.knotsToMSec(wSpeed); + wSpeed = knotsToMSec.convert(wSpeed); } } wind.setWindSpeed(wSpeed); @@ -311,7 +321,7 @@ public class Sec5MaritimeDecoder extends SynopticSec5Decoder { } // Now set the time/type if there was data. if (wind != null) { - wind.setObsTime(TimeTools.copy(newT)); + wind.setObsTime(TimeUtil.newCalendar(newT)); receiver.addInterWind(wind); } // adjust the time back ten minutes diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java index 4c001bfdaf..9346d44fd8 100644 --- a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java +++ b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java @@ -83,7 +83,6 @@ import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants.IngestSwitch; import com.raytheon.uf.common.dataplugin.shef.util.ShefQC; import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.database.dao.CoreDao; @@ -130,6 +129,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * 07/14/2014 mpduff Fix data range checks * 08/05/2014 15671 snaples Fixed check for posting when not found in ingestfilter and token is set for load_shef_ingest * 09/03/2014 mpduff Fixed river status table updates. + * 09/18/2014 3627 mapeters Updated deprecated {@link TimeTools} usage. * * * @author mduff @@ -2892,8 +2892,7 @@ public class PostShef { .parseInt(monthDayEnd.substring(0, 2)) * 100; rangeEndDate += Integer.parseInt(monthDayEnd.substring(3)); - Calendar date = TimeTools.getSystemCalendar(); - date.setTime(obsTime); + Calendar date = TimeUtil.newGmtCalendar(obsTime); int dataDate = (date.get(Calendar.MONTH) + 1) * 100; dataDate += date.get(Calendar.DAY_OF_MONTH); diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/ohdlib/GagePP.java b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/ohdlib/GagePP.java index 15a0a9cea6..dee4990311 100644 --- a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/ohdlib/GagePP.java +++ b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/ohdlib/GagePP.java @@ -36,6 +36,7 @@ import com.raytheon.uf.common.dataplugin.shef.tables.HourlyppId; import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.Duration; import com.raytheon.uf.common.dataplugin.shef.util.SHEFTimezone; import com.raytheon.uf.common.ohd.AppsDefaults; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.decodertools.time.TimeTools; /** @@ -53,6 +54,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * 02 Feb 2012 #15845 lbousaidi added check for data that comes in as -999 * 07 May 2013 #15880 lbousaidi changed pPE parameter because it was inserting to the * wrong hour field. + * 18 Sep 2014 #3627 mapeters Updated deprecated {@link TimeTools} usage. * * * @author mnash @@ -151,7 +153,8 @@ public class GagePP { logger.info("Processing records at " + btime); - Calendar dt = TimeTools.newCalendar(rec.getObsTime().getTime()); + Calendar dt = TimeUtil.newGmtCalendar(); + dt.setTimeInMillis(rec.getObsTime().getTime()); HourlyppId id = new HourlyppId(rec.getLocationId(), rec.getTypeSource() .getCode(), btime); @@ -221,7 +224,7 @@ public class GagePP { if(!dt.getTime().equals(rec.getObsTime())) { rec.setObsTime(dt.getTime()); - dp = TimeTools.copy(dt); + dp = TimeUtil.newCalendar(dt); } p6HourSlot = sHour[0]; @@ -637,11 +640,12 @@ public class GagePP { ppp_ppd_window *= SECONDS_PER_HOUR * 1000L; // Observation time as a calendar - Calendar timeTObs = TimeTools.getSystemCalendar(); + Calendar timeTObs = TimeUtil.newGmtCalendar(); timeTObs.setTime(yearsec_ansi); // Create a 12Z object - Calendar pStructTm = TimeTools.newCalendar(yearsec_ansi.getTime()); + Calendar pStructTm = TimeUtil.newGmtCalendar(); + pStructTm.setTimeInMillis(yearsec_ansi.getTime()); pStructTm.set(Calendar.HOUR_OF_DAY, 12); pStructTm.set(Calendar.MINUTE, 0); pStructTm.set(Calendar.SECOND, 0); diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/ohdlib/GagePPWrite.java b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/ohdlib/GagePPWrite.java index 99fc720a3d..7720516456 100644 --- a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/ohdlib/GagePPWrite.java +++ b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/ohdlib/GagePPWrite.java @@ -39,6 +39,7 @@ import com.raytheon.uf.common.dataplugin.shef.tables.HourlyppId; import com.raytheon.uf.common.dataplugin.shef.tables.IHourlyTS; import com.raytheon.uf.common.dataplugin.shef.util.SHEFTimezone; import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.database.dao.CoreDao; import com.raytheon.uf.edex.database.dao.DaoConfig; import com.raytheon.uf.edex.decodertools.time.TimeTools; @@ -54,6 +55,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * Nov 5, 2008 1649 snaples Initial creation * May 7, 2013 15880 lbousaidi changed minute_offset to offset in * in write_1_HourValue routine. + * Sep 18, 2014 3627 mapeters Updated deprecated {@link TimeTools} usage. * * * @@ -101,7 +103,8 @@ public final class GagePPWrite { char manual_qc_code) { - Calendar dt = TimeTools.newCalendar(dtime.getTime()); + Calendar dt = TimeUtil.newGmtCalendar(); + dt.setTimeInMillis(dtime.getTime()); int hour_slot = dt.get(Calendar.HOUR_OF_DAY); Arrays.fill(hourly_qc, '-'); @@ -422,7 +425,7 @@ public final class GagePPWrite { } private Calendar getCalendar(Date obsDate) { - Calendar dt = TimeTools.getSystemCalendar(); + Calendar dt = TimeUtil.newGmtCalendar(); dt.setTime(obsDate); @@ -478,7 +481,7 @@ public final class GagePPWrite { int status = 0; boolean record_exists; - Calendar dt = TimeTools.getSystemCalendar(); + Calendar dt = TimeUtil.newGmtCalendar(); dt.setTime(obsDate); dt.set(Calendar.HOUR_OF_DAY, 0); dt.set(Calendar.MINUTE, 0); @@ -489,11 +492,6 @@ public final class GagePPWrite { dt.add(Calendar.DAY_OF_MONTH, 1); Date endtime = dt.getTime(); - char qcc = 'Z'; // ShefQC.buildQcSymbol(qualityCode).charAt(0); - if(qual != null) { - qcc = qual.charAt(0); - } - String qcsym = "Z"; // ShefQC.buildQcSymbol(quality_code); if((qual != null)&&(qual.length() > 0)) { qcsym = qual.substring(0,1); diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/AircraftLatitude.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/AircraftLatitude.java index 6ff6d3422b..f85b4d43ae 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/AircraftLatitude.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/AircraftLatitude.java @@ -19,7 +19,6 @@ **/ package com.raytheon.uf.edex.decodertools.aircraft; -import java.util.regex.Matcher; import java.util.regex.Pattern; import com.raytheon.uf.edex.decodertools.core.BasePoint; @@ -27,7 +26,7 @@ import com.raytheon.uf.edex.decodertools.core.BasePoint; /** * Parse various forms of Latitude data and decode these into numeric form. - * + * *
  * SOFTWARE HISTORY
  * Date           PTR#     Engineer      Description
@@ -35,6 +34,7 @@ import com.raytheon.uf.edex.decodertools.core.BasePoint;
  * Feb 28, 2005        753 jkorman       Initial creation.
  * May  4, 2005       1906 jkorman       Correct decode of longitude minutes
  * 20071227            384 jkorman       Ported to edex.
+ * Sep 18, 2014       3627 mapeters      Removed unused splitLatLon().
  * 
*/ public class AircraftLatitude @@ -49,11 +49,6 @@ public class AircraftLatitude private static final Pattern LA_HDDDD = Pattern.compile("^[NS]{1}\\d{2}\\d{2}"); private static final Pattern LA_HDDdDD = Pattern.compile("^[NS]{1}\\d{2}\\.\\d{2}"); - private static final Pattern [] theLatPatterns = - { - LA_DDH, LA_DDDDH, LA_HDDdDD, LA_HDD, LA_HDDDD, LA_DDdDDH, - }; - // This isn't legal, but some folks like to use it! private static final String EQUATOR = "EQ"; // Once set the obs data cannot be changed! @@ -80,7 +75,7 @@ public class AircraftLatitude public Double getLatitude() { return latitude; - } // getLongitude() + } // getLatitude() /** * Convert latitude in various formats to a numeric value. Any pattern of @@ -121,41 +116,6 @@ public class AircraftLatitude } return retValue; } // aircraftLatitudeFactory() - - /** - * Attempt to discover if the data is a run-together latitude longitude pair - * by comparing the various patterns against the data and attempting a - * decode on the match, if any. If the match succeeds, the data is split - * into a two element array containing the latitude and the remaining data - * which may be a longitude. If no run-together was found, a null reference - * is returned. - * @param anElement A data element to check for run-together. - * @return - */ - public static String [] splitLatLon(String anElement) - { - String [] retValue = null; - Matcher m = null; - for(int i = 0;i < theLatPatterns.length;i++) - { - m = theLatPatterns[i].matcher((anElement)); - if(m.lookingAt()) - { - int patternEnd = m.end(); - if(patternEnd < anElement.length()) - { - if(AircraftLongitude.aircraftLongitudeFactory(anElement.substring(patternEnd)) != null) - { - retValue = new String [2]; - retValue[0] = anElement.substring(0,patternEnd); - retValue[1] = anElement.substring(patternEnd); - break; - } - } - } - } // for - return retValue; - } // splitLatLon() /** * Convert latitude in various formats to a numeric value. Any pattern of diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/AircraftRemarks.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/AircraftRemarks.java index e23ab35cb1..7b361f0270 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/AircraftRemarks.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/AircraftRemarks.java @@ -29,6 +29,8 @@ package com.raytheon.uf.edex.decodertools.aircraft; * ------------ -------- ------------- ------------------------------------- * Feb 28, 2005 753 jkorman Initial creation. * 20071227 384 jkorman Ported to edex. + * Sep 18, 2014 3627 mapeters Removed unused insertRemarks(). + * * */ public class AircraftRemarks @@ -57,19 +59,6 @@ public class AircraftRemarks } } // addRemarks() - /** - * Inserts a remarks fragment at the beginning of the Remarks being built. - * @param aRemark A remarks fragment to insert. - */ - public void insertRemarks(String aRemark) - { - if(aRemark != null) - { - theRemarks.insert(0," "); - theRemarks.insert(0,aRemark); - } - } // insertRemarks() - /** * Get the current remarks string being built. * @return The remarks string. diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/Entry.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/Entry.java index d254904436..7f85d620ba 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/Entry.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/Entry.java @@ -23,46 +23,34 @@ package com.raytheon.uf.edex.decodertools.aircraft; * TODO Add Description * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Jun 13, 2011            jkorman     Initial creation
- *
+ * Sep 18, 2014 3627       mapeters    Removed unused methods/fields.
+ * 
  * 
- * + * * @author jkorman - * @version 1.0 + * @version 1.0 */ public class Entry { - public final String word; private final String translatedWord; - private final Boolean isRegEx; - private final Integer firstId; private final Integer secondId; - public Entry(String word, String translatedWord, boolean isRegEx, - Integer firstId, Integer secondId) { - this.word = word; + public Entry(String translatedWord, Integer firstId, Integer secondId) { this.translatedWord = translatedWord; - this.isRegEx = Boolean.valueOf(isRegEx); this.firstId = firstId; this.secondId = secondId; } - /** - * @return the word - */ - public String getWord() { - return word; - } - /** * @return the translatedWord */ @@ -70,13 +58,6 @@ public class Entry { return translatedWord; } - /** - * @return the isRegEx - */ - public Boolean isRegEx() { - return isRegEx; - } - /** * @return the firstId */ diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/WordTranslator.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/WordTranslator.java index fa7685eb8a..a03f4552c1 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/WordTranslator.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/aircraft/WordTranslator.java @@ -19,9 +19,7 @@ **/ package com.raytheon.uf.edex.decodertools.aircraft; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -36,6 +34,7 @@ import java.util.regex.Pattern; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jun 10, 2011 jkorman Initial creation + * Sep 18, 2014 3627 mapeters Removed unused isRegEx(). * * * @@ -64,8 +63,7 @@ public class WordTranslator { regex.put(Pattern.compile(word), translatedWord); } - words.put(word, new Entry(word, translatedWord, isRegEx, firstId, - secondId)); + words.put(word, new Entry(translatedWord, firstId, secondId)); } /** @@ -88,16 +86,6 @@ public class WordTranslator { return e; } - /** - * - * @param word - * @return - */ - public Boolean isRegEx(String word) { - Entry entry = words.get(word); - return (entry != null) ? entry.isRegEx() : null; - } - /** * * @param word diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/BasePoint.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/BasePoint.java index 0f283a451c..2053fdb97a 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/BasePoint.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/BasePoint.java @@ -38,6 +38,7 @@ import com.vividsolutions.jts.geom.Coordinate; * 20070911 379 jkorman Added comments. * 20070912 379 jkorman Code review cleanup. * Jun 05, 2014 3226 bclement deprecated class, removed time + * Sep 18, 2014 3627 mapeters Removed unused methods/fields. * * * @deprecated use {@link Coordinate} instead @@ -50,26 +51,6 @@ public class BasePoint { private double longitude; - private double elevation; - - /** - * Create an empty basepoint instance. - */ - public BasePoint() { - } - - /** - * Copy constructor for BasePoint. - * - * @param point - * A basepoint to copy. - */ - public BasePoint(BasePoint point) { - this.latitude = point.latitude; - this.longitude = point.longitude; - this.elevation = point.elevation; - } - /** * Create a base point at a given location. * @@ -118,24 +99,4 @@ public class BasePoint { public void setLongitude(double longitude) { this.longitude = longitude; } - - /** - * Get the elevation of this point. No units are specified. - * - * @return The elevation of this point. - */ - public double getElevation() { - return elevation; - } - - /** - * Set the elevation of this point. No units are specified. - * - * @param elevation - * The elevation of this point. - */ - public void setElevation(double elevation) { - this.elevation = elevation; - } - } diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/DataItem.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/DataItem.java index 464ea77ad7..6a5ddd3559 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/DataItem.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/DataItem.java @@ -31,6 +31,7 @@ package com.raytheon.uf.edex.decodertools.core; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 20070925 391 jkorman Initial Coding. + * Sep 18, 2014 3627 mapeters Removed unused methods/fields. * * * @author jkorman @@ -42,49 +43,16 @@ public class DataItem { private String dataName = null; - private Integer decodeGroup = null; - - private String dataUnits = null; - private Integer dataPeriod = null; - /** - * Construct a data item with units information only. - * - * @param units - * The units for this data item. - */ - public DataItem(String units) { - dataUnits = units; - } - - /** - * Construct a data item with units and name information. - * - * @param units - * The units for this data item. - * @param name - * The name of this data item. - */ - public DataItem(String units, String name) { - this(units); - dataName = name; - } - /** * Construct a data item with units, name, group information. - * - * @param units - * The units for this data item. * @param name * The name of this data item. - * @param group - * The decoder group where the data was found. * */ - public DataItem(String units, String name, int group) { - this(units, name); - decodeGroup = group; + public DataItem(String name) { + dataName = name; } /** @@ -125,44 +93,6 @@ public class DataItem { this.dataName = dataName; } - /** - * Get the group this data item was found in. - * - * @return The decode group. - */ - public Integer getDecodeGroup() { - return decodeGroup; - } - - /** - * Set the group this data item was found in. - * - * @param decodeGroup - * The decodeGroup to set. - */ - public void setDecodeGroup(Integer decodeGroup) { - this.decodeGroup = decodeGroup; - } - - /** - * Get the data units of this item. - * - * @return The dataUnits. - */ - public String getDataUnits() { - return dataUnits; - } - - /** - * Set the data units as a string value. - * - * @param dataUnits - * The dataUnits. - */ - public void setDataUnits(String dataUnits) { - this.dataUnits = dataUnits; - } - /** * Get the data period in seconds. * diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/DecoderTools.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/DecoderTools.java index afb3f3c026..951a890e1a 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/DecoderTools.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/DecoderTools.java @@ -24,7 +24,6 @@ import static com.raytheon.uf.edex.decodertools.core.IDecoderConstants.ASCII_LF; import static com.raytheon.uf.edex.decodertools.core.IDecoderConstants.ASCII_SP; import static com.raytheon.uf.edex.decodertools.core.IDecoderConstants.VAL_ERROR; import static com.raytheon.uf.edex.decodertools.core.IDecoderConstants.VAL_MISSING; -import static com.raytheon.uf.edex.decodertools.core.IDecoderConstants.WMO_HEADER; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -49,6 +48,7 @@ import com.vividsolutions.jts.geom.Coordinate; * encoding/decoding errors. * 20070912 379 jkorman Code review cleanup. * 20071003 391 jkorman Factored out isEqual method from decoders. + * Sep 18, 2014 3627 mapeters Removed unused methods/fields. * * * @author jkorman @@ -58,41 +58,8 @@ public class DecoderTools { // public static final double CEL_TO_KELVIN_OFFSET = 273.15; - public static final String NO_DATA_MSG = "NODATA:"; - public static final String INGEST_FILE_NAME = "ingestfilename"; - /** - * Aligns input data to the starting position of the WMO header. In the - * event that the header could not be found, the original data is returned. - * All leading data up to the beginning of the WMO header is removed. - * - * @param messageData - * The input data to search. - * @return The message data with leading data removed. - */ - public static byte[] isolateWMOHeader(byte[] messageData) { - byte[] retMessage = null; - - String s = new String(messageData); - - Pattern p = Pattern.compile(WMO_HEADER); - - Matcher m = p.matcher(s); - if (m.find()) { - int dlen = s.length() - m.start(); - if (dlen > 0) { - retMessage = new byte[dlen]; - System.arraycopy(messageData, m.start(), retMessage, 0, dlen); - } else { - retMessage = messageData; - } - } else { - retMessage = messageData; - } - return retMessage; - } - /** * Attempt to find the start of the data. If the pattern is found all data * from the end of the pattern to the end of the data is returned. This @@ -172,204 +139,6 @@ public class DecoderTools { return retMessage; } - /** - * Are two objects equal to each other. - * - * @param first - * First object to compare. - * @param second - * Second object to compare. - * @return Are the objects equal. - */ - public static boolean isEqual(Object first, Object second) { - // are both pointing to the same object or both null? - boolean retValue = (first == second); - - if (!retValue) { - if (first == null) { - // we can do this because only one of the operands is null! - retValue = isEqual(second, first); - } else { - retValue = first.equals(second); - } - } - return retValue; - } - - /** - * Convert decoded Celsius to Kelvin. For example a value of 102 with a sign - * of -1, and scale of 10 gives a value of 10.2 converted to Kelvin as - * 283.33. - * - * @param value - * The raw decoded value. - * @param sign - * The sign of the data. 1 or -1. - * @param scale - * A scale value that will be used when value must be scaled. - * @return Calculated Kelvin temperature. - */ - public static double celsiusToKelvin(int value, int sign, double scale) { - return ((value * sign) / scale) + CEL_TO_KELVIN_OFFSET; - } - - /** - * Convert decoded Celsius to Kelvin. For example a value of 102 with a sign - * of -1, and scale of 10 gives a value of 10.2 converted to Kelvin as - * 283.33. - * - * @param value - * The raw decoded value. - * @param sign - * The sign of the data. 1 or -1. - * @param scale - * A scale value that will be used when value must be scaled. - * @return Calculated Kelvin temperature. - */ - public static double celsiusToKelvin(double value, int sign, double scale) { - return ((value * sign) / scale) + CEL_TO_KELVIN_OFFSET; - } - - /** - * - * @param value - * @return - */ - public static Double celsiusToFahrenheit(Double value) { - Double temp = null; - if (value != null) { - temp = (9.0 / 5.0 * value) + 32.0; - } - return temp; - } - - /** - * - * @param value - * @return - */ - public static Double fahrenheitToCelsius(Double value) { - Double temp = null; - if (value != null) { - temp = (value - 32.0) * 5.0 / 9.0; - } - return temp; - } - - /** - * - * @param value - * @return - */ - public static Double celsiusToKelvin(Double value) { - Double temp = null; - if (value != null) { - temp = value + CEL_TO_KELVIN_OFFSET; - } - return temp; - } - - /** - * - * @param value - * @return - */ - public static Double kelvinToCelsius(Double value) { - Double temp = null; - if (value != null) { - temp = value - CEL_TO_KELVIN_OFFSET; - } - return temp; - } - - /** - * - * @param value - * @return - */ - public static Double inToPa(Double value) { - Double temp = null; - if (value != null) { - temp = value * 3386.0; - } - return temp; - } - - /** - * - * @param value - * @return - */ - public static Double paToIn(Double value) { - Double temp = null; - if (value != null) { - temp = value / 3386.0; - } - return temp; - } - - /** - * - * @param value - * @return - */ - public static Double hPaToPa(Double value) { - Double temp = null; - if (value != null) { - temp = value * 100.0; - } - return temp; - } - - /** - * - * @param value - * @return - */ - public static Double paTohPa(Double value) { - Double temp = null; - if (value != null) { - temp = value / 100.0; - } - return temp; - } - - /** - * Convert a wind speed in knots to meters per second. - * - * @param value - * A value in knots. - * @return Speed converted to meters per second. - */ - public static Double ktsToMSec(Double value) { - Double speed = null; - if (value != null) { - speed = value * 0.514444D; - } - return speed; - } - - /** - * Convert a wind speed in knots to meters per second. - * - * @param value - * A value in knots. - * @return Speed converted to meters per second. - */ - public static double knotsToMSec(double value) { - return value * 0.514444D; - } - - /** - * Convert a pressure in hectoPascals to Pascals. - * - * @param value - * @return - */ - public static double hPaToPascals(int value) { - return value * 10.0D; - } - /** * Find the position of a given target byte array in a data array. * diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IDecoderConstants.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IDecoderConstants.java index 457c1d3fe9..44ca2b5ad5 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IDecoderConstants.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IDecoderConstants.java @@ -32,6 +32,7 @@ package com.raytheon.uf.edex.decodertools.core; * 20071217 453 jkorman Added SYNOPTIC_MAROB report type. * 20080102 384 jkorman Added additional obs type constants. * 20080114 763 jkorman Added constants for vertical sig values. + * Sep 18, 2014 3627 mapeters Removed unused constants. * * * @author jkorman @@ -82,36 +83,6 @@ public interface IDecoderConstants { public static final int SYNOPTIC_MAROB = 1007; - // BUFR vertical significance defines. - public static final Integer SIGWND_LEVEL = new Integer(2); - public static final Integer SIGPRE_LEVEL = new Integer(4); - public static final Integer MAXWND_LEVEL = new Integer(8); - public static final Integer TROP_LEVEL = new Integer(16); - public static final Integer MANPRE_LEVEL = new Integer(32); - public static final Integer SFC_LEVEL = new Integer(64); - public static final Integer GENERIC_LEVEL = new Integer(128); - - // Mandatory level data - Pressure : Geopotential - public static final int MANLVL_LO = 2020; - public static final int MANLVL_HI = 2030; - // Significant level wind data - Geopotential - public static final int SIGWLVL_LO = 2021; - public static final int SIGWLVL_HI = 2031; - // Significant level temperature data - Pressure - public static final int SIGTLVL_LO = 2022; - public static final int SIGTLVL_HI = 2032; - - // TODO For now - refine names and labels - public static final int BUFRUA_2020 = 2020; - - public static final int BUFRUA_2030 = 2030; - - public static final int BUFRUA_2040 = 2040; - - public static final int BUFRUA_2050 = 2050; - - public static final int BUFRUA_2060 = 2060; - public static final int RECCO_MANOBS = 4500; public static final int RECCO_INTEROBS = 4510; @@ -120,14 +91,5 @@ public interface IDecoderConstants { public static final int AIREP_SPECIAL = 4610; - public static final int PIREP_NORMAL = 4700; - public static final int PROFILER_DATA = 3000; - - - - - - - } diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IObsFilterElement.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IObsFilterElement.java deleted file mode 100644 index e49a1ead80..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IObsFilterElement.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.edex.decodertools.core; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; - -/** - * - * - * - * - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 23, 2009            jkorman     Initial creation
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ -public interface IObsFilterElement { - - /** - * Executes this filter element against the supplied report data. The - * supplied report is returned if it matches the filter criteria. A null - * report reference is returned if the report fails. - * @param report - * @return - */ - PluginDataObject filter(PluginDataObject report); -} diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IObservationFilter.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IObservationFilter.java deleted file mode 100644 index 113b9999fb..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IObservationFilter.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.edex.decodertools.core; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; - -/** - * - * - * - * - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 23, 2009            jkorman     Initial creation
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ -public interface IObservationFilter { - - public static final String INCLUDE_TYPE = "INCLUDE"; - - public static final String EXCLUDE_TYPE = "EXCLUDE"; - - /** - * - * @param element - */ - void addFilterElement(IObsFilterElement element); - - /** - * Executes this filter against the supplied report data. The supplied - * report is returned if it passes all filter elements. A null report - * reference is returned if the report fails. - * @param report - * @return - */ - PluginDataObject [] filter(PluginDataObject [] report); - -} diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IPluginDecoder.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IPluginDecoder.java deleted file mode 100644 index 2a0aead8ac..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/IPluginDecoder.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.edex.decodertools.core; - -import java.util.Map; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; - -/** - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Feb 23, 2009            jkorman     Initial creation
- *
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public interface IPluginDecoder { - - /** - * - * @param message - * @param decodeProperties - * @return - */ - PluginDataObject [] decode(byte [] message, Map decodeProperties); - - /** - * - * @param message - * @param decodeProperties - * @return - */ - PluginDataObject [] decodeInput(IDecoderInput input); - -} diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/LatLonPoint.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/LatLonPoint.java index ef978eec57..020839d6e6 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/LatLonPoint.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/LatLonPoint.java @@ -47,6 +47,7 @@ import java.io.Serializable; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 20080103 384 jkorman Ported from JET JUTL classes. + * Sep 18, 2014 3627 mapeters Removed unused methods/fields. * * * @author jkorman @@ -77,16 +78,6 @@ public class LatLonPoint implements Cloneable, Serializable { // the longitude value for this point in degrees. private double theLongitudeInDegrees; - // *************************************************************************** - // the quadrant of the sphere based on the above latitude/longitude. - // WMO Manual 306, Code table 3333, page I.1-C-98, 1995 Edition, Suppl. No.3 - // quadrant = 1 0N - 90N ( 90) 0E - 180E (-180) - // quadrant = 3 0S - 90S (-90) 0E - 180E (-180) - // quadrant = 5 0S - 90S (-90) 0W - 180W ( 180) - // quadrant = 7 0N - 90N ( 90) 0W - 180W ( 180) - // *************************************************************************** - private int theQuadrant; - /** * Construct a new LatLonPoint with the given data. * @@ -111,32 +102,8 @@ public class LatLonPoint implements Cloneable, Serializable { */ public LatLonPoint(double aLatitude, double aLongitude, int units) { setLatLon(aLatitude, aLongitude, units); - - theQuadrant = computeQuadrant(theLatitudeInDegrees, - theLongitudeInDegrees, INDEGREES); } // LatLonPoint - /** - * Construct a new LatLonPoint with the given data. - * - * @param aLatitude - * The value of the latitude - * @param aLongitude - * The value of the longitude - * @param units - * The units of the input latitude/longitude. - * @see #INRADIANS - * @see #INDEGREES - * @param aQuadrant - * The units of the input latitude/longitude. - */ - public LatLonPoint(double aLatitude, double aLongitude, int units, - int aQuadrant) { - setLatLon(aLatitude, aLongitude, units); - - theQuadrant = aQuadrant; - } - /** * Construct a new LatLonPoint from a given LatLonPoint. This is a copy * constructor for LatLonPoint. @@ -149,7 +116,6 @@ public class LatLonPoint implements Cloneable, Serializable { this.theLongitude = thePoint.theLongitude; this.theLatitudeInDegrees = thePoint.theLatitudeInDegrees; this.theLongitudeInDegrees = thePoint.theLongitudeInDegrees; - this.theQuadrant = thePoint.theQuadrant; } /** @@ -324,9 +290,6 @@ public class LatLonPoint implements Cloneable, Serializable { theLatitude = aLatitude; theLatitudeInDegrees = Math.toDegrees(aLatitude); } // switch - - theQuadrant = computeQuadrant(theLatitudeInDegrees, - theLongitudeInDegrees, INDEGREES); } /** @@ -355,68 +318,12 @@ public class LatLonPoint implements Cloneable, Serializable { theLongitudeInDegrees = Math.toDegrees(aLongitude); } // switch - - theQuadrant = computeQuadrant(theLatitudeInDegrees, - theLongitudeInDegrees, INDEGREES); - } - - /** - * Get the global quadrant for this LatLonPoint. - * - * @return The current global Quadrant for this point - */ - public int getQuadrant() { - return theQuadrant; } // *** // // *** - /** - * Compute the square of an argument. - * - * @param x - * Value to square. - * @return the Square of the argument. - */ - public static double sqr(double x) { - return (x * x); - } - - /** - * Compute the square of an argument. - * - * @param x - * Value to square. - * @return the Square of the argument. - */ - public static float sqr(float x) { - return (x * x); - } - - /** - * Compute the square of an argument. - * - * @param x - * Value to square. - * @return the Square of the argument. - */ - public static long sqr(long x) { - return (x * x); - } - - /** - * Compute the square of an argument. - * - * @param x - * Value to square. - * @return the Square of the argument. - */ - public static int sqr(int x) { - return (x * x); - } - /** * This is a special Modulus function for floating point computations. It is * required for trigometric functions. @@ -453,29 +360,14 @@ public class LatLonPoint implements Cloneable, Serializable { // // gc1 and gc2 are temporary computed terms. // - double gc1 = sqr(Math.sin((fromLat - toLat) / 2)); + double gc1 = Math.pow(Math.sin((fromLat - toLat) / 2), 2); double gc2 = Math.cos(fromLat) * Math.cos(toLat) - * sqr(Math.sin((fromLon - toLon) / 2)); + * Math.pow(Math.sin((fromLon - toLon) / 2), 2); return (2 * Math.asin(Math.sqrt(gc1 + gc2))); } - /** - * Compute the great circle distance (in radians) between two points located - * on a spherical surface. - * - * @param fromPoint - * Latitude/Longitude of the first point as a point pair. - * @param toPoint - * Latitude/Longitude of the second point as a point pair. - * @return The great circle distance in radians. - */ - public static double GreatCircle(LatLonPoint fromPoint, LatLonPoint toPoint) { - return GreatCircle(fromPoint.getLatitude(), fromPoint.getLongitude(), - toPoint.getLatitude(), toPoint.getLongitude()); - } - /** * Compute the great circle distance (in radians) between this point and * another point located on a spherical surface. @@ -557,20 +449,6 @@ public class LatLonPoint implements Cloneable, Serializable { } - /** - * Compute the initial bearing (in radians) to travel from this point to a - * second point at a specified Latitude and Longitude. - * - * @param aLatitude - * Latitude of second point in radians. - * @param aLongitude - * Longitude of second point in radians. - * @return The bearing (from north in radians) to the second point. - */ - public double bearingTo(double aLatitude, double aLongitude) { - return bearingTo(theLatitude, theLongitude, aLatitude, aLongitude); - } - /** * Compute the initial bearing (in radians) to travel from this point to a * second LatLonPoint. @@ -638,261 +516,4 @@ public class LatLonPoint implements Cloneable, Serializable { public LatLonPoint positionOf(double aBearing, double aDistance) { return positionOf(theLatitude, theLongitude, aBearing, aDistance); } - - /** - * Calculate the Quadrant this Latitude/Longitude point resides in. - *

- * Points that exist on the Equator or the Prime Meridian - * - * are always considered North and West respectively. - *

- * - * @param aLatitude - * The Latitude corresponding to this point - * @param aLongitude - * The Longitude corresponding to this point - * @param units - * The units of measurement these coordinates are represented in - * @see #INRADIANS - * @see #INDEGREES - * @return The Global coordinate for this Lat/Long point - */ - public static int computeQuadrant(double aLatitude, double aLongitude, - int units) { - // The quadrant that is being calculated. - int Quadrant = 0; - double Latitude = 0; // Incase we need to modify the - double Longitude = 0; // Lat/Long points - - if (units == INDEGREES) // Measurement in Degrees? - { - Latitude = aLatitude; // Good, just copy the - Longitude = aLongitude; // values - } else { - // ********************************************************************* - // * If it is not in Degrees we assume Radians. Since our tests are - // * using degrees we must convert these two values - // ********************************************************************* - Latitude = Math.toDegrees(aLatitude); - Longitude = Math.toDegrees(aLongitude); - } - - if (Latitude >= 0) // Northern Hemisphere? - { - if (Longitude >= 0) // West of the Prime Meridian? - { - Quadrant = 7; // Then we are in Quadrant 7 - } else { - Quadrant = 1; // must be in Quadrant 1 then - } - } else - // West of the Prime Meridian? - { - if (Longitude >= 0) // Southern Hemisphere. - { - Quadrant = 5; // We are in Quadrant 5 - } else { - Quadrant = 3; // Otherwuse we are in Quadrant 3 - } - } - - return Quadrant; // Return the calculated Quadrant - } - - /** - * Gets the Marsden Square corresponding to the Lat/Long of this LatLonPoint - * object. - * - * @return The Marsden Square number for this point - */ - public int getMarsdenSquare() { - return calcMarsdenSquare(theLatitudeInDegrees, theLongitudeInDegrees, - INDEGREES, theQuadrant); - } - - /** - * Given a point on the globe, this routine returns the Marsden Square - * number that corresponds with this point. - * - * @param aLatitude - * The Latitude of this point in Radians - * @param aLongitude - * The Longitude of this point in Radians - * @return The Marsden Square number for the location entered - */ - public static int calcMarsdenSquare(double aLatitude, double aLongitude) { - return calcMarsdenSquare(aLatitude, aLongitude, INRADIANS); - } - - /** - * Given a point on the globe, this routine returns the Marsden Square - * number that corresponds with this point. - * - * @param aLatitude - * The Latitude of this point - * @param aLongitude - * The Longitude of this point - * @param units - * The units of measurement these coordinates are represented in - * @see #INRADIANS - * @see #INDEGREES - * @return The Marsden Square number for the location entered - */ - public static int calcMarsdenSquare(double aLatitude, double aLongitude, - int units) { - return calcMarsdenSquare(aLatitude, aLongitude, units, computeQuadrant( - aLatitude, aLongitude, units)); - } - - /** - * Given a point on the globe, this routine returns the Marsden Square - * number that corresponds with this point. - * - * @param aLatitude - * The Latitude of this point - * @param aLongitude - * The Longitude of this point - * @param units - * The units of measurement these coordinates are represented in - * @see #INRADIANS - * @see #INDEGREES - * @param aQuadrant - * The Quadrant this point is located in - * @return The Marsden Square number for the location entered - */ - public static int calcMarsdenSquare(double aLatitude, double aLongitude, - int units, int aQuadrant) { - int MarsdenSquare = 0; // Space for our calculations - int xGrid = 0; // 10 Degree Longitude place holder - int yGrid = 0; // 10 degree Latitude place holder - - validateLatLon(aLatitude, aLongitude, units); - - // Convert radians to degrees if required - if (units != INDEGREES) { - aLatitude = Math.toDegrees(aLatitude); - aLongitude = Math.toDegrees(aLongitude); - } - - // *** - // If the passed quadrant is invalid, recompute using the given - // latitude and longitude. - // *** - if ((aQuadrant < 1) || (aQuadrant > 7) || ((aQuadrant % 2) == 0)) { - aQuadrant = computeQuadrant(aLatitude, aLongitude, INDEGREES); - } - - // Convert -180..0 degrees to the range 360..180 - if (aLongitude < 0) { - aLongitude = 360 + aLongitude; - } - - // Now get the primary grid intersection. - xGrid = (int) (aLatitude / 10); - yGrid = (int) (aLongitude / 10); - - // If the grid point was in the Southern Hemisphere adjust it. - xGrid = Math.abs(xGrid); - - // Special rules for North Polar region. - if (aLatitude >= 80) { - // Start at Marsden Square 901 - MarsdenSquare = 901 + yGrid; - } else { - // Get the base Marsden Square number. - MarsdenSquare = (xGrid * 36) + yGrid; - - // Now apply the offset based on Northern/Southern Hemisphere. - // MarsdenSquare += (aLatitude >= 0) ? 1 : 300; - if (aLatitude >= 0) { - MarsdenSquare += 1; - } else { - MarsdenSquare += 300; - } - - } - - // return the calculated Marsden Square - return MarsdenSquare; - } - - /** - * Gets the Ship Edit Block corresponding to the Lat/Long of this - * LatLonPoint object. - * - * @return The Ship Edit Block number for this point - */ - public int getShipEditBlock() { - return calcShipEditBlock(theLatitudeInDegrees, theLongitudeInDegrees, - INDEGREES); - } - - /** - * Given a point on the globe, this routine returns the Ship Edit Block - * number that corresponds with this point. - * - * @param aLatitude - * The Latitude of this point in Radians - * @param aLongitude - * The Longitude of this point in Radians - * @return The Ship Edit Block number for the location entered - */ - public static int calcShipEditBlock(double aLatitude, double aLongitude) { - return calcShipEditBlock(aLatitude, aLongitude, INRADIANS); - } - - /** - * Given a point on the globe, this routine returns the Ship Edit Block - * number that corresponds with this point. - * - * @param aLatitude - * The Latitude of this point - * @param aLongitude - * The Longitude of this point - * @param units - * The units of measurement these coordinates are in - * @see #INRADIANS - * @see #INDEGREES - * @return The Ship Edit Block number for the location entered - */ - public static int calcShipEditBlock(double aLatitude, double aLongitude, - int units) { - int shipEditBlock = 0; // Space for our calculations - int lonGrid = 0; // 30 Degree Longitude place holder - int latGrid = 0; // 30 degree Latitude place holder - - validateLatLon(aLatitude, aLongitude, units); - - // Convert radians to degrees if required - if (units != INDEGREES) { - aLatitude = Math.toDegrees(aLatitude); - aLongitude = Math.toDegrees(aLongitude); - } - - // Convert -180..0 degrees to the range 360..180 - if (aLongitude < 0) { - aLongitude = 360 + aLongitude; - } - - // Now get the primary grid intersection. - // If the grid point was in the Southern Hemisphere adjust it. - latGrid = Math.abs((int) aLatitude / 30); - lonGrid = (int) aLongitude / 30; - - // Compensate for the unlikly event the point is at a pole. - if (aLatitude >= 90 || aLatitude <= -90) { - latGrid -= 1; - } - - // Get the base Ship Edit Block number. - shipEditBlock = (latGrid * 12) + lonGrid; - - // Now apply the offset if Southern Hemisphere. - if (aLatitude < 0) { - shipEditBlock += 36; - } - - // return the calculated Marsden Square - return shipEditBlock; - } } diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/PlatformLocationProxy.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/PlatformLocationProxy.java index ef4d180b82..736aa7c9a0 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/PlatformLocationProxy.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/PlatformLocationProxy.java @@ -23,9 +23,9 @@ import java.util.HashMap; /** - * - * - * + * + * + * * *
  * 
@@ -34,6 +34,7 @@ import java.util.HashMap;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * 20071226            384 jkorman     Initial Coding.
+ * Sep 18, 2014       3627 mapeters    Removed unused constructor.
  * 
* * @author jkorman @@ -42,14 +43,6 @@ import java.util.HashMap; public class PlatformLocationProxy { private static HashMap myLOCATIONS = new HashMap(); - - /** - * - * @param aType - */ - private PlatformLocationProxy() { - // nothing - } public static BasePoint lookup(String navaid,String [] aNetworkTypeList) { BasePoint retValue = null; diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/ReportParser.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/ReportParser.java index 346d185b28..8ceca8b7f3 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/ReportParser.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/ReportParser.java @@ -35,6 +35,7 @@ import java.util.regex.Pattern; * 03 Oct 2007 391 jkorman Initial Development * 20071130 410 jkorman Changed bad copyright symbol. * 20071203 410 jkorman JavaDoc complaints. + * Sep 18, 2014 3627 mapeters Removed unused methods. * * * @author jkorman @@ -95,13 +96,6 @@ public class ReportParser { return element; } - /** - * Reset the internal position to the first text element in the parser. - */ - public void reset() { - currentElement = 0; - } - /** * Advance to the next text element. * @@ -116,20 +110,6 @@ public class ReportParser { return advanced; } - /** - * Move to the previous text element if it exists. - * - * @return Was the internal position moved back. - */ - public boolean previous() { - boolean retreated = false; - if (currentElement > 0) { - currentElement--; - retreated = true; - } - return retreated; - } - /** * Move the current position to a given value. The element to position to * must equal the parsed element. If the match element is not found, the diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/AbstractObsFilter.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/AbstractObsFilter.java index f9064bb968..9d4b796cac 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/AbstractObsFilter.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/AbstractObsFilter.java @@ -19,7 +19,6 @@ **/ package com.raytheon.uf.edex.decodertools.core.filterimpl; -import java.io.File; import java.util.ArrayList; import java.util.List; @@ -42,6 +41,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * ------------ ---------- ----------- -------------------------- * Mar 25, 2009 jkorman Initial creation * Aug 28, 2014 3548 mapeters Removed implementation of ISerializableObject + * Sep 18, 2014 3627 mapeters Removed unused createFilter(). * * * @@ -64,17 +64,6 @@ public abstract class AbstractObsFilter { @DynamicSerializeElement private String filterName; - /** - * - * @param filterFile - */ - void createFilter(File filterFile) { - - - - - } - public abstract PluginDataObject [] filter(PluginDataObject [] reports); /** diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/PluginDataObjectFilter.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/PluginDataObjectFilter.java index 1819c12ce9..0ae5d880e0 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/PluginDataObjectFilter.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/PluginDataObjectFilter.java @@ -22,8 +22,6 @@ package com.raytheon.uf.edex.decodertools.core.filterimpl; import static com.raytheon.uf.common.localization.LocalizationContext.LocalizationType.EDEX_STATIC; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -58,6 +56,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; * Sep 09, 2014 3548 mapeters Improved constructor's error messages. * Sep 11, 2014 3548 mapeters Replaced use of SerializationUtil * with JAXBManager. + * Sep 18, 2014 3627 mapeters Removed unused getInputStream(). * * * @@ -202,22 +201,6 @@ public class PluginDataObjectFilter extends AbstractObsFilter { addFilterElement(dummy); } - /** - * - * @param file - * @return - */ - private static FileInputStream getInputStream(File file) { - FileInputStream fis = null; - - try { - fis = new FileInputStream(file); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - return fis; - } - private static class TestObject extends PluginDataObject implements ISpatialEnabled { diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/RectFilterElement.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/RectFilterElement.java index d0d71c0e89..40a8da8c20 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/RectFilterElement.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/RectFilterElement.java @@ -72,8 +72,12 @@ public class RectFilterElement extends AbstractFilterElement implements ISeriali private double lowerRightLon = 0; /** - * This execute - * @see com.raytheon.uf.edex.decodertools.core.IObsFilterElement#filter(com.raytheon.uf.common.dataplugin.PluginDataObject) + * Executes this filter element against the supplied report data. The + * supplied report is returned if it matches the filter criteria. A null + * report reference is returned if the report fails. + * + * @param report + * @return may be null */ @Override public PluginDataObject filter(PluginDataObject report) { diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/StationIdFilterElement.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/StationIdFilterElement.java index 9f8fc085e9..1e19e9594b 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/StationIdFilterElement.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/StationIdFilterElement.java @@ -36,8 +36,6 @@ import com.raytheon.uf.common.pointdata.spatial.ObStation; import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; -import com.raytheon.uf.edex.decodertools.core.DecoderTools; -import com.vividsolutions.jts.geom.Geometry; /** * TODO Add Description @@ -99,8 +97,12 @@ public class StationIdFilterElement extends AbstractFilterElement implements ISe } /** - * This execute - * @see com.raytheon.uf.edex.decodertools.core.IObsFilterElement#filter(com.raytheon.uf.common.dataplugin.PluginDataObject) + * Executes this filter element against the supplied report data. The + * supplied report is returned if it matches the filter criteria. A null + * report reference is returned if the report fails. + * + * @param report + * @return may be null */ @Override public PluginDataObject filter(PluginDataObject report) { diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/WMOHeaderFilterElement.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/WMOHeaderFilterElement.java index cd337e1be3..dc29b7e815 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/WMOHeaderFilterElement.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/core/filterimpl/WMOHeaderFilterElement.java @@ -20,7 +20,6 @@ package com.raytheon.uf.edex.decodertools.core.filterimpl; import java.lang.reflect.Method; -import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -45,6 +44,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; * ------------ ---------- ----------- -------------------------- * Oct 25, 2011 11312 jkorman Initial creation * Aug 30, 2013 2298 rjpeter Make getPluginName abstract + * Sep 19, 2014 3627 mapeters Removed unused methods. * * * @@ -84,30 +84,12 @@ public class WMOHeaderFilterElement extends AbstractFilterElement implements } /** + * Executes this filter element against the supplied report data. The + * supplied report is returned if it matches the filter criteria. A null + * report reference is returned if the report fails. * - * @param pattern - */ - public void addPattern(Pattern pattern) { - if (patterns == null) { - patterns = new ArrayList(); - } - patterns.add(pattern); - } - - /** - * - * @param pattern - */ - public void addPattern(String pattern) { - if (pattern != null) { - addPattern(Pattern.compile(pattern)); - } - } - - /** - * This execute - * - * @see com.raytheon.uf.edex.decodertools.core.IObsFilterElement#filter(com.raytheon.uf.common.dataplugin.PluginDataObject) + * @param report + * @return may be null */ @Override public PluginDataObject filter(PluginDataObject report) { diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/time/TimeTools.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/time/TimeTools.java index 19ea11d4f9..27e05b20cd 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/time/TimeTools.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/decodertools/time/TimeTools.java @@ -50,6 +50,7 @@ import com.raytheon.uf.common.time.util.TimeUtil; * 20130912 2249 rferrel Added getWarningTimestamp method. * 20140409 2907 njensen Deprecated duplicated functionality * 20140514 2536 bclement moved WMO Header time parsing to WMOTimeParser + * 20140919 3627 mapeters Removed unused methods/fields. * * * @author jkorman @@ -74,48 +75,11 @@ public class TimeTools { */ private static Pattern FILE_WARNING_TIMESTAMP = null; - /** * @deprecated use com.raytheon.uf.common.time.util.TimeUtil instead */ @Deprecated - public static final int HOURS_DAY = TimeUtil.HOURS_PER_DAY; - - /** - * @deprecated use com.raytheon.uf.common.time.util.TimeUtil instead - */ - @Deprecated - public static final int MINUTES_HOUR = TimeUtil.MINUTES_PER_HOUR; - - /** - * @deprecated use com.raytheon.uf.common.time.util.TimeUtil instead - */ - @Deprecated - public static final int SECONDS_HOUR = TimeUtil.SECONDS_PER_HOUR; - - /** - * @deprecated use com.raytheon.uf.common.time.util.TimeUtil instead - */ - @Deprecated - public static final int SECONDS_DAY = TimeUtil.SECONDS_PER_DAY; - - /** - * @deprecated use com.raytheon.uf.common.time.util.TimeUtil instead - */ - @Deprecated - public static final long MILLIS_HOUR = TimeUtil.MILLIS_PER_HOUR; - - /** - * @deprecated use com.raytheon.uf.common.time.util.TimeUtil instead - */ - @Deprecated - public static final long MILLIS_DAY = TimeUtil.MILLIS_PER_DAY; - - /** - * @deprecated use com.raytheon.uf.common.time.util.TimeUtil instead - */ - @Deprecated - public static final String ZULU_TIMEZONE = "Zulu"; + private static final String ZULU_TIMEZONE = "Zulu"; private static ITimeService timeService = null; @@ -204,7 +168,7 @@ public class TimeTools { */ @Deprecated public static final Calendar newCalendar(long timeInMillis) { - Calendar calendar = getSystemCalendar(); + Calendar calendar = TimeUtil.newGmtCalendar(); calendar.setTimeInMillis(timeInMillis); @@ -223,7 +187,8 @@ public class TimeTools { public static final Calendar copy(Calendar calendar) { Calendar retValue = null; if (calendar != null) { - retValue = newCalendar(calendar.getTimeInMillis()); + retValue = TimeUtil.newGmtCalendar(); + retValue.setTimeInMillis(calendar.getTimeInMillis()); retValue.setTimeZone(calendar.getTimeZone()); } return retValue; @@ -267,54 +232,4 @@ public class TimeTools { } return retValue; } - - /** - * Roll the date of a calendar +/- a given number of days. - * - * @param calendar - * Calendar instance to modify. - * @param byDays - * Number of days to add or subtract. - * @return The modified calendar. - * @deprecated use java.util.Calendar.add(int, int) instead - */ - @Deprecated - public static final Calendar rollByDays(Calendar calendar, int byDays) { - if (calendar != null) { - long millis = calendar.getTimeInMillis(); - - long days = byDays * MILLIS_DAY; - - calendar.setTimeInMillis(millis + days); - } - return calendar; - } - - /** - * Roll the date of a calendar +/- a given number of hours. - * - * @param calendar - * Calendar instance to modify. - * @param byHours - * Number of hours to add or subtract. - * @return The modified calendar. - * @deprecated use java.util.Calendar.add(int, int) instead - */ - @Deprecated - public static final Calendar rollByHours(Calendar calendar, int byHours) { - if (calendar != null) { - long millis = calendar.getTimeInMillis(); - - long hours = byHours * MILLIS_HOUR; - - calendar.setTimeInMillis(millis + hours); - } - return calendar; - } - - /** - * Disable constructor. - */ - private TimeTools() { - } } diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/stations/sql/AWIPSCommonObsSQLGenerator.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/stations/sql/AWIPSCommonObsSQLGenerator.java index 9a1c4cf7eb..bbd151a03a 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/stations/sql/AWIPSCommonObsSQLGenerator.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/stations/sql/AWIPSCommonObsSQLGenerator.java @@ -46,6 +46,7 @@ import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber; * ------------ ---------- ----------- -------------------------- * Initial release. * Mar 06, 2014 2876 mpduff New NDM plugin. + * Sep 18, 2014 3627 mapeters Removed unused field. * * * @@ -62,8 +63,6 @@ public class AWIPSCommonObsSQLGenerator implements INationalDatasetSubscriber { public static final int FILE_SIZE_LIMIT = 4000; - public static final String RAOB = "RAOB"; - public static final String SYNOPTIC = "SYNOPTIC"; public static final String SYNOPTIC_BLANK_POS = "9999"; diff --git a/edexOsgi/com.raytheon.uf.edex.grid.staticdata/src/com/raytheon/uf/edex/grid/staticdata/StaticDataGenerator.java b/edexOsgi/com.raytheon.uf.edex.grid.staticdata/src/com/raytheon/uf/edex/grid/staticdata/StaticDataGenerator.java index d957dea2ef..e6712829ad 100644 --- a/edexOsgi/com.raytheon.uf.edex.grid.staticdata/src/com/raytheon/uf/edex/grid/staticdata/StaticDataGenerator.java +++ b/edexOsgi/com.raytheon.uf.edex.grid.staticdata/src/com/raytheon/uf/edex/grid/staticdata/StaticDataGenerator.java @@ -50,6 +50,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.database.cluster.ClusterLockUtils; import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState; import com.raytheon.uf.edex.database.cluster.ClusterTask; @@ -76,6 +77,7 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao; * creation of static data for all perturbations * of Ensemble models * Apr 21, 2014 2060 njensen Remove dependency on grid dataURI column + * Sep 19, 2014 3627 mapeters Updated deprecated {@link TimeTools} usage. * * * @@ -368,7 +370,7 @@ public class StaticDataGenerator { staticRecord = new GridRecord(record); staticRecord.setId(0); - staticRecord.setInsertTime(TimeTools.getSystemCalendar()); + staticRecord.setInsertTime(TimeUtil.newGmtCalendar()); Calendar refTime = new GregorianCalendar(TimeZone.getTimeZone("GMT")); refTime.setTime(record.getDataTime().getRefTime()); diff --git a/edexOsgi/com.raytheon.uf.edex.metartohmdbsrv/src/com/raytheon/uf/edex/metartohmdb/dao/HMDBRptDao.java b/edexOsgi/com.raytheon.uf.edex.metartohmdbsrv/src/com/raytheon/uf/edex/metartohmdb/dao/HMDBRptDao.java index 38cf8f653b..32769a88d3 100644 --- a/edexOsgi/com.raytheon.uf.edex.metartohmdbsrv/src/com/raytheon/uf/edex/metartohmdb/dao/HMDBRptDao.java +++ b/edexOsgi/com.raytheon.uf.edex.metartohmdbsrv/src/com/raytheon/uf/edex/metartohmdb/dao/HMDBRptDao.java @@ -21,6 +21,7 @@ package com.raytheon.uf.edex.metartohmdb.dao; import java.util.Calendar; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.database.dao.CoreDao; import com.raytheon.uf.edex.database.dao.DaoConfig; import com.raytheon.uf.edex.decodertools.time.TimeTools; @@ -29,17 +30,18 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * TODO Add Description * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Jun 29, 2009            jkorman     Initial creation
- *
+ * Sep 18, 2014 #3627      mapeters    Updated deprecated {@link TimeTools} usage.
+ * 
  * 
- * + * * @author jkorman - * @version 1.0 + * @version 1.0 */ public class HMDBRptDao extends CoreDao { @@ -75,7 +77,7 @@ public class HMDBRptDao extends CoreDao { public boolean purgeTable(int purgeHours) { boolean status = true; - Calendar c = TimeTools.getSystemCalendar(); + Calendar c = TimeUtil.newGmtCalendar(); c.add(Calendar.HOUR_OF_DAY,-purgeHours); StringBuilder sb = new StringBuilder("delete from rpt where nominal < "); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/util/handlers/AbstractTableHandler.java b/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/util/handlers/AbstractTableHandler.java index 5686f9b997..22acb218f1 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/util/handlers/AbstractTableHandler.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/util/handlers/AbstractTableHandler.java @@ -31,6 +31,7 @@ import java.util.regex.Pattern; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.decodertools.time.TimeTools; import com.raytheon.uf.edex.plugin.loctables.util.TableHandler; import com.raytheon.uf.edex.plugin.loctables.util.store.ObStationRow; @@ -40,17 +41,18 @@ import com.raytheon.uf.edex.plugin.loctables.util.store.RowStoreStrategy; * TODO Add Description * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Apr 16, 2010            jkorman     Initial creation
- *
+ * Sep 18, 2014 #3627      mapeters    Updated deprecated {@link TimeTools} usage.
+ * 
  * 
- * + * * @author jkorman - * @version 1.0 + * @version 1.0 */ public abstract class AbstractTableHandler implements TableHandler { @@ -193,7 +195,7 @@ public abstract class AbstractTableHandler implements TableHandler { String fs = data.substring(DIRECTIVE_STATUS_DIR.length()).trim(); - Calendar c = TimeTools.getSystemCalendar(); + Calendar c = TimeUtil.newGmtCalendar(); fs = String.format("%s.%2$tY% * * @author @@ -245,8 +248,8 @@ public class McidasSatelliteDecoder { } rec.setTraceId(traceId); - rec.setPersistenceTime(TimeTools.getSystemCalendar().getTime()); - rec.constructDataURI(); + rec.setPersistenceTime(TimeUtil.newGmtCalendar().getTime()); + rec.getDataURI(); rec.setOverwriteAllowed(true); // Set the data into the IDataRecord diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java b/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java index 88307cfb69..18eef955c8 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java @@ -59,6 +59,7 @@ import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.PathManagerFactory; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.wmo.AFOSProductId; import com.raytheon.uf.edex.database.cluster.ClusterLockUtils; import com.raytheon.uf.edex.database.cluster.ClusterTask; @@ -89,6 +90,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * 03Oct2012 15244 mgamazaychikov Added the fix to query the appropriate table * (operational or practice) * May 20, 2014 2536 bclement moved from edex.textdb to edex.plugin.text + * Sep 18, 2014 3627 mapeters Updated deprecated {@link TimeTools} usage. * * * @author garmendariz @@ -456,7 +458,7 @@ public class StdTextProductDao extends CoreDao { Map tmp = buildCriterions(ProdCCC_ID, ccc, ProdNNN_ID, nnn, ProdXXX_ID, xxx); long searchTime = System.currentTimeMillis() - pastHours - * TimeTools.MILLIS_HOUR; + * TimeUtil.MILLIS_PER_HOUR; Criteria criteria = session .createCriteria(getStdTextProductInstance().getClass());