Package ucar.unidata.util
Class DateSelection
java.lang.Object
ucar.unidata.util.DateSelection
Holds state for constructing time based queries.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
url argument namesstatic final String
url argument namesstatic final String
url argument namesstatic final String
url argument namesstatic final String
url argument namesstatic final String
url argument namesstatic final String
url argument namesstatic final String
url argument namesstatic final String
url argument namesstatic final String
url argument namesstatic final String
url argument namesstatic final String
url argument namesboolean
debug flagstatic String[]
Mode for constructing setstatic final int
maximum countstatic String[]
Mode for constructing setstatic final int
The mode for when we use the current timestatic final int
Mode for using the first or last time in the data set.static final int
The mode for when we have an absolute time as a range boundsstatic final int
When one of the ranges is relative to anotherstatic int[]
Mode for constructing setstatic String[]
string ids for time modes -
Constructor Summary
ConstructorsConstructorDescriptionctorDateSelection
(boolean doAll) ctorDateSelection
(boolean doLatest, int count) ctorDateSelection
(int startMode, double startOffset, int endMode, double endOffset) Construct a DateSelectionDateSelection
(Date startTime, Date endTime) ctorDateSelection
(Hashtable<String, String> args) ctor for instantiating a DateSelection object from a set of url argument originally created from toUrlStringDateSelection
(DateSelection that) copy ctor -
Method Summary
Modifier and TypeMethodDescriptionApply this date selection query to the list of DatedThing-sboolean
equals methodint
getCount()
Get the Count property.boolean
getDoAll()
Get the DoAll property.boolean
Get the DoLatest property.get the propertylong
Get the EndFixedTime property.int
Get the EndMode property.double
Get the EndOffset property.double
Get the Interval property.double[]
Generate an array of times for the intervalGet the NowTime property.int
Get the NumTimesInRange property.double
Get the PostRange property.double
Get the post interval range to use.double
Get the PreRange property.double
Get the pre interval range to use.Date[]
getRange()
Construct and return the start and end time rangeDate[]
getRange
(List<DatedThing> dataTimes) _more_double
Get the RoundTo property.int
getSkip()
Get the Skip property.get the propertylong
Get the StartFixedTime property.int
Get the StartMode property.double
Get the StartOffset property.getTimes()
Get the Times property.void
getUrlArgs
(Hashtable<String, String> args) This adds to the hashtable the set of name/value pairs that allow us to create a new DateSelection from a url argument stringboolean
hasCount()
Does this date selection have a valid countint
hashCode()
Get the hashcode for this objectboolean
Do we have an interval definedboolean
Do we have a post range definedboolean
Do we have a pre range definedboolean
isAll()
Select all thingsboolean
isLatest()
Select the most recent thingstatic void
test mainprotected Object
Create the time setstatic double
roundTo
(double roundTo, double milliSeconds) Utility to round the given secondsvoid
setCount
(int value) Set the Count property.void
setDoAll
(boolean value) Set the DoAll property.void
setDoLatest
(boolean value) Set the DoLatest property.void
setEndFixedTime
(long value) Set the EndFixedTime property.void
set propertyvoid
setEndMode
(int value) Set the EndMode property.void
setEndOffset
(double value) Set the EndOffset property.void
setInterval
(double value) Set the Interval property.void
setIntervalRange
(double value) A utility method to set the pre and post range symmetrically.void
setNowTime
(Date value) Set the NowTime property.void
setNumTimesInRange
(int value) Set the NumTimesInRange property.void
setPostRange
(double value) Set the PostRange property.void
setPreRange
(double value) Set the PreRange property.void
setRoundTo
(double value) Set the RoundTo property.void
setSkip
(int value) Set the Skip property.void
setStartFixedTime
(long value) Set the StartFixedTime property.void
set propertyvoid
setStartMode
(int value) Set the StartMode property.void
setStartOffset
(double value) Set the StartOffset property.void
Set the Times property.toString()
tostringCreate a url string to encode this object
-
Field Details
-
ARG_STARTMODE
url argument names- See Also:
-
ARG_ENDMODE
url argument names- See Also:
-
ARG_STARTFIXEDTIME
url argument names- See Also:
-
ARG_ENDFIXEDTIME
url argument names- See Also:
-
ARG_STARTOFFSET
url argument names- See Also:
-
ARG_ENDOFFSET
url argument names- See Also:
-
ARG_POSTRANGE
url argument names- See Also:
-
ARG_PRERANGE
url argument names- See Also:
-
ARG_INTERVAL
url argument names- See Also:
-
ARG_ROUNDTO
url argument names- See Also:
-
ARG_COUNT
url argument names- See Also:
-
ARG_SKIP
url argument names- See Also:
-
debug
public boolean debugdebug flag -
TIMEMODE_FIXED
public static final int TIMEMODE_FIXEDThe mode for when we have an absolute time as a range bounds- See Also:
-
TIMEMODE_CURRENT
public static final int TIMEMODE_CURRENTThe mode for when we use the current time- See Also:
-
TIMEMODE_RELATIVE
public static final int TIMEMODE_RELATIVEWhen one of the ranges is relative to another- See Also:
-
TIMEMODE_DATA
public static final int TIMEMODE_DATAMode for using the first or last time in the data set. Not sure if this will be useful here- See Also:
-
TIMEMODESTRINGS
string ids for time modes -
TIMEMODES
public static int[] TIMEMODESMode for constructing set -
STARTMODELABELS
Mode for constructing set -
ENDMODELABELS
Mode for constructing set -
MAX_COUNT
public static final int MAX_COUNTmaximum count- See Also:
-
-
Constructor Details
-
DateSelection
public DateSelection()ctor -
DateSelection
ctor for instantiating a DateSelection object from a set of url argument originally created from toUrlString- Parameters:
args
- set of name value pairs as created by getUrlArgs
-
DateSelection
public DateSelection(boolean doLatest, int count) ctor- Parameters:
doLatest
- Do the count latest onescount
- the count
-
DateSelection
public DateSelection(boolean doAll) ctor- Parameters:
doAll
- Get all available.
-
DateSelection
public DateSelection(int startMode, double startOffset, int endMode, double endOffset) Construct a DateSelection- Parameters:
startMode
- starting time modestartOffset
- offset from start timeendMode
- end time modeendOffset
- offset from end time
-
DateSelection
ctor- Parameters:
startTime
- start timeendTime
- end time
-
DateSelection
copy ctor- Parameters:
that
- object to copy from
-
-
Method Details
-
getIntervalTicks
public double[] getIntervalTicks()Generate an array of times for the interval- Returns:
- intervals
-
apply
Apply this date selection query to the list of DatedThing-s- Parameters:
times
- input list of DatedThing-s- Returns:
- The filtered list
-
getRange
Construct and return the start and end time range- Returns:
- time range. If in doLatest or doAll mode this returns null
-
getRange
_more_- Parameters:
dataTimes
- _more_- Returns:
- _more_
-
roundTo
public static double roundTo(double roundTo, double milliSeconds) Utility to round the given seconds- Parameters:
roundTo
- round tomilliSeconds
- time to round- Returns:
- Rounded value
-
makeTimeSet
Create the time set- Returns:
- The time set
-
setStartMode
public void setStartMode(int value) Set the StartMode property.- Parameters:
value
- The new value for StartMode
-
getStartMode
public int getStartMode()Get the StartMode property.- Returns:
- The StartMode
-
setEndMode
public void setEndMode(int value) Set the EndMode property.- Parameters:
value
- The new value for EndMode
-
getEndMode
public int getEndMode()Get the EndMode property.- Returns:
- The EndMode
-
hasInterval
public boolean hasInterval()Do we have an interval defined- Returns:
- Have interval defined
-
hasPreRange
public boolean hasPreRange()Do we have a pre range defined- Returns:
- Is pre-range defined
-
hasPostRange
public boolean hasPostRange()Do we have a post range defined- Returns:
- Is post-range defined
-
setInterval
public void setInterval(double value) Set the Interval property.- Parameters:
value
- The new value for Interval
-
getInterval
public double getInterval()Get the Interval property.- Returns:
- The Interval
-
setStartOffset
public void setStartOffset(double value) Set the StartOffset property.- Parameters:
value
- The new value for StartOffset
-
getStartOffset
public double getStartOffset()Get the StartOffset property.- Returns:
- The StartOffset
-
setEndOffset
public void setEndOffset(double value) Set the EndOffset property.- Parameters:
value
- The new value for EndOffset
-
getEndOffset
public double getEndOffset()Get the EndOffset property.- Returns:
- The EndOffset
-
setRoundTo
public void setRoundTo(double value) Set the RoundTo property.- Parameters:
value
- The new value for RoundTo
-
getRoundTo
public double getRoundTo()Get the RoundTo property.- Returns:
- The RoundTo
-
setStartFixedTime
public void setStartFixedTime(long value) Set the StartFixedTime property.- Parameters:
value
- The new value for StartFixedTime
-
setStartFixedTime
set property- Parameters:
d
- property
-
setEndFixedTime
set property- Parameters:
d
- property
-
getStartFixedDate
get the property- Returns:
- property
-
getEndFixedDate
get the property- Returns:
- property
-
getStartFixedTime
public long getStartFixedTime()Get the StartFixedTime property.- Returns:
- The StartFixedTime
-
setEndFixedTime
public void setEndFixedTime(long value) Set the EndFixedTime property.- Parameters:
value
- The new value for EndFixedTime
-
getEndFixedTime
public long getEndFixedTime()Get the EndFixedTime property.- Returns:
- The EndFixedTime
-
setIntervalRange
public void setIntervalRange(double value) A utility method to set the pre and post range symmetrically. Each are set with half of the given value- Parameters:
value
- interval range
-
setPreRange
public void setPreRange(double value) Set the PreRange property.- Parameters:
value
- The new value for PreRange
-
getPreRangeToUse
public double getPreRangeToUse()Get the pre interval range to use. If we have a preRange then return that, else, return half of the interval.- Returns:
- The pre range to use
-
getPostRangeToUse
public double getPostRangeToUse()Get the post interval range to use. If we have a postRange then return that, else, return half of the interval.- Returns:
- The post range to use
-
getPreRange
public double getPreRange()Get the PreRange property.- Returns:
- The PreRange
-
setPostRange
public void setPostRange(double value) Set the PostRange property.- Parameters:
value
- The new value for PostRange
-
getPostRange
public double getPostRange()Get the PostRange property.- Returns:
- The PostRange
-
setCount
public void setCount(int value) Set the Count property.- Parameters:
value
- The new value for Count
-
hasCount
public boolean hasCount()Does this date selection have a valid count- Returns:
- has a count
-
getCount
public int getCount()Get the Count property.- Returns:
- The Count
-
setNumTimesInRange
public void setNumTimesInRange(int value) Set the NumTimesInRange property.- Parameters:
value
- The new value for NumTimesInRange
-
getNumTimesInRange
public int getNumTimesInRange()Get the NumTimesInRange property.- Returns:
- The NumTimesInRange
-
setTimes
Set the Times property.- Parameters:
value
- The new value for Times
-
getTimes
Get the Times property.- Returns:
- The Times
-
hashCode
public int hashCode()Get the hashcode for this object -
equals
equals method -
setSkip
public void setSkip(int value) Set the Skip property.- Parameters:
value
- The new value for Skip
-
getSkip
public int getSkip()Get the Skip property.- Returns:
- The Skip
-
setDoLatest
public void setDoLatest(boolean value) Set the DoLatest property.- Parameters:
value
- The new value for DoLatest
-
isLatest
public boolean isLatest()Select the most recent thing- Returns:
- select the most recent thing
-
getDoLatest
public boolean getDoLatest()Get the DoLatest property.- Returns:
- The DoLatest
-
setDoAll
public void setDoAll(boolean value) Set the DoAll property.- Parameters:
value
- The new value for DoAll
-
isAll
public boolean isAll()Select all things- Returns:
- select all things
-
getDoAll
public boolean getDoAll()Get the DoAll property.- Returns:
- The DoAll
-
setNowTime
Set the NowTime property.- Parameters:
value
- The new value for NowTime
-
getNowTime
Get the NowTime property.- Returns:
- The NowTime
-
main
test main- Parameters:
cmdLineArgs
- cmd line args- Throws:
Exception
- on badness
-
toString
tostring -
getUrlArgs
This adds to the hashtable the set of name/value pairs that allow us to create a new DateSelection from a url argument string- Parameters:
args
- put the name value pairs in here
-
toUrlString
Create a url string to encode this object- Returns:
- the url string
-