public IfcModel merge() throws IfcModelInterfaceException { for (IdEObject idEObject : oldModel.getValues()) { copy(resultModel, idEObject, false); } resultModel.indexGuids(); newModel.fixOids(new IncrementingOidProvider(resultModel.getHighestOid() + 1)); copyAttributesGuidObjectsAndAddNewObjects(); updateReferences(); fixExplicitNullReferences(); fixNonGuidObjects(); TracingGarbageCollector tracingGarbageCollector = new TracingGarbageCollector(resultModel); Set<IdEObject> rootObjects = new HashSet<IdEObject>(); for (IdEObject idEObject : resultModel.getValues()) { if (idEObject instanceof IfcProject) { rootObjects.add(idEObject); } } tracingGarbageCollector.mark(rootObjects); tracingGarbageCollector.sweep(); return resultModel; }