GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 83.1% 419 / 0 / 504
Functions: 87.9% 80 / 0 / 91
Branches: 60.4% 418 / 0 / 692

src/model/ScheduleRule.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 "ScheduleRule.hpp"
7 #include "ScheduleRule_Impl.hpp"
8 #include "ScheduleRuleset.hpp"
9 #include "ScheduleRuleset_Impl.hpp"
10 #include "ScheduleDay.hpp"
11 #include "ScheduleDay_Impl.hpp"
12 #include "ScheduleTypeLimits.hpp"
13 #include "YearDescription.hpp"
14 #include "YearDescription_Impl.hpp"
15 #include "Model.hpp"
16 #include "Model_Impl.hpp"
17 #include "ModelExtensibleGroup.hpp"
18
19 #include "../utilities/time/Date.hpp"
20
21 #include <utilities/idd/IddFactory.hxx>
22
23 #include <utilities/idd/OS_Schedule_Rule_FieldEnums.hxx>
24 #include <utilities/idd/IddEnums.hxx>
25
26 #include "../utilities/core/Assert.hpp"
27
28 namespace openstudio {
29 namespace model {
30
31 namespace detail {
32
33 3758 ScheduleRule_Impl::ScheduleRule_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
34 3758 : ParentObject_Impl(idfObject, model, keepHandle) {
35
4/6
✓ Branch 1 taken 3758 times.
✓ Branch 4 taken 3758 times.
✓ Branch 7 taken 3758 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3758 times.
✗ Branch 13 not taken.
3758 OS_ASSERT(idfObject.iddObject().type() == ScheduleRule::iddObjectType());
36 3758 }
37
38 908 ScheduleRule_Impl::ScheduleRule_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
39 908 : ParentObject_Impl(other, model, keepHandle) {
40
4/6
✓ Branch 1 taken 908 times.
✓ Branch 4 taken 908 times.
✓ Branch 7 taken 908 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 908 times.
✗ Branch 13 not taken.
908 OS_ASSERT(other.iddObject().type() == ScheduleRule::iddObjectType());
41 908 }
42
43 1460 ScheduleRule_Impl::ScheduleRule_Impl(const ScheduleRule_Impl& other, Model_Impl* model, bool keepHandle)
44 1460 : ParentObject_Impl(other, model, keepHandle) {}
45
46 56 boost::optional<ParentObject> ScheduleRule_Impl::parent() const {
47
2/2
✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
56 return this->scheduleRuleset();
48 }
49
50 40 bool ScheduleRule_Impl::setParent(ParentObject& newParent) {
51 40 bool result = false;
52
2/3
✓ Branch 1 taken 40 times.
✓ Branch 4 taken 40 times.
✗ Branch 5 not taken.
80 if (newParent.optionalCast<ScheduleRuleset>()) {
53
2/2
✓ Branch 1 taken 40 times.
✓ Branch 4 taken 40 times.
40 result = setPointer(OS_Schedule_RuleFields::ScheduleRulesetName, newParent.handle());
54 }
55 40 return result;
56 }
57
58 56 std::vector<ResourceObject> ScheduleRule_Impl::resources() const {
59 // remove daySchedule as a resource so it can be a child
60
1/1
✓ Branch 1 taken 56 times.
56 ResourceObjectVector result = ModelObject_Impl::resources();
61
1/1
✓ Branch 1 taken 56 times.
56 ScheduleDay daySchedule = this->daySchedule();
62 56 auto it = result.begin();
63
1/2
✓ Branch 2 taken 56 times.
✗ Branch 3 not taken.
56 while (it != result.end()) {
64
2/3
✓ Branch 2 taken 56 times.
✓ Branch 4 taken 56 times.
✗ Branch 5 not taken.
56 if ((*it) == daySchedule) {
65
1/1
✓ Branch 2 taken 56 times.
56 result.erase(it);
66 56 break;
67 }
68 ✗ ++it;
69 }
70 112 return result;
71 56 }
72
73 56 std::vector<ModelObject> ScheduleRule_Impl::children() const {
74 56 std::vector<ModelObject> result;
75 // daySchedule can be a child (appropriate for .clone()), because removed from .resources() list.
76
2/3
✓ Branch 1 taken 56 times.
✓ Branch 3 taken 56 times.
✗ Branch 4 not taken.
112 if (OptionalScheduleDay schedule = optionalDaySchedule()) {
77
2/2
✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
56 result.push_back(*schedule);
78 56 }
79 56 return result;
80 ✗ }
81
82 ✗ std::vector<IdfObject> ScheduleRule_Impl::remove() {
83 ✗ auto self = this->getObject<ScheduleRule>();
84 ✗ ScheduleRuleset scheduleRuleset = this->scheduleRuleset();
85 ✗ scheduleRuleset.moveToEnd(self);
86
87 ✗ return ParentObject_Impl::remove();
88 ✗ }
89
90 16 const std::vector<std::string>& ScheduleRule_Impl::outputVariableNames() const {
91
3/4
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 15 times.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
16 static const std::vector<std::string> result;
92 16 return result;
93 }
94
95 16 IddObjectType ScheduleRule_Impl::iddObjectType() const {
96 16 return ScheduleRule::iddObjectType();
97 }
98
99 63 ScheduleRuleset ScheduleRule_Impl::scheduleRuleset() const {
100
2/2
✓ Branch 1 taken 63 times.
✓ Branch 4 taken 63 times.
63 OptionalScheduleRuleset result = getObject<ScheduleRule>().getModelObjectTarget<ScheduleRuleset>(OS_Schedule_RuleFields::ScheduleRulesetName);
101
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 63 times.
✗ Branch 4 not taken.
63 OS_ASSERT(result);
102
2/2
✓ Branch 1 taken 63 times.
✓ Branch 4 taken 63 times.
126 return *result;
103 63 }
104
105 14525 int ScheduleRule_Impl::ruleIndex() const {
106
1/1
✓ Branch 1 taken 14525 times.
14525 boost::optional<int> value = getInt(OS_Schedule_RuleFields::RuleOrder, true);
107
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 14525 times.
✗ Branch 4 not taken.
14525 OS_ASSERT(value);
108
1/1
✓ Branch 1 taken 14525 times.
29050 return value.get();
109 }
110
111 19495 ScheduleDay ScheduleRule_Impl::daySchedule() const {
112
1/1
✓ Branch 1 taken 19495 times.
19495 OptionalScheduleDay result = optionalDaySchedule();
113
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 19495 times.
19495 if (!result) {
114 ✗ LOG_AND_THROW(briefDescription() << " has been corrupted. It no longer points to an " << "OS:Schedule:Day object.");
115 }
116
2/2
✓ Branch 1 taken 19495 times.
✓ Branch 4 taken 19495 times.
38990 return *result;
117 19495 }
118
119 668 bool ScheduleRule_Impl::applySunday() const {
120
1/1
✓ Branch 1 taken 668 times.
668 boost::optional<std::string> value = getString(OS_Schedule_RuleFields::ApplySunday, true);
121
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 668 times.
✗ Branch 4 not taken.
668 OS_ASSERT(value);
122
3/3
✓ Branch 1 taken 668 times.
✓ Branch 4 taken 668 times.
✓ Branch 7 taken 668 times.
1336 return openstudio::istringEqual(value.get(), "Yes");
123 668 }
124
125 680 bool ScheduleRule_Impl::applyMonday() const {
126
1/1
✓ Branch 1 taken 680 times.
680 boost::optional<std::string> value = getString(OS_Schedule_RuleFields::ApplyMonday, true);
127
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 680 times.
✗ Branch 4 not taken.
680 OS_ASSERT(value);
128
3/3
✓ Branch 1 taken 680 times.
✓ Branch 4 taken 680 times.
✓ Branch 7 taken 680 times.
1360 return openstudio::istringEqual(value.get(), "Yes");
129 680 }
130
131 673 bool ScheduleRule_Impl::applyTuesday() const {
132
1/1
✓ Branch 1 taken 673 times.
673 boost::optional<std::string> value = getString(OS_Schedule_RuleFields::ApplyTuesday, true);
133
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 673 times.
✗ Branch 4 not taken.
673 OS_ASSERT(value);
134
3/3
✓ Branch 1 taken 673 times.
✓ Branch 4 taken 673 times.
✓ Branch 7 taken 673 times.
1346 return openstudio::istringEqual(value.get(), "Yes");
135 673 }
136
137 671 bool ScheduleRule_Impl::applyWednesday() const {
138
1/1
✓ Branch 1 taken 671 times.
671 boost::optional<std::string> value = getString(OS_Schedule_RuleFields::ApplyWednesday, true);
139
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 4 not taken.
671 OS_ASSERT(value);
140
3/3
✓ Branch 1 taken 671 times.
✓ Branch 4 taken 671 times.
✓ Branch 7 taken 671 times.
1342 return openstudio::istringEqual(value.get(), "Yes");
141 671 }
142
143 671 bool ScheduleRule_Impl::applyThursday() const {
144
1/1
✓ Branch 1 taken 671 times.
671 boost::optional<std::string> value = getString(OS_Schedule_RuleFields::ApplyThursday, true);
145
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 671 times.
✗ Branch 4 not taken.
671 OS_ASSERT(value);
146
3/3
✓ Branch 1 taken 671 times.
✓ Branch 4 taken 671 times.
✓ Branch 7 taken 671 times.
1342 return openstudio::istringEqual(value.get(), "Yes");
147 671 }
148
149 670 bool ScheduleRule_Impl::applyFriday() const {
150
1/1
✓ Branch 1 taken 670 times.
670 boost::optional<std::string> value = getString(OS_Schedule_RuleFields::ApplyFriday, true);
151
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 670 times.
✗ Branch 4 not taken.
670 OS_ASSERT(value);
152
3/3
✓ Branch 1 taken 670 times.
✓ Branch 4 taken 670 times.
✓ Branch 7 taken 670 times.
1340 return openstudio::istringEqual(value.get(), "Yes");
153 670 }
154
155 676 bool ScheduleRule_Impl::applySaturday() const {
156
1/1
✓ Branch 1 taken 676 times.
676 boost::optional<std::string> value = getString(OS_Schedule_RuleFields::ApplySaturday, true);
157
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 676 times.
✗ Branch 4 not taken.
676 OS_ASSERT(value);
158
3/3
✓ Branch 1 taken 676 times.
✓ Branch 4 taken 676 times.
✓ Branch 7 taken 676 times.
1352 return openstudio::istringEqual(value.get(), "Yes");
159 676 }
160
161 647 std::string ScheduleRule_Impl::dateSpecificationType() const {
162
1/1
✓ Branch 1 taken 647 times.
647 boost::optional<std::string> value = getString(OS_Schedule_RuleFields::DateSpecificationType, true);
163
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 647 times.
✗ Branch 4 not taken.
647 OS_ASSERT(value);
164
2/2
✓ Branch 1 taken 647 times.
✓ Branch 4 taken 647 times.
1294 return value.get();
165 647 }
166
167 685 boost::optional<openstudio::Date> ScheduleRule_Impl::startDate() const {
168 685 boost::optional<openstudio::Date> result;
169
1/1
✓ Branch 1 taken 685 times.
685 boost::optional<std::string> dateSpecificationType = this->getString(OS_Schedule_RuleFields::DateSpecificationType, true);
170
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 685 times.
✗ Branch 4 not taken.
685 OS_ASSERT(dateSpecificationType);
171
5/5
✓ Branch 1 taken 685 times.
✓ Branch 4 taken 685 times.
✓ Branch 7 taken 685 times.
✓ Branch 10 taken 684 times.
✓ Branch 11 taken 1 time.
2055 if (istringEqual("DateRange", *dateSpecificationType)) {
172
1/1
✓ Branch 1 taken 684 times.
684 boost::optional<int> startMonth = this->getInt(OS_Schedule_RuleFields::StartMonth, true);
173
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 684 times.
✗ Branch 4 not taken.
684 OS_ASSERT(startMonth);
174
1/1
✓ Branch 1 taken 684 times.
684 boost::optional<int> startDay = this->getInt(OS_Schedule_RuleFields::StartDay, true);
175
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 684 times.
✗ Branch 4 not taken.
684 OS_ASSERT(startDay);
176
2/2
✓ Branch 1 taken 684 times.
✓ Branch 4 taken 684 times.
684 YearDescription yd = this->model().getUniqueModelObject<model::YearDescription>();
177
5/5
✓ Branch 1 taken 684 times.
✓ Branch 4 taken 684 times.
✓ Branch 7 taken 684 times.
✓ Branch 10 taken 684 times.
✓ Branch 13 taken 684 times.
684 result = yd.makeDate(MonthOfYear(*startMonth), *startDay);
178 684 }
179
180 1370 return result;
181 685 }
182
183 685 boost::optional<openstudio::Date> ScheduleRule_Impl::endDate() const {
184 685 boost::optional<openstudio::Date> result;
185
1/1
✓ Branch 1 taken 685 times.
685 boost::optional<std::string> dateSpecificationType = this->getString(OS_Schedule_RuleFields::DateSpecificationType, true);
186
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 685 times.
✗ Branch 4 not taken.
685 OS_ASSERT(dateSpecificationType);
187
5/5
✓ Branch 1 taken 685 times.
✓ Branch 4 taken 685 times.
✓ Branch 7 taken 685 times.
✓ Branch 10 taken 684 times.
✓ Branch 11 taken 1 time.
2055 if (istringEqual("DateRange", *dateSpecificationType)) {
188
1/1
✓ Branch 1 taken 684 times.
684 boost::optional<int> endMonth = this->getInt(OS_Schedule_RuleFields::EndMonth, true);
189
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 684 times.
✗ Branch 4 not taken.
684 OS_ASSERT(endMonth);
190
1/1
✓ Branch 1 taken 684 times.
684 boost::optional<int> endDay = this->getInt(OS_Schedule_RuleFields::EndDay, true);
191
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 684 times.
✗ Branch 4 not taken.
684 OS_ASSERT(endDay);
192
2/2
✓ Branch 1 taken 684 times.
✓ Branch 4 taken 684 times.
684 YearDescription yd = this->model().getUniqueModelObject<model::YearDescription>();
193
5/5
✓ Branch 1 taken 684 times.
✓ Branch 4 taken 684 times.
✓ Branch 7 taken 684 times.
✓ Branch 10 taken 684 times.
✓ Branch 13 taken 684 times.
684 result = yd.makeDate(MonthOfYear(*endMonth), *endDay);
194 684 }
195
196 1370 return result;
197 685 }
198
199 5 std::vector<openstudio::Date> ScheduleRule_Impl::specificDates() const {
200
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 YearDescription yd = this->model().getUniqueModelObject<model::YearDescription>();
201
202 5 std::vector<openstudio::Date> result;
203
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 11 taken 3 times.
✓ Branch 12 taken 5 times.
8 for (const ModelExtensibleGroup& group : castVector<ModelExtensibleGroup>(extensibleGroups())) {
204
1/1
✓ Branch 1 taken 3 times.
3 OptionalInt month = group.getInt(0);
205
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
3 OS_ASSERT(month);
206
1/1
✓ Branch 1 taken 3 times.
3 OptionalInt day = group.getInt(1);
207
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
3 OS_ASSERT(day);
208
209
5/5
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
3 result.push_back(yd.makeDate(MonthOfYear(*month), *day));
210 5 }
211
212 10 return result;
213 5 }
214
215 7187 bool ScheduleRule_Impl::setRuleIndex(int index) {
216 7187 bool result = setInt(OS_Schedule_RuleFields::RuleOrder, index);
217 7187 return result;
218 }
219
220 74 bool ScheduleRule_Impl::setApplySunday(bool applySunday) {
221 74 bool result = false;
222
2/2
✓ Branch 0 taken 67 times.
✓ Branch 1 taken 7 times.
74 if (applySunday) {
223
2/2
✓ Branch 1 taken 67 times.
✓ Branch 4 taken 67 times.
201 result = setString(OS_Schedule_RuleFields::ApplySunday, "Yes");
224 } else {
225
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
21 result = setString(OS_Schedule_RuleFields::ApplySunday, "No");
226 }
227
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
74 OS_ASSERT(result);
228 74 return result;
229 }
230
231 1419 bool ScheduleRule_Impl::setApplyMonday(bool applyMonday) {
232 1419 bool result = false;
233
2/2
✓ Branch 0 taken 1410 times.
✓ Branch 1 taken 9 times.
1419 if (applyMonday) {
234
2/2
✓ Branch 1 taken 1410 times.
✓ Branch 4 taken 1410 times.
4230 result = setString(OS_Schedule_RuleFields::ApplyMonday, "Yes");
235 } else {
236
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
27 result = setString(OS_Schedule_RuleFields::ApplyMonday, "No");
237 }
238
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1419 times.
1419 OS_ASSERT(result);
239 1419 return result;
240 }
241
242 1418 bool ScheduleRule_Impl::setApplyTuesday(bool applyTuesday) {
243 1418 bool result = false;
244
2/2
✓ Branch 0 taken 1411 times.
✓ Branch 1 taken 7 times.
1418 if (applyTuesday) {
245
2/2
✓ Branch 1 taken 1411 times.
✓ Branch 4 taken 1411 times.
4233 result = setString(OS_Schedule_RuleFields::ApplyTuesday, "Yes");
246 } else {
247
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
21 result = setString(OS_Schedule_RuleFields::ApplyTuesday, "No");
248 }
249
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1418 times.
1418 OS_ASSERT(result);
250 1418 return result;
251 }
252
253 1418 bool ScheduleRule_Impl::setApplyWednesday(bool applyWednesday) {
254 1418 bool result = false;
255
2/2
✓ Branch 0 taken 1409 times.
✓ Branch 1 taken 9 times.
1418 if (applyWednesday) {
256
2/2
✓ Branch 1 taken 1409 times.
✓ Branch 4 taken 1409 times.
4227 result = setString(OS_Schedule_RuleFields::ApplyWednesday, "Yes");
257 } else {
258
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
27 result = setString(OS_Schedule_RuleFields::ApplyWednesday, "No");
259 }
260
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1418 times.
1418 OS_ASSERT(result);
261 1418 return result;
262 }
263
264 1418 bool ScheduleRule_Impl::setApplyThursday(bool applyThursday) {
265 1418 bool result = false;
266
2/2
✓ Branch 0 taken 1411 times.
✓ Branch 1 taken 7 times.
1418 if (applyThursday) {
267
2/2
✓ Branch 1 taken 1411 times.
✓ Branch 4 taken 1411 times.
4233 result = setString(OS_Schedule_RuleFields::ApplyThursday, "Yes");
268 } else {
269
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
21 result = setString(OS_Schedule_RuleFields::ApplyThursday, "No");
270 }
271
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1418 times.
1418 OS_ASSERT(result);
272 1418 return result;
273 }
274
275 1418 bool ScheduleRule_Impl::setApplyFriday(bool applyFriday) {
276 1418 bool result = false;
277
2/2
✓ Branch 0 taken 1411 times.
✓ Branch 1 taken 7 times.
1418 if (applyFriday) {
278
2/2
✓ Branch 1 taken 1411 times.
✓ Branch 4 taken 1411 times.
4233 result = setString(OS_Schedule_RuleFields::ApplyFriday, "Yes");
279 } else {
280
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
21 result = setString(OS_Schedule_RuleFields::ApplyFriday, "No");
281 }
282
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1418 times.
1418 OS_ASSERT(result);
283 1418 return result;
284 }
285
286 1418 bool ScheduleRule_Impl::setApplySaturday(bool applySaturday) {
287 1418 bool result = false;
288
2/2
✓ Branch 0 taken 1411 times.
✓ Branch 1 taken 7 times.
1418 if (applySaturday) {
289
2/2
✓ Branch 1 taken 1411 times.
✓ Branch 4 taken 1411 times.
4233 result = setString(OS_Schedule_RuleFields::ApplySaturday, "Yes");
290 } else {
291
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
21 result = setString(OS_Schedule_RuleFields::ApplySaturday, "No");
292 }
293
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1418 times.
1418 OS_ASSERT(result);
294 1418 return result;
295 }
296
297 18 bool ScheduleRule_Impl::applyWeekdays() const {
298
7/10
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 5 taken 2 times.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 8 times.
✗ Branch 14 not taken.
18 return (this->applyMonday() && this->applyTuesday() && this->applyWednesday() && this->applyThursday() && this->applyFriday());
299 }
300
301 13 bool ScheduleRule_Impl::applyWeekends() const {
302
3/4
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 8 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
13 return (this->applySaturday() && this->applySunday());
303 }
304
305 9 bool ScheduleRule_Impl::applyAllDays() const {
306
4/4
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 5 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 2 times.
9 return (this->applyWeekdays() && this->applyWeekends());
307 }
308
309 5 bool ScheduleRule_Impl::setApplyWeekdays(bool applyWeekdays) {
310
2/4
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 5 times.
✗ Branch 6 not taken.
10 return (this->setApplyMonday(applyWeekdays) && this->setApplyTuesday(applyWeekdays) && this->setApplyWednesday(applyWeekdays)
311
3/6
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
10 && this->setApplyThursday(applyWeekdays) && this->setApplyFriday(applyWeekdays));
312 }
313
314 4 bool ScheduleRule_Impl::setApplyWeekends(bool applyWeekends) {
315
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 return (this->setApplySaturday(applyWeekends) && this->setApplySunday(applyWeekends));
316 }
317
318 2 bool ScheduleRule_Impl::setApplyAllDays(bool applyAllDays) {
319
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 return (this->setApplyWeekdays(applyAllDays) && this->setApplyWeekends(applyAllDays));
320 }
321
322 85 bool ScheduleRule_Impl::setStartDate(const openstudio::Date& date) {
323
2/2
✓ Branch 1 taken 85 times.
✓ Branch 4 taken 85 times.
170 bool result = setString(OS_Schedule_RuleFields::DateSpecificationType, "DateRange");
324
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 85 times.
85 OS_ASSERT(result);
325
3/3
✓ Branch 1 taken 85 times.
✓ Branch 4 taken 85 times.
✓ Branch 7 taken 85 times.
85 result = this->setInt(OS_Schedule_RuleFields::StartMonth, date.monthOfYear().value());
326
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 85 times.
85 OS_ASSERT(result);
327 85 result = this->setInt(OS_Schedule_RuleFields::StartDay, date.dayOfMonth());
328
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 85 times.
85 OS_ASSERT(result);
329
330 // set end date if need to
331
2/6
✗ Branch 1 not taken.
✓ Branch 2 taken 85 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 85 times.
✗ Branch 7 not taken.
85 if (this->isEmpty(OS_Schedule_RuleFields::EndMonth) || this->isEmpty(OS_Schedule_RuleFields::EndDay)) {
332
3/3
✓ Branch 1 taken 85 times.
✓ Branch 4 taken 85 times.
✓ Branch 7 taken 85 times.
85 this->setEndDate(openstudio::Date(MonthOfYear::Dec, 31));
333 }
334
335 // clear specific dates
336
1/1
✓ Branch 1 taken 85 times.
85 this->clearExtensibleGroups();
337 85 return true;
338 }
339
340 169 bool ScheduleRule_Impl::setEndDate(const openstudio::Date& date) {
341
2/2
✓ Branch 1 taken 169 times.
✓ Branch 4 taken 169 times.
338 bool result = setString(OS_Schedule_RuleFields::DateSpecificationType, "DateRange", false);
342
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 169 times.
169 OS_ASSERT(result);
343
3/3
✓ Branch 1 taken 169 times.
✓ Branch 4 taken 169 times.
✓ Branch 7 taken 169 times.
169 result = this->setInt(OS_Schedule_RuleFields::EndMonth, date.monthOfYear().value());
344
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 169 times.
169 OS_ASSERT(result);
345 169 result = this->setInt(OS_Schedule_RuleFields::EndDay, date.dayOfMonth());
346
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 169 times.
169 OS_ASSERT(result);
347
348 // set end date if need to
349
3/6
✓ Branch 1 taken 169 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 169 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 169 times.
169 if (this->isEmpty(OS_Schedule_RuleFields::StartMonth) || this->isEmpty(OS_Schedule_RuleFields::StartDay)) {
350 ✗ this->setStartDate(openstudio::Date(MonthOfYear::Jan, 1));
351 }
352
353 // clear specific dates
354
1/1
✓ Branch 1 taken 169 times.
169 this->clearExtensibleGroups();
355 169 return true;
356 }
357
358 1 bool ScheduleRule_Impl::addSpecificDate(const openstudio::Date& date) {
359
360
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 bool result = setString(OS_Schedule_RuleFields::DateSpecificationType, "SpecificDates", false);
361
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
1 OS_ASSERT(result);
362
363
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 result = setString(OS_Schedule_RuleFields::StartMonth, "", false);
364
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
1 OS_ASSERT(result);
365
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 result = setString(OS_Schedule_RuleFields::StartDay, "", false);
366
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
1 OS_ASSERT(result);
367
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 result = setString(OS_Schedule_RuleFields::EndMonth, "", false);
368
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
1 OS_ASSERT(result);
369
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 result = setString(OS_Schedule_RuleFields::EndDay, "", false);
370
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
1 OS_ASSERT(result);
371
372
4/6
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 1 time.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
5 std::vector<std::string> values{std::to_string(date.monthOfYear().value()), std::to_string(date.dayOfMonth())};
373
374
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 auto group = pushExtensibleGroup(values, true).cast<ModelExtensibleGroup>();
375
2/4
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
✗ Branch 6 not taken.
1 OS_ASSERT(!group.empty());
376
377 1 return true;
378 3 }
379
380 ✗ void ScheduleRule_Impl::ensureNoLeapDays() {
381 ✗ boost::optional<int> month;
382 ✗ boost::optional<int> day;
383
384 ✗ month = getInt(OS_Schedule_RuleFields::StartMonth);
385 ✗ if (month && (month.get() == 2)) {
386 ✗ day = this->getInt(OS_Schedule_RuleFields::StartDay);
387 ✗ if (day && (day.get() == 29)) {
388 ✗ this->setInt(OS_Schedule_RuleFields::StartDay, 28);
389 }
390 }
391
392 ✗ month = getInt(OS_Schedule_RuleFields::EndMonth);
393 ✗ if (month && (month.get() == 2)) {
394 ✗ day = this->getInt(OS_Schedule_RuleFields::EndDay);
395 ✗ if (day && (day.get() == 29)) {
396 ✗ this->setInt(OS_Schedule_RuleFields::EndDay, 28);
397 }
398 }
399
400 ✗ for (const IdfExtensibleGroup& group : this->extensibleGroups()) {
401 ✗ boost::optional<int> month;
402 ✗ boost::optional<int> day;
403
404 ✗ month = group.getInt(OS_Schedule_RuleExtensibleFields::SpecificMonth);
405 ✗ if (month && (month.get() == 2)) {
406 ✗ day = group.getInt(OS_Schedule_RuleExtensibleFields::SpecificDay);
407 ✗ if (day && (day.get() == 29)) {
408 ✗ this->setInt(OS_Schedule_RuleExtensibleFields::SpecificDay, 28);
409 }
410 }
411 ✗ }
412 ✗ }
413
414 14 bool ScheduleRule_Impl::containsDate(const openstudio::Date& date) {
415 14 bool result = false;
416
417 // need to check or adjust assumed base year on input date?
418
419
1/1
✓ Branch 1 taken 14 times.
14 boost::optional<std::string> dateSpecificationType = this->getString(OS_Schedule_RuleFields::DateSpecificationType, true);
420
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 4 not taken.
14 OS_ASSERT(dateSpecificationType);
421
4/5
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
✗ Branch 11 not taken.
42 if (istringEqual("DateRange", *dateSpecificationType)) {
422
1/1
✓ Branch 1 taken 14 times.
14 boost::optional<openstudio::Date> startDate = this->startDate();
423
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 4 not taken.
14 OS_ASSERT(startDate);
424
1/1
✓ Branch 1 taken 14 times.
14 boost::optional<openstudio::Date> endDate = this->endDate();
425
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 4 not taken.
14 OS_ASSERT(endDate);
426
4/5
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 9 taken 14 times.
✗ Branch 10 not taken.
14 if (*startDate <= *endDate) {
427
7/8
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 6 taken 12 times.
✓ Branch 7 taken 2 times.
✓ Branch 9 taken 12 times.
✓ Branch 12 taken 12 times.
✓ Branch 14 taken 12 times.
✗ Branch 15 not taken.
14 result = ((date >= *startDate) && (date <= *endDate));
428 } else {
429 ✗ result = ((date >= *startDate) || (date <= *endDate));
430 }
431 14 } else {
432 ✗ std::vector<openstudio::Date> specificDates = this->specificDates();
433 ✗ for (const openstudio::Date& specificDate : specificDates) {
434 ✗ if (specificDate == date) {
435 ✗ result = true;
436 ✗ break;
437 }
438 }
439 ✗ }
440
441
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 2 times.
14 if (result) {
442
9/10
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 1 time.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 11 taken 1 time.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
12 switch (date.dayOfWeek().value()) {
443 2 case DayOfWeek::Sunday:
444
1/1
✓ Branch 1 taken 2 times.
2 result = this->applySunday();
445 2 break;
446 1 case DayOfWeek::Monday:
447
1/1
✓ Branch 1 taken 1 time.
1 result = this->applyMonday();
448 1 break;
449 2 case DayOfWeek::Tuesday:
450
1/1
✓ Branch 1 taken 2 times.
2 result = this->applyTuesday();
451 2 break;
452 2 case DayOfWeek::Wednesday:
453
1/1
✓ Branch 1 taken 2 times.
2 result = this->applyWednesday();
454 2 break;
455 2 case DayOfWeek::Thursday:
456
1/1
✓ Branch 1 taken 2 times.
2 result = this->applyThursday();
457 2 break;
458 1 case DayOfWeek::Friday:
459
1/1
✓ Branch 1 taken 1 time.
1 result = this->applyFriday();
460 1 break;
461 2 case DayOfWeek::Saturday:
462
1/1
✓ Branch 1 taken 2 times.
2 result = this->applySaturday();
463 2 break;
464 ✗ default:
465 ✗ OS_ASSERT(false);
466 }
467 }
468
469 14 return result;
470 14 }
471
472 6 std::vector<bool> ScheduleRule_Impl::containsDates(const std::vector<openstudio::Date>& dates) {
473 6 unsigned N = dates.size();
474
1/1
✓ Branch 1 taken 6 times.
6 std::vector<bool> result(N, false);
475
476 // need to check or adjust assumed base year on input date?
477
478
1/1
✓ Branch 1 taken 6 times.
6 boost::optional<std::string> dateSpecificationType = this->getString(OS_Schedule_RuleFields::DateSpecificationType, true);
479
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
6 OS_ASSERT(dateSpecificationType);
480
4/5
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
18 if (istringEqual("DateRange", *dateSpecificationType)) {
481
1/1
✓ Branch 1 taken 6 times.
6 boost::optional<openstudio::Date> startDate = this->startDate();
482
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
6 OS_ASSERT(startDate);
483
1/1
✓ Branch 1 taken 6 times.
6 boost::optional<openstudio::Date> endDate = this->endDate();
484
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
6 OS_ASSERT(endDate);
485
4/5
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 9 taken 6 times.
✗ Branch 10 not taken.
6 if (*startDate <= *endDate) {
486
2/2
✓ Branch 0 taken 2190 times.
✓ Branch 1 taken 6 times.
2196 for (unsigned i = 0; i < N; ++i) {
487
7/9
✓ Branch 1 taken 2190 times.
✓ Branch 5 taken 2190 times.
✓ Branch 7 taken 2190 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2190 times.
✓ Branch 14 taken 2190 times.
✓ Branch 16 taken 2190 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 2190 times.
2190 result[i] = ((dates[i] >= *startDate) && (dates[i] <= *endDate));
488 }
489 } else {
490 ✗ for (unsigned i = 0; i < N; ++i) {
491 ✗ result[i] = ((dates[i] >= *startDate) || (dates[i] <= *endDate));
492 }
493 }
494 6 } else {
495 ✗ std::vector<openstudio::Date> specificDates = this->specificDates();
496 ✗ for (unsigned i = 0; i < N; ++i) {
497 ✗ for (const openstudio::Date& specificDate : specificDates) {
498 ✗ if (specificDate == dates[i]) {
499 ✗ result[i] = true;
500 ✗ break;
501 }
502 }
503 }
504 ✗ }
505
506
1/1
✓ Branch 1 taken 6 times.
6 bool applySunday = this->applySunday();
507
1/1
✓ Branch 1 taken 6 times.
6 bool applyMonday = this->applyMonday();
508
1/1
✓ Branch 1 taken 6 times.
6 bool applyTuesday = this->applyTuesday();
509
1/1
✓ Branch 1 taken 6 times.
6 bool applyWednesday = this->applyWednesday();
510
1/1
✓ Branch 1 taken 6 times.
6 bool applyThursday = this->applyThursday();
511
1/1
✓ Branch 1 taken 6 times.
6 bool applyFriday = this->applyFriday();
512
1/1
✓ Branch 1 taken 6 times.
6 bool applySaturday = this->applySaturday();
513
514
2/2
✓ Branch 0 taken 2190 times.
✓ Branch 1 taken 6 times.
2196 for (unsigned i = 0; i < N; ++i) {
515
2/3
✓ Branch 1 taken 2190 times.
✓ Branch 4 taken 2190 times.
✗ Branch 5 not taken.
2190 if (result[i]) {
516
9/10
✓ Branch 2 taken 2190 times.
✓ Branch 5 taken 2190 times.
✓ Branch 7 taken 312 times.
✓ Branch 8 taken 312 times.
✓ Branch 9 taken 312 times.
✓ Branch 10 taken 312 times.
✓ Branch 11 taken 318 times.
✓ Branch 12 taken 312 times.
✓ Branch 13 taken 312 times.
✗ Branch 14 not taken.
2190 switch (dates[i].dayOfWeek().value()) {
517 312 case DayOfWeek::Sunday:
518
1/1
✓ Branch 1 taken 312 times.
312 result[i] = applySunday;
519 312 break;
520 312 case DayOfWeek::Monday:
521
1/1
✓ Branch 1 taken 312 times.
312 result[i] = applyMonday;
522 312 break;
523 312 case DayOfWeek::Tuesday:
524
1/1
✓ Branch 1 taken 312 times.
312 result[i] = applyTuesday;
525 312 break;
526 312 case DayOfWeek::Wednesday:
527
1/1
✓ Branch 1 taken 312 times.
312 result[i] = applyWednesday;
528 312 break;
529 318 case DayOfWeek::Thursday:
530
1/1
✓ Branch 1 taken 318 times.
318 result[i] = applyThursday;
531 318 break;
532 312 case DayOfWeek::Friday:
533
1/1
✓ Branch 1 taken 312 times.
312 result[i] = applyFriday;
534 312 break;
535 312 case DayOfWeek::Saturday:
536
1/1
✓ Branch 1 taken 312 times.
312 result[i] = applySaturday;
537 312 break;
538 ✗ default:
539 ✗ OS_ASSERT(false);
540 }
541 }
542 }
543
544 12 return result;
545 6 }
546
547 19551 boost::optional<ScheduleDay> ScheduleRule_Impl::optionalDaySchedule() const {
548
2/2
✓ Branch 1 taken 19551 times.
✓ Branch 4 taken 19551 times.
19551 return getObject<ScheduleRule>().getModelObjectTarget<ScheduleDay>(OS_Schedule_RuleFields::DayScheduleName);
549 }
550
551 } // namespace detail
552
553
3/3
✓ Branch 1 taken 1909 times.
✓ Branch 4 taken 1909 times.
✓ Branch 7 taken 1909 times.
1909 ScheduleRule::ScheduleRule(ScheduleRuleset& scheduleRuleset) : ParentObject(ScheduleRule::iddObjectType(), scheduleRuleset.model()) {
554
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 1909 times.
✗ Branch 5 not taken.
1909 OS_ASSERT(getImpl<detail::ScheduleRule_Impl>());
555
556
2/2
✓ Branch 1 taken 1909 times.
✓ Branch 4 taken 1909 times.
1909 bool result = setPointer(OS_Schedule_RuleFields::ScheduleRulesetName, scheduleRuleset.handle());
557
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1909 times.
✗ Branch 3 not taken.
1909 OS_ASSERT(result);
558
559
2/2
✓ Branch 1 taken 1909 times.
✓ Branch 4 taken 1909 times.
1909 ScheduleDay daySchedule(scheduleRuleset.model());
560
2/2
✓ Branch 1 taken 1909 times.
✓ Branch 4 taken 1909 times.
1909 result = setPointer(OS_Schedule_RuleFields::DayScheduleName, daySchedule.handle());
561
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1909 times.
✗ Branch 3 not taken.
1909 OS_ASSERT(result);
562
3/3
✓ Branch 1 taken 1909 times.
✓ Branch 3 taken 513 times.
✓ Branch 4 taken 1396 times.
3818 if (OptionalScheduleTypeLimits limits = scheduleRuleset.scheduleTypeLimits()) {
563
2/2
✓ Branch 1 taken 513 times.
✓ Branch 4 taken 513 times.
513 daySchedule.setScheduleTypeLimits(*limits);
564 1909 }
565
566
1/1
✓ Branch 2 taken 1909 times.
1909 this->setRuleIndex(std::numeric_limits<int>::max());
567
1/1
✓ Branch 1 taken 1909 times.
1909 result = scheduleRuleset.setScheduleRuleIndex(*this, 0);
568
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 1909 times.
✗ Branch 3 not taken.
1909 OS_ASSERT(result);
569 1909 }
570
571 921 ScheduleRule::ScheduleRule(ScheduleRuleset& scheduleRuleset, const ScheduleDay& daySchedule)
572
3/3
✓ Branch 1 taken 921 times.
✓ Branch 4 taken 921 times.
✓ Branch 7 taken 921 times.
921 : ParentObject(ScheduleRule::iddObjectType(), scheduleRuleset.model()) {
573
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 921 times.
✗ Branch 5 not taken.
921 OS_ASSERT(getImpl<detail::ScheduleRule_Impl>());
574
575
2/2
✓ Branch 1 taken 921 times.
✓ Branch 4 taken 921 times.
921 bool result = setPointer(OS_Schedule_RuleFields::ScheduleRulesetName, scheduleRuleset.handle());
576
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 921 times.
✗ Branch 3 not taken.
921 OS_ASSERT(result);
577
578
2/2
✓ Branch 1 taken 921 times.
✓ Branch 4 taken 921 times.
921 ModelObject clone = daySchedule.clone(scheduleRuleset.model());
579
2/2
✓ Branch 1 taken 921 times.
✓ Branch 4 taken 921 times.
921 result = setPointer(OS_Schedule_RuleFields::DayScheduleName, clone.handle());
580
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 921 times.
✗ Branch 3 not taken.
921 OS_ASSERT(result);
581
3/3
✓ Branch 1 taken 921 times.
✓ Branch 3 taken 245 times.
✓ Branch 4 taken 676 times.
1842 if (OptionalScheduleTypeLimits limits = scheduleRuleset.scheduleTypeLimits()) {
582
3/3
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 7 taken 245 times.
245 clone.cast<ScheduleDay>().setScheduleTypeLimits(*limits);
583 921 }
584
585
1/1
✓ Branch 2 taken 921 times.
921 this->setRuleIndex(std::numeric_limits<int>::max());
586
1/1
✓ Branch 1 taken 921 times.
921 result = scheduleRuleset.setScheduleRuleIndex(*this, 0);
587
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 921 times.
✗ Branch 3 not taken.
921 OS_ASSERT(result);
588 921 }
589
590 21616 IddObjectType ScheduleRule::iddObjectType() {
591
1/1
✓ Branch 1 taken 21616 times.
21616 IddObjectType result(IddObjectType::OS_Schedule_Rule);
592 21616 return result;
593 }
594
595 ✗ std::vector<std::string> ScheduleRule::validDateSpecificationTypeValues() {
596 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Schedule_RuleFields::DateSpecificationType);
597 }
598
599 7 ScheduleRuleset ScheduleRule::scheduleRuleset() const {
600
1/1
✓ Branch 3 taken 7 times.
7 return getImpl<detail::ScheduleRule_Impl>()->scheduleRuleset();
601 }
602
603 14525 int ScheduleRule::ruleIndex() const {
604
1/1
✓ Branch 3 taken 14525 times.
14525 return getImpl<detail::ScheduleRule_Impl>()->ruleIndex();
605 }
606
607 19439 ScheduleDay ScheduleRule::daySchedule() const {
608
1/1
✓ Branch 3 taken 19439 times.
19439 return getImpl<detail::ScheduleRule_Impl>()->daySchedule();
609 }
610
611 655 bool ScheduleRule::applySunday() const {
612
1/1
✓ Branch 3 taken 655 times.
655 return getImpl<detail::ScheduleRule_Impl>()->applySunday();
613 }
614
615 655 bool ScheduleRule::applyMonday() const {
616
1/1
✓ Branch 3 taken 655 times.
655 return getImpl<detail::ScheduleRule_Impl>()->applyMonday();
617 }
618
619 655 bool ScheduleRule::applyTuesday() const {
620
1/1
✓ Branch 3 taken 655 times.
655 return getImpl<detail::ScheduleRule_Impl>()->applyTuesday();
621 }
622
623 655 bool ScheduleRule::applyWednesday() const {
624
1/1
✓ Branch 3 taken 655 times.
655 return getImpl<detail::ScheduleRule_Impl>()->applyWednesday();
625 }
626
627 655 bool ScheduleRule::applyThursday() const {
628
1/1
✓ Branch 3 taken 655 times.
655 return getImpl<detail::ScheduleRule_Impl>()->applyThursday();
629 }
630
631 655 bool ScheduleRule::applyFriday() const {
632
1/1
✓ Branch 3 taken 655 times.
655 return getImpl<detail::ScheduleRule_Impl>()->applyFriday();
633 }
634
635 655 bool ScheduleRule::applySaturday() const {
636
1/1
✓ Branch 3 taken 655 times.
655 return getImpl<detail::ScheduleRule_Impl>()->applySaturday();
637 }
638
639 665 boost::optional<openstudio::Date> ScheduleRule::startDate() const {
640
1/1
✓ Branch 3 taken 665 times.
665 return getImpl<detail::ScheduleRule_Impl>()->startDate();
641 }
642
643 665 boost::optional<openstudio::Date> ScheduleRule::endDate() const {
644
1/1
✓ Branch 3 taken 665 times.
665 return getImpl<detail::ScheduleRule_Impl>()->endDate();
645 }
646
647 5 std::vector<openstudio::Date> ScheduleRule::specificDates() const {
648
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::ScheduleRule_Impl>()->specificDates();
649 }
650
651 647 std::string ScheduleRule::dateSpecificationType() const {
652
1/1
✓ Branch 3 taken 647 times.
647 return getImpl<detail::ScheduleRule_Impl>()->dateSpecificationType();
653 }
654
655 7187 bool ScheduleRule::setRuleIndex(int index) {
656
1/1
✓ Branch 3 taken 7187 times.
7187 return getImpl<detail::ScheduleRule_Impl>()->setRuleIndex(index);
657 }
658
659 70 bool ScheduleRule::setApplySunday(bool applySunday) {
660
1/1
✓ Branch 3 taken 70 times.
70 return getImpl<detail::ScheduleRule_Impl>()->setApplySunday(applySunday);
661 }
662
663 ✗ void ScheduleRule::setApplySundayNoFail(bool applySunday) {
664 ✗ bool result = getImpl<detail::ScheduleRule_Impl>()->setApplySunday(applySunday);
665 ✗ OS_ASSERT(result);
666 ✗ }
667
668 1414 bool ScheduleRule::setApplyMonday(bool applyMonday) {
669
1/1
✓ Branch 3 taken 1414 times.
1414 return getImpl<detail::ScheduleRule_Impl>()->setApplyMonday(applyMonday);
670 }
671
672 ✗ void ScheduleRule::setApplyMondayNoFail(bool applyMonday) {
673 ✗ bool result = getImpl<detail::ScheduleRule_Impl>()->setApplyMonday(applyMonday);
674 ✗ OS_ASSERT(result);
675 ✗ }
676
677 1413 bool ScheduleRule::setApplyTuesday(bool applyTuesday) {
678
1/1
✓ Branch 3 taken 1413 times.
1413 return getImpl<detail::ScheduleRule_Impl>()->setApplyTuesday(applyTuesday);
679 }
680
681 ✗ void ScheduleRule::setApplyTuesdayNoFail(bool applyTuesday) {
682 ✗ bool result = getImpl<detail::ScheduleRule_Impl>()->setApplyTuesday(applyTuesday);
683 ✗ OS_ASSERT(result);
684 ✗ }
685
686 1413 bool ScheduleRule::setApplyWednesday(bool applyWednesday) {
687
1/1
✓ Branch 3 taken 1413 times.
1413 return getImpl<detail::ScheduleRule_Impl>()->setApplyWednesday(applyWednesday);
688 }
689
690 ✗ void ScheduleRule::setApplyWednesdayNoFail(bool applyWednesday) {
691 ✗ bool result = getImpl<detail::ScheduleRule_Impl>()->setApplyWednesday(applyWednesday);
692 ✗ OS_ASSERT(result);
693 ✗ }
694
695 1413 bool ScheduleRule::setApplyThursday(bool applyThursday) {
696
1/1
✓ Branch 3 taken 1413 times.
1413 return getImpl<detail::ScheduleRule_Impl>()->setApplyThursday(applyThursday);
697 }
698
699 ✗ void ScheduleRule::setApplyThursdayNoFail(bool applyThursday) {
700 ✗ bool result = getImpl<detail::ScheduleRule_Impl>()->setApplyThursday(applyThursday);
701 ✗ OS_ASSERT(result);
702 ✗ }
703
704 1413 bool ScheduleRule::setApplyFriday(bool applyFriday) {
705
1/1
✓ Branch 3 taken 1413 times.
1413 return getImpl<detail::ScheduleRule_Impl>()->setApplyFriday(applyFriday);
706 }
707
708 ✗ void ScheduleRule::setApplyFridayNoFail(bool applyFriday) {
709 ✗ bool result = getImpl<detail::ScheduleRule_Impl>()->setApplyFriday(applyFriday);
710 ✗ OS_ASSERT(result);
711 ✗ }
712
713 1414 bool ScheduleRule::setApplySaturday(bool applySaturday) {
714
1/1
✓ Branch 3 taken 1414 times.
1414 return getImpl<detail::ScheduleRule_Impl>()->setApplySaturday(applySaturday);
715 }
716
717 ✗ void ScheduleRule::setApplySaturdayNoFail(bool applySaturday) {
718 ✗ bool result = getImpl<detail::ScheduleRule_Impl>()->setApplySaturday(applySaturday);
719 ✗ OS_ASSERT(result);
720 ✗ }
721
722 9 bool ScheduleRule::applyWeekdays() const {
723
1/1
✓ Branch 3 taken 9 times.
9 return getImpl<detail::ScheduleRule_Impl>()->applyWeekdays();
724 }
725
726 3 bool ScheduleRule::setApplyWeekdays(bool applyWeekdays) {
727
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ScheduleRule_Impl>()->setApplyWeekdays(applyWeekdays);
728 }
729
730 9 bool ScheduleRule::applyWeekends() const {
731
1/1
✓ Branch 3 taken 9 times.
9 return getImpl<detail::ScheduleRule_Impl>()->applyWeekends();
732 }
733
734 2 bool ScheduleRule::setApplyWeekends(bool applyWeekends) {
735
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ScheduleRule_Impl>()->setApplyWeekends(applyWeekends);
736 }
737
738 9 bool ScheduleRule::applyAllDays() const {
739
1/1
✓ Branch 3 taken 9 times.
9 return getImpl<detail::ScheduleRule_Impl>()->applyAllDays();
740 }
741
742 2 bool ScheduleRule::setApplyAllDays(bool applyAllDays) {
743
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::ScheduleRule_Impl>()->setApplyAllDays(applyAllDays);
744 }
745
746 85 bool ScheduleRule::setStartDate(const openstudio::Date& date) {
747
1/1
✓ Branch 3 taken 85 times.
85 return getImpl<detail::ScheduleRule_Impl>()->setStartDate(date);
748 }
749
750 84 bool ScheduleRule::setEndDate(const openstudio::Date& date) {
751
1/1
✓ Branch 3 taken 84 times.
84 return getImpl<detail::ScheduleRule_Impl>()->setEndDate(date);
752 }
753
754 1 bool ScheduleRule::addSpecificDate(const openstudio::Date& date) {
755
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::ScheduleRule_Impl>()->addSpecificDate(date);
756 }
757
758 ✗ void ScheduleRule::ensureNoLeapDays() {
759 ✗ return getImpl<detail::ScheduleRule_Impl>()->ensureNoLeapDays();
760 }
761
762 14 bool ScheduleRule::containsDate(const openstudio::Date& date) {
763
1/1
✓ Branch 3 taken 14 times.
14 return getImpl<detail::ScheduleRule_Impl>()->containsDate(date);
764 }
765
766 6 std::vector<bool> ScheduleRule::containsDates(const std::vector<openstudio::Date>& dates) {
767
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::ScheduleRule_Impl>()->containsDates(dates);
768 }
769
770 /// @cond
771
1/1
✓ Branch 3 taken 28463 times.
28463 ScheduleRule::ScheduleRule(std::shared_ptr<detail::ScheduleRule_Impl> impl) : ParentObject(std::move(impl)) {}
772 /// @endcond
773
774 } // namespace model
775 } // namespace openstudio
776