Search in sources :

Example 1 with TracingGarbageCollector

use of org.bimserver.ifc.TracingGarbageCollector in project BIMserver by opensourceBIM.

the class RevisionMerger method merge.

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;
}
Also used : IfcProject(org.bimserver.models.ifc2x3tc1.IfcProject) IdEObject(org.bimserver.emf.IdEObject) TracingGarbageCollector(org.bimserver.ifc.TracingGarbageCollector) IncrementingOidProvider(org.bimserver.shared.IncrementingOidProvider) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 IdEObject (org.bimserver.emf.IdEObject)1 TracingGarbageCollector (org.bimserver.ifc.TracingGarbageCollector)1 IfcProject (org.bimserver.models.ifc2x3tc1.IfcProject)1 IncrementingOidProvider (org.bimserver.shared.IncrementingOidProvider)1