TimeRule (API Reference)
Class TimeRule
Used to indicate a time period of one or more intervals in GDF specification. For example: -*(M3f21h2){M9}(M11f12h2){-M9}+(h15){h2}(h20){h2}, which represents: March 2nd Sunday 02h:00m for 9 months ONLY DURING November 1st Sunday 02h:00m from 9 months ago BUT NOT from 15:00 to 17:00 OR 20:00 to 22:00
The operator * represents reccuring occurrence, + represents a logical OR operation and - represents exclusion meaning, BUT NOT operations.
This example string represents a time period that meets the following criteria:
M3f21h2: M3 denotes third month of the year, i.e. March, f2 stands for the second Sunday of the month (as "f" might indicate "first", "second", "third", etc.), 1 stands for the day of the week (1...7, Day of week, Sunday = day 1), and h2 represents the hour of the day (02:00) in 24 hour format.{M9}: This denotes "for 9 months", with "M9" standing for nine months. The brackets {} indicate a duration.M11f12h2: M11 denotes 11th month of the year, i.e. November, f1 stands for the first Monday of the month, 2 stands for the day of the week (1...7, Day of week, Monday = day 2), and h2 represents the hour of the day (02:00) in 24 hour format.- {-M9}: This denotes "9 months ago from the current stated time", with "-M9" standing for nine months in the past.
(h15){h2}(h20){h2}: 15:00 to 17:00 OR 20:00 to 22:00 The brackets {} denotes duration, and the negative sign - represents a past duration.
Note: The time period is a logical AND (&&) combination of two components or points in time and it only applies if a point in time is in both components.
For more advanced examples of TimeRule see here.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanGets the value of day saving time specification, as a string in ISO 14825 format, for the location where the time rule applies.Gets the value of time rule as a string in ISO 14825 format.intGets the value of time zone offset in seconds for the location where the time rule applies.inthashCode()
-
Constructor Details
-
TimeRule
Creates a new instance of this class.
- Parameters:
timeRule-The time rule as a string in ISO 14825 format.
timeZoneOffsetSeconds-The time zone offset in seconds for the location where the time rule applies.
dstSpec-Day saving time specification, as a string in ISO 14825 format, for the location where the time rule applies.
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
appliesTo
- Parameters:
dateTime-date and time that should be used for rule verification.
- Returns:
trueif the time domain rules applies to the given date and time.,false- otherwise.
-
getTimeRuleString
Gets the value of time rule as a string in ISO 14825 format.
- Returns:
The time rule as a string in ISO 14825 format.
-
getTimeZoneOffsetSeconds
public int getTimeZoneOffsetSeconds()Gets the value of time zone offset in seconds for the location where the time rule applies.
- Returns:
The time zone offset in seconds for the location where the time rule applies.
-
getDstSpec
Gets the value of day saving time specification, as a string in ISO 14825 format, for the location where the time rule applies.
- Returns:
Day saving time specification, as a string in ISO 14825 format, for the location where the time rule applies.
-