public class DateSelection
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ARG_COUNT
url argument names
|
static java.lang.String |
ARG_ENDFIXEDTIME
url argument names
|
static java.lang.String |
ARG_ENDMODE
url argument names
|
static java.lang.String |
ARG_ENDOFFSET
url argument names
|
static java.lang.String |
ARG_INTERVAL
url argument names
|
static java.lang.String |
ARG_POSTRANGE
url argument names
|
static java.lang.String |
ARG_PRERANGE
url argument names
|
static java.lang.String |
ARG_ROUNDTO
url argument names
|
static java.lang.String |
ARG_SKIP
url argument names
|
static java.lang.String |
ARG_STARTFIXEDTIME
url argument names
|
static java.lang.String |
ARG_STARTMODE
url argument names
|
static java.lang.String |
ARG_STARTOFFSET
url argument names
|
boolean |
debug
debug flag
|
static java.lang.String[] |
ENDMODELABELS
Mode for constructing set
|
static int |
MAX_COUNT
maximum count
|
static java.lang.String[] |
STARTMODELABELS
Mode for constructing set
|
static int |
TIMEMODE_CURRENT
The mode for when we use the current time
|
static int |
TIMEMODE_DATA
Mode for using the first or last time in the data set.
|
static int |
TIMEMODE_FIXED
The mode for when we have an absolute time as a range bounds
|
static int |
TIMEMODE_RELATIVE
When one of the ranges is relative to another
|
static int[] |
TIMEMODES
Mode for constructing set
|
static java.lang.String[] |
TIMEMODESTRINGS
string ids for time modes
|
Constructor and Description |
---|
DateSelection()
ctor
|
DateSelection(boolean doAll)
ctor
|
DateSelection(boolean doLatest,
int count)
ctor
|
DateSelection(java.util.Date startTime,
java.util.Date endTime)
ctor
|
DateSelection(DateSelection that)
copy ctor
|
DateSelection(java.util.Hashtable<java.lang.String,java.lang.String> args)
ctor for instantiating a DateSelection object from a set of url argument originally created from toUrlString
|
DateSelection(int startMode,
double startOffset,
int endMode,
double endOffset)
Construct a DateSelection
|
Modifier and Type | Method and Description |
---|---|
java.util.List |
apply(java.util.List times)
Apply this date selection query to the list of DatedThing-s
|
boolean |
equals(java.lang.Object o)
equals method
|
int |
getCount()
Get the Count property.
|
boolean |
getDoAll()
Get the DoAll property.
|
boolean |
getDoLatest()
Get the DoLatest property.
|
java.util.Date |
getEndFixedDate()
get the property
|
long |
getEndFixedTime()
Get the EndFixedTime property.
|
int |
getEndMode()
Get the EndMode property.
|
double |
getEndOffset()
Get the EndOffset property.
|
double |
getInterval()
Get the Interval property.
|
double[] |
getIntervalTicks()
Generate an array of times for the interval
|
java.util.Date |
getNowTime()
Get the NowTime property.
|
int |
getNumTimesInRange()
Get the NumTimesInRange property.
|
double |
getPostRange()
Get the PostRange property.
|
double |
getPostRangeToUse()
Get the post interval range to use.
|
double |
getPreRange()
Get the PreRange property.
|
double |
getPreRangeToUse()
Get the pre interval range to use.
|
java.util.Date[] |
getRange()
Construct and return the start and end time range
|
java.util.Date[] |
getRange(java.util.List<DatedThing> dataTimes)
_more_
|
double |
getRoundTo()
Get the RoundTo property.
|
int |
getSkip()
Get the Skip property.
|
java.util.Date |
getStartFixedDate()
get the property
|
long |
getStartFixedTime()
Get the StartFixedTime property.
|
int |
getStartMode()
Get the StartMode property.
|
double |
getStartOffset()
Get the StartOffset property.
|
java.util.List |
getTimes()
Get the Times property.
|
void |
getUrlArgs(java.util.Hashtable<java.lang.String,java.lang.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 string
|
boolean |
hasCount()
Does this date selection have a valid count
|
int |
hashCode()
Get the hashcode for this object
|
boolean |
hasInterval()
Do we have an interval defined
|
boolean |
hasPostRange()
Do we have a post range defined
|
boolean |
hasPreRange()
Do we have a pre range defined
|
boolean |
isAll()
Select all things
|
boolean |
isLatest()
Select the most recent thing
|
static void |
main(java.lang.String[] cmdLineArgs)
test main
|
protected java.lang.Object |
makeTimeSet()
Create the time set
|
static double |
roundTo(double roundTo,
double milliSeconds)
Utility to round the given seconds
|
void |
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(java.util.Date d)
set property
|
void |
setEndFixedTime(long value)
Set the EndFixedTime property.
|
void |
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(java.util.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(java.util.Date d)
set property
|
void |
setStartFixedTime(long value)
Set the StartFixedTime property.
|
void |
setStartMode(int value)
Set the StartMode property.
|
void |
setStartOffset(double value)
Set the StartOffset property.
|
void |
setTimes(java.util.List value)
Set the Times property.
|
java.lang.String |
toString()
tostring
|
java.lang.String |
toUrlString()
Create a url string to encode this object
|
public static final java.lang.String ARG_STARTMODE
public static final java.lang.String ARG_ENDMODE
public static final java.lang.String ARG_STARTFIXEDTIME
public static final java.lang.String ARG_ENDFIXEDTIME
public static final java.lang.String ARG_STARTOFFSET
public static final java.lang.String ARG_ENDOFFSET
public static final java.lang.String ARG_POSTRANGE
public static final java.lang.String ARG_PRERANGE
public static final java.lang.String ARG_INTERVAL
public static final java.lang.String ARG_ROUNDTO
public static final java.lang.String ARG_COUNT
public static final java.lang.String ARG_SKIP
public boolean debug
public static final int TIMEMODE_FIXED
public static final int TIMEMODE_CURRENT
public static final int TIMEMODE_RELATIVE
public static final int TIMEMODE_DATA
public static java.lang.String[] TIMEMODESTRINGS
public static int[] TIMEMODES
public static java.lang.String[] STARTMODELABELS
public static java.lang.String[] ENDMODELABELS
public static final int MAX_COUNT
public DateSelection()
public DateSelection(java.util.Hashtable<java.lang.String,java.lang.String> args)
args
- set of name value pairs as created by getUrlArgspublic DateSelection(boolean doLatest, int count)
doLatest
- Do the count latest onescount
- the countpublic DateSelection(boolean doAll)
doAll
- Get all available.public DateSelection(int startMode, double startOffset, int endMode, double endOffset)
startMode
- starting time modestartOffset
- offset from start timeendMode
- end time modeendOffset
- offset from end timepublic DateSelection(java.util.Date startTime, java.util.Date endTime)
startTime
- start timeendTime
- end timepublic DateSelection(DateSelection that)
that
- object to copy frompublic double[] getIntervalTicks()
public java.util.List apply(java.util.List times)
times
- input list of DatedThing-spublic java.util.Date[] getRange()
public java.util.Date[] getRange(java.util.List<DatedThing> dataTimes)
dataTimes
- _more_public static double roundTo(double roundTo, double milliSeconds)
roundTo
- round tomilliSeconds
- time to roundprotected java.lang.Object makeTimeSet()
public void setStartMode(int value)
value
- The new value for StartModepublic int getStartMode()
public void setEndMode(int value)
value
- The new value for EndModepublic int getEndMode()
public boolean hasInterval()
public boolean hasPreRange()
public boolean hasPostRange()
public void setInterval(double value)
value
- The new value for Intervalpublic double getInterval()
public void setStartOffset(double value)
value
- The new value for StartOffsetpublic double getStartOffset()
public void setEndOffset(double value)
value
- The new value for EndOffsetpublic double getEndOffset()
public void setRoundTo(double value)
value
- The new value for RoundTopublic double getRoundTo()
public void setStartFixedTime(long value)
value
- The new value for StartFixedTimepublic void setStartFixedTime(java.util.Date d)
d
- propertypublic void setEndFixedTime(java.util.Date d)
d
- propertypublic java.util.Date getStartFixedDate()
public java.util.Date getEndFixedDate()
public long getStartFixedTime()
public void setEndFixedTime(long value)
value
- The new value for EndFixedTimepublic long getEndFixedTime()
public void setIntervalRange(double value)
value
- interval rangepublic void setPreRange(double value)
value
- The new value for PreRangepublic double getPreRangeToUse()
public double getPostRangeToUse()
public double getPreRange()
public void setPostRange(double value)
value
- The new value for PostRangepublic double getPostRange()
public void setCount(int value)
value
- The new value for Countpublic boolean hasCount()
public int getCount()
public void setNumTimesInRange(int value)
value
- The new value for NumTimesInRangepublic int getNumTimesInRange()
public void setTimes(java.util.List value)
value
- The new value for Timespublic java.util.List getTimes()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- object to checkpublic void setSkip(int value)
value
- The new value for Skippublic int getSkip()
public void setDoLatest(boolean value)
value
- The new value for DoLatestpublic boolean isLatest()
public boolean getDoLatest()
public void setDoAll(boolean value)
value
- The new value for DoAllpublic boolean isAll()
public boolean getDoAll()
public void setNowTime(java.util.Date value)
value
- The new value for NowTimepublic java.util.Date getNowTime()
public static void main(java.lang.String[] cmdLineArgs) throws java.lang.Exception
cmdLineArgs
- cmd line argsjava.lang.Exception
- on badnesspublic java.lang.String toString()
toString
in class java.lang.Object
public void getUrlArgs(java.util.Hashtable<java.lang.String,java.lang.String> args)
args
- put the name value pairs in herepublic java.lang.String toUrlString()