src/model/RunPeriodControlDaylightSavingTime.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "RunPeriodControlDaylightSavingTime.hpp" | ||
| 7 | #include "RunPeriodControlDaylightSavingTime_Impl.hpp" | ||
| 8 | #include "YearDescription.hpp" | ||
| 9 | #include "YearDescription_Impl.hpp" | ||
| 10 | #include "Model.hpp" | ||
| 11 | #include "Model_Impl.hpp" | ||
| 12 | |||
| 13 | #include <utilities/idd/OS_RunPeriodControl_DaylightSavingTime_FieldEnums.hxx> | ||
| 14 | #include <utilities/idd/IddEnums.hxx> | ||
| 15 | |||
| 16 | #include "../utilities/time/Date.hpp" | ||
| 17 | #include "../utilities/core/Assert.hpp" | ||
| 18 | |||
| 19 | namespace openstudio { | ||
| 20 | namespace model { | ||
| 21 | |||
| 22 | namespace detail { | ||
| 23 | |||
| 24 | 27 | RunPeriodControlDaylightSavingTime_Impl::RunPeriodControlDaylightSavingTime_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 25 | 27 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 26 |
4/6✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
✓ Branch 7 taken 27 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 27 times.
✗ Branch 13 not taken.
|
27 | OS_ASSERT(idfObject.iddObject().type() == RunPeriodControlDaylightSavingTime::iddObjectType()); |
| 27 | |||
| 28 |
3/3✓ Branch 1 taken 27 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 10 times.
|
27 | if (isEmpty(OS_RunPeriodControl_DaylightSavingTimeFields::StartDate)) { |
| 29 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
|
34 | bool result = setString(OS_RunPeriodControl_DaylightSavingTimeFields::StartDate, "2nd Sunday in March"); |
| 30 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
✗ Branch 3 not taken.
|
17 | OS_ASSERT(result); |
| 31 | } | ||
| 32 |
3/3✓ Branch 1 taken 27 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 10 times.
|
27 | if (isEmpty(OS_RunPeriodControl_DaylightSavingTimeFields::EndDate)) { |
| 33 |
2/2✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
|
34 | bool result = setString(OS_RunPeriodControl_DaylightSavingTimeFields::EndDate, "1st Sunday in November"); |
| 34 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
✗ Branch 3 not taken.
|
17 | OS_ASSERT(result); |
| 35 | } | ||
| 36 | 27 | } | |
| 37 | |||
| 38 | 10 | RunPeriodControlDaylightSavingTime_Impl::RunPeriodControlDaylightSavingTime_Impl(const openstudio::detail::WorkspaceObject_Impl& other, | |
| 39 | 10 | Model_Impl* model, bool keepHandle) | |
| 40 | 10 | : ModelObject_Impl(other, model, keepHandle) { | |
| 41 |
4/6✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 10 times.
✗ Branch 13 not taken.
|
10 | OS_ASSERT(other.iddObject().type() == RunPeriodControlDaylightSavingTime::iddObjectType()); |
| 42 | 10 | } | |
| 43 | |||
| 44 | 6 | RunPeriodControlDaylightSavingTime_Impl::RunPeriodControlDaylightSavingTime_Impl(const RunPeriodControlDaylightSavingTime_Impl& other, | |
| 45 | 6 | Model_Impl* model, bool keepHandle) | |
| 46 | 6 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 47 | |||
| 48 | 1 | boost::optional<ParentObject> RunPeriodControlDaylightSavingTime_Impl::parent() const { | |
| 49 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | boost::optional<ParentObject> result(model().getOptionalUniqueModelObject<YearDescription>()); |
| 50 | 1 | return result; | |
| 51 | } | ||
| 52 | |||
| 53 | ✗ | bool RunPeriodControlDaylightSavingTime_Impl::setParent(ParentObject& newParent) { | |
| 54 | ✗ | if (newParent.optionalCast<YearDescription>() && (newParent.model() == model())) { | |
| 55 | ✗ | return true; | |
| 56 | } | ||
| 57 | ✗ | return false; | |
| 58 | } | ||
| 59 | |||
| 60 | ✗ | const std::vector<std::string>& RunPeriodControlDaylightSavingTime_Impl::outputVariableNames() const { | |
| 61 | ✗ | static const std::vector<std::string> result; | |
| 62 | ✗ | return result; | |
| 63 | } | ||
| 64 | |||
| 65 | ✗ | IddObjectType RunPeriodControlDaylightSavingTime_Impl::iddObjectType() const { | |
| 66 | ✗ | return RunPeriodControlDaylightSavingTime::iddObjectType(); | |
| 67 | } | ||
| 68 | |||
| 69 | 3 | openstudio::Date RunPeriodControlDaylightSavingTime_Impl::startDate() const { | |
| 70 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<std::string> text = getString(OS_RunPeriodControl_DaylightSavingTimeFields::StartDate); |
| 71 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(text); |
| 72 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | return getDate(*text); |
| 73 | 3 | } | |
| 74 | |||
| 75 | 5 | boost::optional<openstudio::NthDayOfWeekInMonth> RunPeriodControlDaylightSavingTime_Impl::startNthDayOfWeekInMonth() const { | |
| 76 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<std::string> text = getString(OS_RunPeriodControl_DaylightSavingTimeFields::StartDate); |
| 77 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(text); |
| 78 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | return getNthDayOfWeekInMonth(*text); |
| 79 | 5 | } | |
| 80 | |||
| 81 | 3 | openstudio::Date RunPeriodControlDaylightSavingTime_Impl::endDate() const { | |
| 82 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<std::string> text = getString(OS_RunPeriodControl_DaylightSavingTimeFields::EndDate); |
| 83 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
|
3 | OS_ASSERT(text); |
| 84 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | return getDate(*text); |
| 85 | 3 | } | |
| 86 | |||
| 87 | 5 | boost::optional<openstudio::NthDayOfWeekInMonth> RunPeriodControlDaylightSavingTime_Impl::endNthDayOfWeekInMonth() const { | |
| 88 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<std::string> text = getString(OS_RunPeriodControl_DaylightSavingTimeFields::EndDate); |
| 89 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(text); |
| 90 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
10 | return getNthDayOfWeekInMonth(*text); |
| 91 | 5 | } | |
| 92 | |||
| 93 | 11 | bool RunPeriodControlDaylightSavingTime_Impl::setStartDate(const std::string& startDate) { | |
| 94 | 11 | bool result = false; | |
| 95 | try { | ||
| 96 |
1/1✓ Branch 1 taken 11 times.
|
11 | getDate(startDate); |
| 97 |
1/1✓ Branch 1 taken 11 times.
|
11 | result = setString(OS_RunPeriodControl_DaylightSavingTimeFields::StartDate, startDate); |
| 98 | ✗ | } catch (...) { | |
| 99 | ✗ | } | |
| 100 | 11 | return result; | |
| 101 | } | ||
| 102 | |||
| 103 | 1 | bool RunPeriodControlDaylightSavingTime_Impl::setStartDate(const openstudio::MonthOfYear& monthOfYear, unsigned day) { | |
| 104 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::stringstream ss; |
| 105 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | ss << monthOfYear.value() << "/" << day; |
| 106 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | return setString(OS_RunPeriodControl_DaylightSavingTimeFields::StartDate, ss.str()); |
| 107 | 1 | } | |
| 108 | |||
| 109 | 1 | bool RunPeriodControlDaylightSavingTime_Impl::setStartDate(const openstudio::NthDayOfWeekInMonth& nth, const openstudio::DayOfWeek& dayOfWeek, | |
| 110 | const openstudio::MonthOfYear& monthOfYear) { | ||
| 111 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::stringstream ss; |
| 112 |
2/7✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
1 | switch (nth.value()) { |
| 113 | ✗ | case NthDayOfWeekInMonth::first: | |
| 114 | ✗ | ss << "1st " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription(); | |
| 115 | ✗ | break; | |
| 116 | ✗ | case NthDayOfWeekInMonth::second: | |
| 117 | ✗ | ss << "2nd " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription(); | |
| 118 | ✗ | break; | |
| 119 | ✗ | case NthDayOfWeekInMonth::third: | |
| 120 | ✗ | ss << "3rd " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription(); | |
| 121 | ✗ | break; | |
| 122 | ✗ | case NthDayOfWeekInMonth::fourth: | |
| 123 | ✗ | ss << "4th " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription(); | |
| 124 | ✗ | break; | |
| 125 | 1 | case NthDayOfWeekInMonth::fifth: | |
| 126 |
6/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
|
1 | ss << "Last " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription(); |
| 127 | 1 | break; | |
| 128 | ✗ | default: | |
| 129 | ✗ | OS_ASSERT(false); | |
| 130 | } | ||
| 131 | |||
| 132 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | return setString(OS_RunPeriodControl_DaylightSavingTimeFields::StartDate, ss.str()); |
| 133 | 1 | } | |
| 134 | |||
| 135 | 11 | bool RunPeriodControlDaylightSavingTime_Impl::setEndDate(const std::string& endDate) { | |
| 136 | 11 | bool result = false; | |
| 137 | try { | ||
| 138 |
1/1✓ Branch 1 taken 11 times.
|
11 | getDate(endDate); |
| 139 |
1/1✓ Branch 1 taken 11 times.
|
11 | result = setString(OS_RunPeriodControl_DaylightSavingTimeFields::EndDate, endDate); |
| 140 | ✗ | } catch (...) { | |
| 141 | ✗ | } | |
| 142 | 11 | return result; | |
| 143 | } | ||
| 144 | |||
| 145 | 1 | bool RunPeriodControlDaylightSavingTime_Impl::setEndDate(const openstudio::MonthOfYear& monthOfYear, unsigned day) { | |
| 146 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::stringstream ss; |
| 147 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | ss << monthOfYear.value() << "/" << day; |
| 148 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | return setString(OS_RunPeriodControl_DaylightSavingTimeFields::EndDate, ss.str()); |
| 149 | 1 | } | |
| 150 | |||
| 151 | 1 | bool RunPeriodControlDaylightSavingTime_Impl::setEndDate(const openstudio::NthDayOfWeekInMonth& nth, const openstudio::DayOfWeek& dayOfWeek, | |
| 152 | const openstudio::MonthOfYear& monthOfYear) { | ||
| 153 |
1/1✓ Branch 1 taken 1 time.
|
1 | std::stringstream ss; |
| 154 |
2/7✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
1 | switch (nth.value()) { |
| 155 | ✗ | case NthDayOfWeekInMonth::first: | |
| 156 | ✗ | ss << "1st " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription(); | |
| 157 | ✗ | break; | |
| 158 | ✗ | case NthDayOfWeekInMonth::second: | |
| 159 | ✗ | ss << "2nd " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription(); | |
| 160 | ✗ | break; | |
| 161 | ✗ | case NthDayOfWeekInMonth::third: | |
| 162 | ✗ | ss << "3rd " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription(); | |
| 163 | ✗ | break; | |
| 164 | ✗ | case NthDayOfWeekInMonth::fourth: | |
| 165 | ✗ | ss << "4th " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription(); | |
| 166 | ✗ | break; | |
| 167 | 1 | case NthDayOfWeekInMonth::fifth: | |
| 168 |
6/6✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
|
1 | ss << "Last " << dayOfWeek.valueName() << " in " << monthOfYear.valueDescription(); |
| 169 | 1 | break; | |
| 170 | ✗ | default: | |
| 171 | ✗ | OS_ASSERT(false); | |
| 172 | } | ||
| 173 | |||
| 174 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | return setString(OS_RunPeriodControl_DaylightSavingTimeFields::EndDate, ss.str()); |
| 175 | 1 | } | |
| 176 | |||
| 177 | ✗ | void RunPeriodControlDaylightSavingTime_Impl::ensureNoLeapDays() { | |
| 178 | ✗ | LOG(Warn, "Ensure no leap days is not yet implemented for run control daylight saving time"); | |
| 179 | ✗ | } | |
| 180 | |||
| 181 | 28 | openstudio::Date RunPeriodControlDaylightSavingTime_Impl::getDate(const std::string& text) const { | |
| 182 |
1/1✓ Branch 1 taken 28 times.
|
28 | Date result; |
| 183 |
2/2✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
|
28 | YearDescription yd = this->model().getUniqueModelObject<YearDescription>(); |
| 184 | |||
| 185 | /* | ||
| 186 | \note <number>/<number> (month/day) | ||
| 187 | \note <number> <Month> | ||
| 188 | \note <Month> <number> | ||
| 189 | \note <Nth> <Weekday> in <Month) | ||
| 190 | \note Last <WeekDay> in <Month> | ||
| 191 | \note <Month> can be January, February, March, April, May, June, July, August, September, October, November, December | ||
| 192 | \note Months can be the first 3 letters of the month | ||
| 193 | \note <Weekday> can be Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday | ||
| 194 | \note <Nth> can be 1 or 1st, 2 or 2nd, etc. up to 5(?) | ||
| 195 | */ | ||
| 196 |
1/1✓ Branch 1 taken 28 times.
|
28 | boost::smatch matches; |
| 197 |
4/4✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 26 times.
|
28 | if (boost::regex_search(text, matches, boost::regex("(\\d+)\\s?\\/\\s?(\\d+)"))) { |
| 198 | |||
| 199 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | std::string monthString(matches[1].first, matches[1].second); |
| 200 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | MonthOfYear monthOfYear(boost::lexical_cast<unsigned>(monthString)); |
| 201 | |||
| 202 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | std::string dayOfMonthString(matches[2].first, matches[2].second); |
| 203 |
1/1✓ Branch 1 taken 2 times.
|
2 | auto dayOfMonth = boost::lexical_cast<unsigned>(dayOfMonthString); |
| 204 | |||
| 205 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | result = yd.makeDate(monthOfYear, dayOfMonth); |
| 206 |
1/1✓ Branch 1 taken 2 times.
|
2 | return result; |
| 207 |
1/1✓ Branch 3 taken 26 times.
|
28 | } else if (boost::regex_search(text, matches, |
| 208 |
2/3✓ Branch 1 taken 26 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 26 times.
|
52 | boost::regex("(\\d+)\\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|January|February|March|April|May|June|" |
| 209 | "July|August|September|October|November|December)", | ||
| 210 | boost::regex::icase))) { | ||
| 211 | |||
| 212 | ✗ | std::string dayOfMonthString(matches[1].first, matches[1].second); | |
| 213 | ✗ | auto dayOfMonth = boost::lexical_cast<unsigned>(dayOfMonthString); | |
| 214 | ✗ | std::string monthString(matches[2].first, matches[2].second); | |
| 215 | |||
| 216 | ✗ | result = yd.makeDate(monthOfYear(monthString), dayOfMonth); | |
| 217 | ✗ | return result; | |
| 218 |
1/1✓ Branch 3 taken 26 times.
|
26 | } else if (boost::regex_search(text, matches, |
| 219 |
2/3✓ Branch 1 taken 26 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 26 times.
|
52 | boost::regex("(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|January|February|March|April|May|June|July|" |
| 220 | "August|September|October|November|December)\\s+(\\d+)", | ||
| 221 | boost::regex::icase))) { | ||
| 222 | |||
| 223 | ✗ | std::string monthString(matches[1].first, matches[1].second); | |
| 224 | ✗ | std::string dayOfMonthString(matches[2].first, matches[2].second); | |
| 225 | ✗ | auto dayOfMonth = boost::lexical_cast<unsigned>(dayOfMonthString); | |
| 226 | |||
| 227 | ✗ | result = yd.makeDate(monthOfYear(monthString), dayOfMonth); | |
| 228 | ✗ | return result; | |
| 229 |
1/1✓ Branch 3 taken 26 times.
|
26 | } else if (boost::regex_search(text, matches, |
| 230 |
2/3✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✗ Branch 5 not taken.
|
52 | boost::regex("(1|2|3|4|5|1st|2nd|3rd|4th|5th|Last)\\s+(Sun|Mon|Tue|Wed|Thu|Fri|Sat|Sunday|Monday|Tuesday|" |
| 231 | "Wednesday|Thursday|Friday|Saturday)\\s+in\\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|" | ||
| 232 | "January|February|March|April|May|June|July|August|September|October|November|December)", | ||
| 233 | boost::regex::icase))) { | ||
| 234 | |||
| 235 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
|
52 | std::string nthString(matches[1].first, matches[1].second); |
| 236 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
|
52 | std::string dayOfWeekString(matches[2].first, matches[2].second); |
| 237 |
3/3✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
|
26 | std::string monthString(matches[3].first, matches[3].second); |
| 238 | |||
| 239 |
5/5✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
✓ Branch 7 taken 26 times.
✓ Branch 10 taken 26 times.
✓ Branch 13 taken 26 times.
|
26 | result = yd.makeDate(nthDayOfWeekInMonth(nthString), dayOfWeek(dayOfWeekString), monthOfYear(monthString)); |
| 240 |
1/1✓ Branch 1 taken 26 times.
|
26 | return result; |
| 241 | 26 | } | |
| 242 | |||
| 243 | ✗ | LOG_AND_THROW("Could not determine date for startDate = '" << text << "'"); | |
| 244 | return {}; | ||
| 245 | 28 | } | |
| 246 | |||
| 247 | 10 | boost::optional<openstudio::NthDayOfWeekInMonth> RunPeriodControlDaylightSavingTime_Impl::getNthDayOfWeekInMonth(const std::string& text) const { | |
| 248 | 10 | boost::optional<openstudio::NthDayOfWeekInMonth> result; | |
| 249 |
1/1✓ Branch 1 taken 10 times.
|
10 | boost::smatch matches; |
| 250 |
1/1✓ Branch 1 taken 10 times.
|
10 | if (boost::regex_search(text, matches, |
| 251 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 8 times.
✓ Branch 5 taken 2 times.
|
20 | boost::regex("(1|2|3|4|5|1st|2nd|3rd|4th|5th|Last)\\s+(Sun|Mon|Tue|Wed|Thu|Fri|Sat|Sunday|Monday|Tuesday|Wednesday|" |
| 252 | "Thursday|Friday|Saturday)\\s+in\\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|January|February|" | ||
| 253 | "March|April|May|June|July|August|September|October|November|December)", | ||
| 254 | boost::regex::icase))) { | ||
| 255 |
3/3✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
|
8 | std::string nthString(matches[1].first, matches[1].second); |
| 256 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | result = nthDayOfWeekInMonth(nthString); |
| 257 | 8 | } | |
| 258 | 20 | return result; | |
| 259 | 10 | } | |
| 260 | |||
| 261 | } // namespace detail | ||
| 262 | |||
| 263 | 7683 | IddObjectType RunPeriodControlDaylightSavingTime::iddObjectType() { | |
| 264 |
1/1✓ Branch 1 taken 7683 times.
|
7683 | IddObjectType result(IddObjectType::OS_RunPeriodControl_DaylightSavingTime); |
| 265 | 7683 | return result; | |
| 266 | } | ||
| 267 | |||
| 268 | 3 | openstudio::Date RunPeriodControlDaylightSavingTime::startDate() const { | |
| 269 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::RunPeriodControlDaylightSavingTime_Impl>()->startDate(); |
| 270 | } | ||
| 271 | |||
| 272 | 5 | boost::optional<openstudio::NthDayOfWeekInMonth> RunPeriodControlDaylightSavingTime::startNthDayOfWeekInMonth() const { | |
| 273 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::RunPeriodControlDaylightSavingTime_Impl>()->startNthDayOfWeekInMonth(); |
| 274 | } | ||
| 275 | |||
| 276 | 3 | openstudio::Date RunPeriodControlDaylightSavingTime::endDate() const { | |
| 277 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::RunPeriodControlDaylightSavingTime_Impl>()->endDate(); |
| 278 | } | ||
| 279 | |||
| 280 | 5 | boost::optional<openstudio::NthDayOfWeekInMonth> RunPeriodControlDaylightSavingTime::endNthDayOfWeekInMonth() const { | |
| 281 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::RunPeriodControlDaylightSavingTime_Impl>()->endNthDayOfWeekInMonth(); |
| 282 | } | ||
| 283 | |||
| 284 | 11 | bool RunPeriodControlDaylightSavingTime::setStartDate(const std::string& startDate) { | |
| 285 |
1/1✓ Branch 3 taken 11 times.
|
11 | return getImpl<detail::RunPeriodControlDaylightSavingTime_Impl>()->setStartDate(startDate); |
| 286 | } | ||
| 287 | |||
| 288 | 1 | bool RunPeriodControlDaylightSavingTime::setStartDate(const openstudio::MonthOfYear& monthOfYear, unsigned day) { | |
| 289 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::RunPeriodControlDaylightSavingTime_Impl>()->setStartDate(monthOfYear, day); |
| 290 | } | ||
| 291 | |||
| 292 | 1 | bool RunPeriodControlDaylightSavingTime::setStartDate(const openstudio::NthDayOfWeekInMonth& nth, const openstudio::DayOfWeek& dayOfWeek, | |
| 293 | const openstudio::MonthOfYear& monthOfYear) { | ||
| 294 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::RunPeriodControlDaylightSavingTime_Impl>()->setStartDate(nth, dayOfWeek, monthOfYear); |
| 295 | } | ||
| 296 | |||
| 297 | 11 | bool RunPeriodControlDaylightSavingTime::setEndDate(const std::string& endDate) { | |
| 298 |
1/1✓ Branch 3 taken 11 times.
|
11 | return getImpl<detail::RunPeriodControlDaylightSavingTime_Impl>()->setEndDate(endDate); |
| 299 | } | ||
| 300 | |||
| 301 | 1 | bool RunPeriodControlDaylightSavingTime::setEndDate(const openstudio::MonthOfYear& monthOfYear, unsigned day) { | |
| 302 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::RunPeriodControlDaylightSavingTime_Impl>()->setEndDate(monthOfYear, day); |
| 303 | } | ||
| 304 | |||
| 305 | 1 | bool RunPeriodControlDaylightSavingTime::setEndDate(const openstudio::NthDayOfWeekInMonth& nth, const openstudio::DayOfWeek& dayOfWeek, | |
| 306 | const openstudio::MonthOfYear& monthOfYear) { | ||
| 307 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::RunPeriodControlDaylightSavingTime_Impl>()->setEndDate(nth, dayOfWeek, monthOfYear); |
| 308 | } | ||
| 309 | |||
| 310 | ✗ | void RunPeriodControlDaylightSavingTime::ensureNoLeapDays() { | |
| 311 | ✗ | getImpl<detail::RunPeriodControlDaylightSavingTime_Impl>()->ensureNoLeapDays(); | |
| 312 | ✗ | } | |
| 313 | |||
| 314 | /// @cond | ||
| 315 | 15 | RunPeriodControlDaylightSavingTime::RunPeriodControlDaylightSavingTime(std::shared_ptr<detail::RunPeriodControlDaylightSavingTime_Impl> impl) | |
| 316 |
1/1✓ Branch 3 taken 15 times.
|
15 | : ModelObject(std::move(impl)) {} |
| 317 | |||
| 318 | 17 | RunPeriodControlDaylightSavingTime::RunPeriodControlDaylightSavingTime(Model& model) | |
| 319 | 17 | : ModelObject(RunPeriodControlDaylightSavingTime::iddObjectType(), model) {} | |
| 320 | |||
| 321 | /// @endcond | ||
| 322 | |||
| 323 | } // namespace model | ||
| 324 | } // namespace openstudio | ||
| 325 |