src/utilities/idf/IdfExtensibleGroup.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 "IdfExtensibleGroup.hpp" | ||
| 7 | #include "IdfObject_Impl.hpp" | ||
| 8 | |||
| 9 | #include "../core/Assert.hpp" | ||
| 10 | |||
| 11 | namespace openstudio { | ||
| 12 | |||
| 13 | // GETTERS | ||
| 14 | |||
| 15 | 3356 | StringVector IdfExtensibleGroup::fields(bool returnDefault) const { | |
| 16 | 3356 | StringVector result; | |
| 17 |
3/3✓ Branch 1 taken 3356 times.
✓ Branch 3 taken 3396 times.
✓ Branch 4 taken 3356 times.
|
6752 | for (unsigned i = 0, n = numFields(); i < n; ++i) { |
| 18 |
1/1✓ Branch 1 taken 3396 times.
|
3396 | OptionalString str = getString(i, returnDefault); |
| 19 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 3396 times.
✗ Branch 4 not taken.
|
3396 | OS_ASSERT(str); |
| 20 |
2/2✓ Branch 1 taken 3396 times.
✓ Branch 4 taken 3396 times.
|
3396 | result.push_back(*str); |
| 21 | 3396 | } | |
| 22 | 3356 | return result; | |
| 23 | ✗ | } | |
| 24 | |||
| 25 | 234347 | StringVector IdfExtensibleGroup::fieldsWithHandles(bool returnDefault) const { | |
| 26 | 234347 | StringVector result; | |
| 27 |
1/1✓ Branch 1 taken 234347 times.
|
234347 | const unsigned n = numFields(); |
| 28 |
1/1✓ Branch 1 taken 234347 times.
|
234347 | result.reserve(n); |
| 29 |
2/2✓ Branch 0 taken 698833 times.
✓ Branch 1 taken 234347 times.
|
933180 | for (unsigned i = 0; i < n; ++i) { |
| 30 |
1/1✓ Branch 1 taken 698833 times.
|
698833 | OptionalString str = getField(i, returnDefault); |
| 31 |
3/3✓ Branch 1 taken 698833 times.
✓ Branch 4 taken 698833 times.
✓ Branch 7 taken 698833 times.
|
698833 | result.push_back(str.get_value_or("")); |
| 32 | 698833 | } | |
| 33 | 234347 | return result; | |
| 34 | ✗ | } | |
| 35 | |||
| 36 | 104215 | StringVector IdfExtensibleGroup::fieldComments(bool returnDefault) const { | |
| 37 | 104215 | StringVector result; | |
| 38 |
3/3✓ Branch 1 taken 104215 times.
✓ Branch 3 taken 310992 times.
✓ Branch 4 taken 104215 times.
|
415207 | for (unsigned i = 0, n = numFields(); i < n; ++i) { |
| 39 |
1/1✓ Branch 1 taken 310992 times.
|
310992 | OptionalString str = fieldComment(i, returnDefault); |
| 40 |
1/2✓ Branch 0 taken 310992 times.
✗ Branch 1 not taken.
|
310992 | if (str) { |
| 41 |
2/2✓ Branch 1 taken 310992 times.
✓ Branch 4 taken 310992 times.
|
310992 | result.push_back(*str); |
| 42 | } else { | ||
| 43 | ✗ | break; | |
| 44 | } | ||
| 45 | 310992 | } | |
| 46 | 104215 | return result; | |
| 47 | ✗ | } | |
| 48 | |||
| 49 | 311238 | OptionalString IdfExtensibleGroup::fieldComment(unsigned fieldIndex, bool returnDefault) const { | |
| 50 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 311238 times.
|
311238 | if (!isValid(fieldIndex)) { |
| 51 | ✗ | return boost::none; | |
| 52 | } | ||
| 53 | 311238 | return m_impl->fieldComment(mf_toIndex(fieldIndex), returnDefault); | |
| 54 | } | ||
| 55 | |||
| 56 | 31 | bool IdfExtensibleGroup::isEmpty(unsigned fieldIndex) const { | |
| 57 |
1/1✓ Branch 1 taken 31 times.
|
31 | OptionalString test = this->getString(fieldIndex, false); |
| 58 |
6/7✓ Branch 1 taken 31 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 31 times.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 27 times.
✓ Branch 9 taken 4 times.
✓ Branch 10 taken 27 times.
|
31 | if (!test || test.get().empty()) { |
| 59 | 4 | return true; | |
| 60 | } | ||
| 61 | 27 | return false; | |
| 62 | 31 | } | |
| 63 | |||
| 64 | 252258 | OptionalString IdfExtensibleGroup::getString(unsigned fieldIndex, bool returnDefault) const { | |
| 65 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 252257 times.
|
252258 | if (!isValid(fieldIndex)) { |
| 66 | 1 | return boost::none; | |
| 67 | } | ||
| 68 | 252257 | return m_impl->getString(mf_toIndex(fieldIndex), returnDefault); | |
| 69 | } | ||
| 70 | |||
| 71 | 699292 | boost::optional<std::string> IdfExtensibleGroup::getField(unsigned index, bool returnDefault) const { | |
| 72 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 699292 times.
|
699292 | if (!isValid(index)) { |
| 73 | ✗ | return boost::none; | |
| 74 | } | ||
| 75 | 699292 | return m_impl->getField(mf_toIndex(index), returnDefault); | |
| 76 | } | ||
| 77 | |||
| 78 | 3181726 | OptionalDouble IdfExtensibleGroup::getDouble(unsigned fieldIndex, bool returnDefault) const { | |
| 79 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3181726 times.
|
3181726 | if (!isValid(fieldIndex)) { |
| 80 | ✗ | return boost::none; | |
| 81 | } | ||
| 82 | 3181726 | return m_impl->getDouble(mf_toIndex(fieldIndex), returnDefault); | |
| 83 | } | ||
| 84 | |||
| 85 | 1429 | OptionalUnsigned IdfExtensibleGroup::getUnsigned(unsigned fieldIndex, bool returnDefault) const { | |
| 86 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1429 times.
|
1429 | if (!isValid(fieldIndex)) { |
| 87 | ✗ | return boost::none; | |
| 88 | } | ||
| 89 | 1429 | return m_impl->getUnsigned(mf_toIndex(fieldIndex), returnDefault); | |
| 90 | } | ||
| 91 | |||
| 92 | 1498495 | OptionalInt IdfExtensibleGroup::getInt(unsigned fieldIndex, bool returnDefault) const { | |
| 93 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1498495 times.
|
1498495 | if (!isValid(fieldIndex)) { |
| 94 | ✗ | return boost::none; | |
| 95 | } | ||
| 96 | 1498495 | return m_impl->getInt(mf_toIndex(fieldIndex), returnDefault); | |
| 97 | } | ||
| 98 | |||
| 99 | // SETTERS | ||
| 100 | |||
| 101 | 247 | bool IdfExtensibleGroup::setFieldComment(unsigned fieldIndex, const std::string& cmnt) { | |
| 102 |
2/4✓ Branch 1 taken 247 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 247 times.
✗ Branch 7 not taken.
|
247 | return isValid(fieldIndex) && m_impl->setFieldComment(mf_toIndex(fieldIndex), cmnt); |
| 103 | } | ||
| 104 | |||
| 105 | ✗ | bool IdfExtensibleGroup::setFields(const std::vector<std::string>& values) { | |
| 106 | ✗ | bool result = setFields(values, true); | |
| 107 | ✗ | if (result) { | |
| 108 | ✗ | m_impl->emitChangeSignals(); | |
| 109 | } | ||
| 110 | ✗ | return result; | |
| 111 | } | ||
| 112 | |||
| 113 | 23085 | bool IdfExtensibleGroup::setFields(const std::vector<std::string>& values, bool checkValidity) { | |
| 114 |
4/7✓ Branch 1 taken 23085 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 23085 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 23085 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 23085 times.
|
23085 | if ((values.empty()) || (values.size() != numFields())) { |
| 115 | ✗ | return false; | |
| 116 | } | ||
| 117 | |||
| 118 |
1/1✓ Branch 1 taken 23085 times.
|
23085 | unsigned n = numFields(); |
| 119 | // save oldValues for rollback | ||
| 120 | 23085 | StringVector oldValues; | |
| 121 |
2/2✓ Branch 0 taken 68902 times.
✓ Branch 1 taken 23085 times.
|
91987 | for (unsigned i = 0; i < n; ++i) { |
| 122 |
1/1✓ Branch 1 taken 68902 times.
|
68902 | OptionalString oValue = getString(i); |
| 123 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 68902 times.
✗ Branch 4 not taken.
|
68902 | OS_ASSERT(oValue); |
| 124 |
2/2✓ Branch 1 taken 68902 times.
✓ Branch 4 taken 68902 times.
|
68902 | oldValues.push_back(*oValue); |
| 125 | 68902 | } | |
| 126 | |||
| 127 | // try to set values | ||
| 128 | 23085 | bool ok = true; | |
| 129 |
2/2✓ Branch 0 taken 68902 times.
✓ Branch 1 taken 23084 times.
|
91986 | for (unsigned i = 0; i < n; ++i) { |
| 130 |
1/1✓ Branch 2 taken 68902 times.
|
68902 | ok = setString(i, values[i], checkValidity); |
| 131 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 68901 times.
|
68902 | if (!ok) { |
| 132 | 1 | break; | |
| 133 | } | ||
| 134 | } | ||
| 135 | |||
| 136 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 23084 times.
|
23085 | if (!ok) { |
| 137 | // rollback | ||
| 138 |
2/2✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
|
2 | for (unsigned i = 0; i < n; ++i) { |
| 139 |
1/1✓ Branch 2 taken 1 time.
|
1 | bool rollbackOk = setString(i, oldValues[i], false); |
| 140 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
|
1 | OS_ASSERT(rollbackOk); |
| 141 | } | ||
| 142 | } | ||
| 143 | |||
| 144 | 23085 | return ok; | |
| 145 | 23085 | } | |
| 146 | |||
| 147 | 31086 | bool IdfExtensibleGroup::setString(unsigned fieldIndex, const std::string& value) { | |
| 148 | 31086 | bool result = setString(fieldIndex, value, true); | |
| 149 |
2/2✓ Branch 0 taken 31081 times.
✓ Branch 1 taken 5 times.
|
31086 | if (result) { |
| 150 | 31081 | m_impl->emitChangeSignals(); | |
| 151 | } | ||
| 152 | 31086 | return result; | |
| 153 | } | ||
| 154 | |||
| 155 | 100007 | bool IdfExtensibleGroup::setString(unsigned fieldIndex, const std::string& value, bool checkValidity) { | |
| 156 | // private method for internal use | ||
| 157 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 100007 times.
|
100007 | if (!isValid(fieldIndex)) { |
| 158 | ✗ | return false; | |
| 159 | } | ||
| 160 | 100007 | return m_impl->setString(mf_toIndex(fieldIndex), value, checkValidity); | |
| 161 | } | ||
| 162 | |||
| 163 | 70429 | bool IdfExtensibleGroup::setDouble(unsigned fieldIndex, double value) { | |
| 164 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 70427 times.
|
70429 | if (!isValid(fieldIndex)) { |
| 165 | 2 | return false; | |
| 166 | } | ||
| 167 | 70427 | return m_impl->setDouble(mf_toIndex(fieldIndex), value); | |
| 168 | } | ||
| 169 | |||
| 170 | 1356 | bool IdfExtensibleGroup::setUnsigned(unsigned fieldIndex, unsigned value) { | |
| 171 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1356 times.
|
1356 | if (!isValid(fieldIndex)) { |
| 172 | ✗ | return false; | |
| 173 | } | ||
| 174 | 1356 | return m_impl->setUnsigned(mf_toIndex(fieldIndex), value); | |
| 175 | } | ||
| 176 | |||
| 177 | 2598 | bool IdfExtensibleGroup::setInt(unsigned fieldIndex, int value) { | |
| 178 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 2598 times.
|
2598 | if (!isValid(fieldIndex)) { |
| 179 | ✗ | return false; | |
| 180 | } | ||
| 181 | 2598 | return m_impl->setInt(mf_toIndex(fieldIndex), value); | |
| 182 | } | ||
| 183 | |||
| 184 | 3 | IdfExtensibleGroup IdfExtensibleGroup::pushClone() const { | |
| 185 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
3 | if (empty()) { |
| 186 | ✗ | detail::IdfObject_ImplPtr p; | |
| 187 | ✗ | return {p, 0}; | |
| 188 | ✗ | } | |
| 189 | |||
| 190 |
1/1✓ Branch 1 taken 3 times.
|
3 | StringVector values = fieldsWithHandles(); |
| 191 |
2/4✓ Branch 2 taken 3 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 7 not taken.
|
3 | OS_ASSERT(values.size() == numFields()); |
| 192 |
1/1✓ Branch 2 taken 3 times.
|
3 | return m_impl->pushExtensibleGroup(values); |
| 193 | 3 | } | |
| 194 | |||
| 195 | 6 | IdfExtensibleGroup IdfExtensibleGroup::insertClone(unsigned groupIndex) const { | |
| 196 |
2/3✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
|
6 | if (empty()) { |
| 197 | ✗ | detail::IdfObject_ImplPtr p; | |
| 198 | ✗ | return {p, 0}; | |
| 199 | ✗ | } | |
| 200 | |||
| 201 |
1/1✓ Branch 1 taken 6 times.
|
6 | StringVector values = fieldsWithHandles(); |
| 202 |
2/4✓ Branch 2 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 7 not taken.
|
6 | OS_ASSERT(values.size() == numFields()); |
| 203 |
1/1✓ Branch 2 taken 6 times.
|
6 | return m_impl->insertExtensibleGroup(groupIndex, values); |
| 204 | 6 | } | |
| 205 | |||
| 206 | // QUERIES | ||
| 207 | |||
| 208 | 17431830 | bool IdfExtensibleGroup::empty() const { | |
| 209 |
6/6✓ Branch 1 taken 17431719 times.
✓ Branch 2 taken 111 times.
✓ Branch 5 taken 107043 times.
✓ Branch 6 taken 17324676 times.
✓ Branch 7 taken 107154 times.
✓ Branch 8 taken 17324676 times.
|
17431830 | if (!m_impl || (m_index >= m_impl->numFields())) { |
| 210 | 107154 | return true; | |
| 211 | } | ||
| 212 | 17324676 | return false; | |
| 213 | } | ||
| 214 | |||
| 215 | 7073866 | unsigned IdfExtensibleGroup::groupIndex() const { | |
| 216 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 7073863 times.
|
7073866 | if (empty()) { |
| 217 |
13/13✓ 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.
✓ Branch 19 taken 3 times.
✓ Branch 22 taken 3 times.
✓ Branch 25 taken 3 times.
✓ Branch 28 taken 3 times.
✓ Branch 31 taken 3 times.
✓ Branch 34 taken 3 times.
✓ Branch 38 taken 3 times.
✓ Branch 41 taken 3 times.
|
3 | LOG_AND_THROW("This extensible group is invalid, and so does not have an index."); |
| 218 | } | ||
| 219 |
2/2✓ Branch 2 taken 7073863 times.
✓ Branch 5 taken 7073863 times.
|
7073863 | return m_impl->iddObject().extensibleIndex(m_index).group; |
| 220 | }; | ||
| 221 | |||
| 222 | 2594488 | unsigned IdfExtensibleGroup::numFields() const { | |
| 223 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 2594487 times.
|
2594488 | if (empty()) { |
| 224 | 1 | return 0; | |
| 225 | } | ||
| 226 |
2/2✓ Branch 2 taken 2594487 times.
✓ Branch 5 taken 2594487 times.
|
2594487 | unsigned n = m_impl->iddObject().properties().numExtensible; |
| 227 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 2594487 times.
|
2594487 | if (m_index + n > m_impl->numFields()) { |
| 228 | ✗ | OS_ASSERT(false); | |
| 229 | ✗ | return 0; | |
| 230 | } | ||
| 231 | 2594487 | return n; | |
| 232 | } | ||
| 233 | |||
| 234 | 6162868 | bool IdfExtensibleGroup::isValid(unsigned fieldIndex) const { | |
| 235 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 6162865 times.
|
6162868 | if (empty()) { |
| 236 | 3 | return false; | |
| 237 | } | ||
| 238 |
4/4✓ Branch 2 taken 6162865 times.
✓ Branch 5 taken 6162865 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 6162863 times.
|
6162865 | if (fieldIndex >= m_impl->iddObject().properties().numExtensible) { |
| 239 | 2 | return false; | |
| 240 | } | ||
| 241 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 6162863 times.
|
6162863 | OS_ASSERT(m_index + fieldIndex < m_impl->numFields()); |
| 242 | 6162863 | return true; | |
| 243 | } | ||
| 244 | |||
| 245 | 1 | std::vector<unsigned> IdfExtensibleGroup::objectListFields() const { | |
| 246 | 1 | UnsignedVector result; | |
| 247 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (!empty()) { |
| 248 |
2/2✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
|
1 | result = mf_subsetAndToFieldIndices(m_impl->objectListFields()); |
| 249 | } | ||
| 250 | 1 | return result; | |
| 251 | ✗ | } | |
| 252 | |||
| 253 | ✗ | std::vector<unsigned> IdfExtensibleGroup::dataFields() const { | |
| 254 | ✗ | UnsignedVector result; | |
| 255 | ✗ | if (!empty()) { | |
| 256 | ✗ | result = mf_subsetAndToFieldIndices(m_impl->dataFields()); | |
| 257 | } | ||
| 258 | ✗ | return result; | |
| 259 | ✗ | } | |
| 260 | |||
| 261 | 1 | std::vector<unsigned> IdfExtensibleGroup::requiredFields() const { | |
| 262 | 1 | UnsignedVector result; | |
| 263 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
1 | if (!empty()) { |
| 264 |
3/3✓ Branch 2 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 8 taken 1 time.
|
1 | IddFieldVector iddExtFields = m_impl->iddObject().extensibleGroup(); |
| 265 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 1 time.
|
3 | for (unsigned fieldIndex = 0, n = numFields(); fieldIndex < n; ++fieldIndex) { |
| 266 |
2/3✓ Branch 2 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | if (iddExtFields[fieldIndex].properties().required) { |
| 267 |
1/1✓ Branch 1 taken 2 times.
|
2 | result.push_back(fieldIndex); |
| 268 | } | ||
| 269 | } | ||
| 270 | 1 | } | |
| 271 | 1 | return result; | |
| 272 | ✗ | } | |
| 273 | |||
| 274 | 2 | bool IdfExtensibleGroup::operator==(const IdfExtensibleGroup& other) const { | |
| 275 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 2 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | return (m_impl == other.m_impl) && (m_index == other.m_index); |
| 276 | } | ||
| 277 | |||
| 278 | 1 | bool IdfExtensibleGroup::operator!=(const IdfExtensibleGroup& other) const { | |
| 279 | 1 | return !(*this == other); | |
| 280 | } | ||
| 281 | |||
| 282 | // PRIVATE | ||
| 283 | |||
| 284 | 6568275 | IdfExtensibleGroup::IdfExtensibleGroup(std::shared_ptr<detail::IdfObject_Impl> impl, unsigned index) : m_impl(impl), m_index(index) { | |
| 285 | // impl is passed in as null in many cases | ||
| 286 | //OS_ASSERT(m_impl); | ||
| 287 | 6568275 | } | |
| 288 | |||
| 289 | 6561150 | unsigned IdfExtensibleGroup::mf_toIndex(unsigned fieldIndex) const { | |
| 290 | // only call after checking isValid(fieldIndex) | ||
| 291 | try { | ||
| 292 |
4/4✓ Branch 2 taken 6561150 times.
✓ Branch 5 taken 6561150 times.
✓ Branch 8 taken 6561150 times.
✓ Branch 11 taken 6561150 times.
|
6561150 | return m_impl->iddObject().index(ExtensibleIndex(groupIndex(), fieldIndex)); |
| 293 | ✗ | } catch (...) { | |
| 294 | ✗ | } | |
| 295 | ✗ | OS_ASSERT(false); | |
| 296 | ✗ | return 0; | |
| 297 | } | ||
| 298 | |||
| 299 | 133791 | std::vector<unsigned> IdfExtensibleGroup::mf_indices() const { | |
| 300 | 133791 | UnsignedVector result; | |
| 301 |
2/3✓ Branch 1 taken 133791 times.
✓ Branch 3 taken 133791 times.
✗ Branch 4 not taken.
|
133791 | if (!empty()) { |
| 302 |
3/3✓ Branch 1 taken 133791 times.
✓ Branch 3 taken 398169 times.
✓ Branch 4 taken 133791 times.
|
531960 | for (unsigned i = 0, n = numFields(); i < n; ++i) { |
| 303 |
2/2✓ Branch 1 taken 398169 times.
✓ Branch 4 taken 398169 times.
|
398169 | result.push_back(mf_toIndex(i)); |
| 304 | } | ||
| 305 | } | ||
| 306 | 133791 | return result; | |
| 307 | ✗ | } | |
| 308 | |||
| 309 | 3 | UnsignedVector IdfExtensibleGroup::mf_subsetAndToFieldIndices(UnsignedVector indices) const { | |
| 310 | 3 | UnsignedVector result; | |
| 311 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 6 not taken.
|
3 | OS_ASSERT(!empty()); |
| 312 | // downselect and convert to only this ExtensibleGroup | ||
| 313 |
2/2✓ Branch 5 taken 2 times.
✓ Branch 6 taken 3 times.
|
5 | for (unsigned index : indices) { |
| 314 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (index >= m_index) { |
| 315 | 2 | unsigned fieldIndex = index - m_index; | |
| 316 |
2/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | if (isValid(fieldIndex)) { |
| 317 |
1/1✓ Branch 1 taken 2 times.
|
2 | result.push_back(fieldIndex); |
| 318 | } | ||
| 319 | } | ||
| 320 | } | ||
| 321 | 3 | return result; | |
| 322 | ✗ | } | |
| 323 | |||
| 324 | } // namespace openstudio | ||
| 325 |