MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / candidateIsCompatibleWithCurrentUse

Method candidateIsCompatibleWithCurrentUse

src/model/Schedule.cpp:41–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 Schedule_Impl::Schedule_Impl(const Schedule_Impl& other, Model_Impl* model, bool keepHandles) : ScheduleBase_Impl(other, model, keepHandles) {}
40
41 bool Schedule_Impl::candidateIsCompatibleWithCurrentUse(const ScheduleTypeLimits& candidate) const {
42 ModelObjectVector users = getObject<Schedule>().getModelObjectSources<ModelObject>();
43 auto copyOfThis = getObject<Schedule>();
44 for (const ModelObject& user : users) {
45 std::vector<ScheduleTypeKey> keys = user.getScheduleTypeKeys(copyOfThis);
46 // ETH@20120806 - Ideally would make the following OS_ASSERT, but is too
47 // strict for now. (Too easy for a user to trigger this first, before a unit
48 // test or app tester catches it.)
49 // OS_ASSERT(!keys.empty());
50 for (const ScheduleTypeKey& key : keys) {
51 if (!isCompatible(key.className(), key.scheduleDisplayName(), candidate)) {
52 return false;
53 }
54 }
55 }
56 return true;
57 }
58
59 bool Schedule_Impl::okToResetScheduleTypeLimits() const {
60 // ok to zero out if all users are schedules

Callers

nothing calls this directly

Calls 4

isCompatibleFunction · 0.70
getScheduleTypeKeysMethod · 0.45
classNameMethod · 0.45
scheduleDisplayNameMethod · 0.45

Tested by

no test coverage detected