Package hec.model
Class RunTimeWindow
java.lang.Object
hec.model.RunTimeWindow
- All Implemented Interfaces:
AsciiSerializable
,FieldAccessor
,Serializable
,Cloneable
Contains data that defines the time window for model execution.
This object is passed to model alternatives when there compute method is called.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptioncontruct a new RunTimeWindow with values set to undefinedRunTimeWindow
(HecTime start, HecTime end, HecTime lookback) contruct a new RunTimeWindow with the specified times.contruct a new RunTimeWindow from the specified RunTimeWindow -
Method Summary
Modifier and TypeMethodDescriptionclone()
boolean
boolean
get the end date (no time) as a Stringget the end time (hour and minutes) as a Stringget the end timeget the end date and time as a Stringget the extract start timegetFieldObject
(Field fld) This method allows access to java.lang.reflect.Field objects within the implementing class.int
get the lookback date (no time) as a Stringget the look back time (hours and minutes) as a Stringget the look back timeget the lookback date and time as a Stringint
return the number of whole years in the runtimewindowdouble
return the number of years in the runtimewindow with any fractional part in the decimalint
get the number of lookback steps in the RunTimeWindowint
return the number of routing stepsint
get the number of steps in the RunTimeWindowgetRunTimeStepAtTime
(HecTime time) get the RunTimeStep at time for this RunTimeWindowget the start date as a Stringget the start time (hour minutes) as a Stringget the start timeget the start date time as a Stringint
getStepAtTime
(HecTime time) get the step at time.getTimeAtStep
(int i) gets the time at step iint
int
get the time increment, one ofHecTime.SECOND_INCREMENT
,HecTime.MINUTE_INCREMENT
,HecTime.HOUR_INCREMENT
, orHecTime.DAY_INCREMENT
return the string representation of the time increment.int
get the time stepstatic int[]
getTimeStep
(String str) get the time step and time step increment for the timestep stringint
get the time step in secondsint
get the time step in secondsstatic int
getTimeStepSeconds
(int timeStep, int timeStepIncrement) given the time step and time step increment return the time step in secondsgetTimeStepString
(int format) get the time step value and units as a string (for example 1HOUR)static String
getTimeStepString
(int timeStep, int timeIncrement) getTimeStringAtStep
(int timeStep) get the time at step timeStep as a Stringget a string representation of the time window from lookback to end time.int
hashCode()
boolean
boolean
isValid()
check to see if the RunTimeWindow is valuestatic void
void
set the times of the runtimewindow.void
setEndTime
(HecTime end) set the end timevoid
setEndTime
(String timestr) set the end timeboolean
setFieldObject
(Field fld, Object fobj) This allows access to fields withing the implementing object to set there data.void
setLookbackTime
(HecTime lookback) set the lookback timevoid
setLookbackTime
(String timestr) set the lookback timevoid
setNumLookbackSteps
(int numSteps) set the number of lookback stepsvoid
setNumRoutingSteps
(int numSteps) set the number of routing stepsvoid
setPeriodAvgTimeStep
(boolean b) void
setShowTimeAsBeginningOfDay
(boolean b) void
setStartTime
(HecTime start) set the start timevoid
setStartTime
(String timestr) set the start timevoid
setTimeBlockIndex
(int index) void
setTimeStep
(int dt, int inc) set the time stepvoid
setTimeStep
(String str) set the time step and time increment by a stringtoString()
return the string representation of the RunTimeWindow
-
Field Details
-
_incrementString
time increment names setup to match HecTime -
INCR_SEC
public static final int INCR_SEC- See Also:
-
INCR_MIN
public static final int INCR_MIN- See Also:
-
INCR_HOUR
public static final int INCR_HOUR- See Also:
-
INCR_DAY
public static final int INCR_DAY- See Also:
-
-
Constructor Details
-
RunTimeWindow
public RunTimeWindow()contruct a new RunTimeWindow with values set to undefined -
RunTimeWindow
contruct a new RunTimeWindow with the specified times.- Parameters:
start
- the start timeend
- the end timelookback
- the lookback time
-
RunTimeWindow
contruct a new RunTimeWindow from the specified RunTimeWindow- Parameters:
rtw
- the RunTimeWindow to initialize from
-
-
Method Details
-
setShowTimeAsBeginningOfDay
public void setShowTimeAsBeginningOfDay(boolean b) -
isPerAvgTimeStep
public boolean isPerAvgTimeStep() -
setPeriodAvgTimeStep
public void setPeriodAvgTimeStep(boolean b) -
getTimeBlockIndex
public int getTimeBlockIndex() -
setTimeBlockIndex
public void setTimeBlockIndex(int index) -
getNumRoutingSteps
public int getNumRoutingSteps()return the number of routing steps- Returns:
- integer number of routing steps
-
setNumRoutingSteps
public void setNumRoutingSteps(int numSteps) set the number of routing steps- Parameters:
numSteps
-
-
isValid
public boolean isValid()check to see if the RunTimeWindow is value- Returns:
- false if the RunTimeWindow is not valid
-
getNumSteps
public int getNumSteps()get the number of steps in the RunTimeWindow- Returns:
- the number of step or
RMAConst.UNDEF_INT
if the RunTimeWindow isn't valid
-
setNumLookbackSteps
public void setNumLookbackSteps(int numSteps) set the number of lookback steps- Parameters:
numSteps
- the number of lookback steps
-
getNumLookbackSteps
public int getNumLookbackSteps()get the number of lookback steps in the RunTimeWindow- Returns:
- the number of lookback steps or
RMAConst.UNDEF_INT
if the RunTimeWindow isn't valid
-
getForecastSteps
public int getForecastSteps() -
computeSteps
public boolean computeSteps() -
setTimeStep
public void setTimeStep(int dt, int inc) set the time step- Parameters:
dt
- the timestepinc
- the time increment one ofHecTime.SECOND_INCREMENT
,HecTime.MINUTE_INCREMENT
,HecTime.HOUR_INCREMENT
, orHecTime.DAY_INCREMENT
-
setTimeStep
set the time step and time increment by a string -
getTimeStep
get the time step and time step increment for the timestep string- Parameters:
str
- the timestep string i.e. 1 HOUR or 1HOUR- Returns:
- [0] the time step, [1] the time step increment
-
getTimeStepSeconds
public static int getTimeStepSeconds(int timeStep, int timeStepIncrement) given the time step and time step increment return the time step in seconds- Parameters:
timeStep
- the time steptimeStepIncrement
- the time step increment (i.e. HecTime.HOUR_INCREMENT)- Returns:
- the time step in seconds
-
getTimeStep
public int getTimeStep()get the time step- Returns:
- the time step
-
getTimeStepSeconds
public int getTimeStepSeconds()get the time step in seconds- Returns:
- the time step in seconds
-
getTimeStepMinutes
public int getTimeStepMinutes()get the time step in seconds- Returns:
- the time step in minutes
-
getTimeIncrement
public int getTimeIncrement()get the time increment, one ofHecTime.SECOND_INCREMENT
,HecTime.MINUTE_INCREMENT
,HecTime.HOUR_INCREMENT
, orHecTime.DAY_INCREMENT
- Returns:
- the time increment
-
getTimeIncrementString
return the string representation of the time increment.- Returns:
- the time increment string or the empty string
-
getTimeStepString
get the time step value and units as a string (for example 1HOUR)- Parameters:
format
- 0 no space between time step and time increment (1HOUR) 1 space between time step and time increment (1 HOUR)- Returns:
- the time step/time increment
-
getTimeWindowString
get a string representation of the time window from lookback to end time.- Returns:
- the time window as a string (lookback end);
-
setStartTime
set the start time- Parameters:
start
- the new start time
-
setStartTime
set the start time- Parameters:
timestr
- a date time string that is parsable be HecTime
-
getStartTime
get the start time- Returns:
- the start time
-
getStartDateString
get the start date as a String- Returns:
- the start date String
-
getStartHrMinString
get the start time (hour minutes) as a String- Returns:
- the start time String
-
getStartTimeString
get the start date time as a String- Returns:
- the start date time String
-
setEndTime
set the end time- Parameters:
end
- the new end time
-
setEndTime
set the end time- Parameters:
timestr
- a date time string that is parsable by HecTime
-
getEndTime
get the end time- Returns:
- the end time
-
getEndDateString
get the end date (no time) as a String- Returns:
- the end date
-
getEndHrMinString
get the end time (hour and minutes) as a String- Returns:
- the end time
-
getEndTimeString
get the end date and time as a String- Returns:
- the date and time
-
setLookbackTime
set the lookback time- Parameters:
lookback
- the new lookback time
-
setLookbackTime
set the lookback time- Parameters:
timestr
- a date time string that is parsable by HecTime
-
getLookbackTime
get the look back time- Returns:
- the lookback time
-
getLookbackDateString
get the lookback date (no time) as a String- Returns:
- the look back date
-
getLookbackHrMinString
get the look back time (hours and minutes) as a String- Returns:
- the look back time
-
getLookbackTimeString
get the lookback date and time as a String- Returns:
- the lookback date and time
-
getRunTimeStepAtTime
get the RunTimeStep at time for this RunTimeWindow- Parameters:
time
- the time to get the RunTimeStep for- Returns:
- the RunTimeStep for time or null if time is null or undefined
-
getTimeAtStep
gets the time at step i- Parameters:
i
- the time step to get the time at- Returns:
- the time at step or null if the RunTimeWindow isn't valid
-
getStepAtTime
get the step at time. This could return a negative step if the step is before this RunTimeWindow- Parameters:
time
- the HecTime to get the step for- Returns:
- the step at time.
-
getTimeStringAtStep
get the time at step timeStep as a String- Parameters:
timeStep
- the timeStep to get the time for- Returns:
- the time at timeStep or if not valid timeStep as a String
-
toString
return the string representation of the RunTimeWindow -
getFieldObject
Description copied from interface:FieldAccessor
This method allows access to java.lang.reflect.Field objects within the implementing class.- Specified by:
getFieldObject
in interfaceFieldAccessor
- Parameters:
fld
- The field to get.- Returns:
- The data object that is stored in the given field
-
setFieldObject
Description copied from interface:FieldAccessor
This allows access to fields withing the implementing object to set there data.- Specified by:
setFieldObject
in interfaceFieldAccessor
- Parameters:
fld
- The java field object representing the member field to be setfobj
- The data to set in that field- Returns:
- returns true if successful
-
main
-
getTimeStepString
-
set
set the times of the runtimewindow.times
should be 1 or more HecTime compatible strings separated by semicolons. i.e. 20Jan1999 1400; the order of parsing is if there are 3 times then the first is the lookback then the start and then the end if there are 2 times then its considered the start and end if there is just 1 time then its considered the start time.- Parameters:
times
-
-
getNumberOfYears
public int getNumberOfYears()return the number of whole years in the runtimewindow- Returns:
- the number of whole years
-
getNumberOfYearsWithFraction
public double getNumberOfYearsWithFraction()return the number of years in the runtimewindow with any fractional part in the decimal- Returns:
- the number of years
-
getExtractStartTime
get the extract start time- Returns:
- null by default. Its here for subclasses to use
-
clone
-
hashCode
public int hashCode() -
equals
-