Skip to content

Commit

Permalink
create change propagator only during change propagation instead of fo…
Browse files Browse the repository at this point in the history
…r entire V-SUM lifetime
  • Loading branch information
Jan Wittler committed Oct 26, 2022
1 parent 8762ed8 commit 8c27e2c
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,20 @@ public class VirtualModelImpl implements InternalVirtualModel {
private final ViewTypeProvider viewTypeRepository;
private final VsumFileSystemLayout fileSystemLayout;
private final List<ChangePropagationListener> changePropagationListeners = new LinkedList<>();
private final ChangePropagator changePropagator;

private final ChangePropagationSpecificationProvider changePropagationSpecificationProvider;
private final InternalUserInteractor userInteractor;
private ChangePropagationMode changePropagationMode = ChangePropagationMode.TRANSITIVE_CYCLIC;

public VirtualModelImpl(VsumFileSystemLayout fileSystemLayout, InternalUserInteractor userInteractor,
ViewTypeRepository viewTypeRepository,
ChangePropagationSpecificationProvider changePropagationSpecificationProvider) {
this.fileSystemLayout = fileSystemLayout;
this.viewTypeRepository = viewTypeRepository;
resourceRepository = new ResourceRepositoryImpl(fileSystemLayout);
changePropagator = new ChangePropagator(resourceRepository, changePropagationSpecificationProvider,
userInteractor);

this.changePropagationSpecificationProvider = changePropagationSpecificationProvider;
this.userInteractor = userInteractor;
}

public void loadExistingModels() {
Expand Down Expand Up @@ -74,6 +78,8 @@ public synchronized List<PropagatedChange> propagateChange(VitruviusChange chang
LOGGER.info("Starting change propagation");
startChangePropagation(unresolvedChange);

ChangePropagator changePropagator = new ChangePropagator(resourceRepository,
changePropagationSpecificationProvider, userInteractor, changePropagationMode);
List<PropagatedChange> result = changePropagator.propagateChange(unresolvedChange);
save();

Expand Down Expand Up @@ -166,6 +172,6 @@ public <S extends ViewSelector> S createSelector(ViewType<S> viewType) {

@Override
public void setChangePropagationMode(ChangePropagationMode changePropagationMode) {
changePropagator.setChangePropagationMode(changePropagationMode);
this.changePropagationMode = changePropagationMode;
}
}

0 comments on commit 8c27e2c

Please sign in to comment.