@NotNull @Override public VisibleGraph<CommitId> createVisibleGraph( @NotNull SortType sortType, @Nullable Set<CommitId> visibleHeads, @Nullable Set<CommitId> matchingCommits) { CascadeController baseController; if (sortType == SortType.Normal) { baseController = new BaseController(this); } else if (sortType == SortType.LinearBek) { baseController = new LinearBekController(new BekBaseController(this, myBekIntMap), this); } else { baseController = new BekBaseController(this, myBekIntMap); } LinearGraphController controller; if (matchingCommits != null) { controller = new FilteredController( baseController, this, myPermanentCommitsInfo.convertToNodeIds(matchingCommits)); } else if (sortType == SortType.LinearBek) { if (visibleHeads != null) { controller = new BranchFilterController( baseController, this, myPermanentCommitsInfo.convertToNodeIds(visibleHeads)); } else { controller = baseController; } } else { Set<Integer> idOfVisibleBranches = null; if (visibleHeads != null) { idOfVisibleBranches = myPermanentCommitsInfo.convertToNodeIds(visibleHeads); } controller = new CollapsedController(baseController, this, idOfVisibleBranches); } return new VisibleGraphImpl<CommitId>(controller, this); }
public PermanentGraphImpl( @NotNull PermanentLinearGraphImpl permanentLinearGraph, @NotNull GraphLayoutImpl permanentGraphLayout, @NotNull PermanentCommitsInfoIml<CommitId> permanentCommitsInfo, @NotNull GraphColorManager<CommitId> graphColorManager, @NotNull Set<CommitId> branchesCommitId) { myPermanentGraphLayout = permanentGraphLayout; myPermanentCommitsInfo = permanentCommitsInfo; myPermanentLinearGraph = permanentLinearGraph; myGraphColorManager = graphColorManager; myBranchesCommitId = branchesCommitId; myBranchNodeIds = permanentCommitsInfo.convertToNodeIds(branchesCommitId); myReachableNodes = new ReachableNodes(LinearGraphUtils.asLiteLinearGraph(permanentLinearGraph)); myBekIntMap = BekSorter.createBekMap( myPermanentLinearGraph, myPermanentGraphLayout, myPermanentCommitsInfo.getTimestampGetter()); }