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

Method objectListFieldsEqual

src/utilities/idf/WorkspaceObject.cpp:774–810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

772 }
773
774 bool WorkspaceObject_Impl::objectListFieldsEqual(const WorkspaceObject& other) const {
775 // Looks for object equality of targets if same workspace(), otherwise, looks for data
776 // field equality of targets.
777 if (iddObject() != other.iddObject()) {
778 return false;
779 }
780 UnsignedVector myFields = objectListFields();
781 UnsignedVector otherFields = other.objectListFields();
782 if (myFields != otherFields) {
783 return false;
784 }
785
786 // iddObject() same, field indices same--compare data
787 for (const unsigned i : myFields) {
788 OptionalWorkspaceObject oMyTarget = getTarget(i);
789 OptionalWorkspaceObject oOtherTarget = other.getTarget(i);
790 if (oMyTarget || oOtherTarget) {
791 // at least one is non-null
792 if (!(oMyTarget && oOtherTarget)) {
793 return false;
794 }
795 WorkspaceObject myTarget = *oMyTarget;
796 WorkspaceObject otherTarget = *oOtherTarget;
797 if (workspace() == other.workspace()) {
798 if (myTarget != otherTarget) {
799 return false;
800 }
801 } else {
802 if (!myTarget.dataFieldsEqual(otherTarget)) {
803 return false;
804 }
805 }
806 }
807 }
808
809 return true;
810 }
811
812 bool WorkspaceObject_Impl::objectListFieldsNonConflicting(const WorkspaceObject& other) const {
813 // Looks for object equality of targets if same workspace(), otherwise, looks for data

Callers

nothing calls this directly

Calls 5

iddObjectMethod · 0.80
dataFieldsEqualMethod · 0.80
objectListFieldsMethod · 0.45
getTargetMethod · 0.45
workspaceMethod · 0.45

Tested by

no test coverage detected