Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
274,200 | Integer () { return myDownRedNode; } | getDownRedNode |
274,201 | Set<Integer> () { return myMiddleGreenNodes; } | getMiddleGreenNodes |
274,202 | Set<Integer> (final int upNode, final int downNode, boolean strict) { Set<Integer> downWalk = getWalkNodes(upNode, false, integer -> integer > downNode); Set<Integer> upWalk = getWalkNodes(downNode, true, integer -> integer < upNode); downWalk.retainAll(upWalk); if (strict) { downWalk.remove(upNode); downWalk.remove(downNode); } return downWalk; } | getMiddleNodes |
274,203 | Integer (int startNode, int maxWalkSize, boolean isUp) { if (myRedNodes.value(startNode)) return startNode; TreeSetNodeIterator walker = new TreeSetNodeIterator(startNode, isUp); while (walker.notEmpty()) { Integer next = walker.pop(); if (myRedNodes.value(next)) return next; if (maxWalkSize < 0) return null; maxWalkSize--; walker.addAll(getNodes(next, isUp)); } return null; } | getNearRedNode |
274,204 | GreenFragment (int startNode, int maxWalkSize) { if (myRedNodes.value(startNode)) return new GreenFragment(null, null, Collections.emptySet()); Integer upRedNode = getNearRedNode(startNode, maxWalkSize, true); Integer downRedNode = getNearRedNode(startNode, maxWalkSize, false); Set<Integer> upPart = upRedNode != null ? getMiddleNodes(upRedNode, startNode, false) : getWalkNodes(startNode, true, createStopFunction(maxWalkSize)); Set<Integer> downPart = downRedNode != null ? getMiddleNodes(startNode, downRedNode, false) : getWalkNodes(startNode, false, createStopFunction(maxWalkSize)); Set<Integer> middleNodes = ContainerUtil.map2SetNotNull(ContainerUtil.union(upPart, downPart), i-> i.equals(upRedNode) || i.equals(downRedNode) ? null : i); return new GreenFragment(upRedNode, downRedNode, middleNodes); } | getGreenFragmentForCollapse |
274,205 | Set<Integer> (int startNode, boolean isUp, Condition<? super Integer> stopFunction) { Set<Integer> walkNodes = new HashSet<>(); TreeSetNodeIterator walker = new TreeSetNodeIterator(startNode, isUp); while (walker.notEmpty()) { Integer next = walker.pop(); if (!stopFunction.value(next)) { walkNodes.add(next); walker.addAll(getNodes(next, isUp)); } } return walkNodes; } | getWalkNodes |
274,206 | List<Integer> (int nodeIndex, boolean isUp) { return myGraph.getNodes(nodeIndex, LiteLinearGraph.NodeFilter.filter(isUp)); } | getNodes |
274,207 | Condition<Integer> (final int maxNodeCount) { return new Condition<>() { private int count = maxNodeCount; @Override public boolean value(Integer integer) { count--; return count < 0; } }; } | createStopFunction |
274,208 | boolean (Integer integer) { count--; return count < 0; } | value |
274,209 | void (int mainNodeId, int additionId, GraphEdgeType edgeType) { if (edgeType.isNormalEdge()) { myEdges.putValue(mainNodeId, compressEdge(additionId, edgeType)); myEdges.putValue(additionId, compressEdge(mainNodeId, edgeType)); } else { myEdges.putValue(mainNodeId, compressEdge(additionId, edgeType)); } } | createEdge |
274,210 | void (int mainNodeId, int additionId, GraphEdgeType edgeType) { if (edgeType.isNormalEdge()) { myEdges.remove(mainNodeId, compressEdge(additionId, edgeType)); myEdges.remove(additionId, compressEdge(mainNodeId, edgeType)); } else { myEdges.remove(mainNodeId, compressEdge(additionId, edgeType)); } } | removeEdge |
274,211 | int[] () { return myEdges.keys(); } | getKnownIds |
274,212 | Integer (int value) { return value == NULL_ID ? null : value; } | convertToInteger |
274,213 | int (int nodeId, GraphEdgeType edgeType) { assert nodeId == NULL_ID || (nodeId < MAX_NODE_ID && nodeId > MIN_NODE_ID); int type = edgeType.ordinal(); return (type << EDGE_BITS_OFFSET) | (COMPRESSED_NODE_ID_MASK & nodeId); } | compressEdge |
274,214 | GraphEdgeType (int compressEdge) { int type = compressEdge >>> EDGE_BITS_OFFSET; return GraphEdgeType.values()[type]; } | retrievedType |
274,215 | int (int compressEdge) { return (compressEdge << EDGE_TYPE_BITS) >> EDGE_TYPE_BITS; } | retrievedNodeId |
274,216 | void () { myEdges.clear(); } | removeAll |
274,217 | LinearGraphAnswer (@NotNull LinearGraphAnswer delegateAnswer) { if (delegateAnswer.getGraphChanges() != null) { LinearGraph delegateGraph = getDelegateController().getCompiledGraph(); myCollapsedGraph = CollapsedGraph.updateInstance(myCollapsedGraph, delegateGraph); // some new edges and node appeared, so we expand them applyDelegateChanges(delegateGraph, delegateAnswer.getGraphChanges()); } return delegateAnswer; // if somebody outside actually uses changes we return here they are screwed } | delegateGraphChanged |
274,218 | void (LinearGraph graph, GraphChanges<Integer> changes) { Set<Integer> nodesToShow = new HashSet<>(); for (GraphChanges.Edge<Integer> e : changes.getChangedEdges()) { if (!e.removed()) { Integer upId = e.upNodeId(); if (upId != null) { Integer upIndex = graph.getNodeIndex(upId); if (upIndex != null) { nodesToShow.add(upIndex); } } Integer downId = e.downNodeId(); if (downId != null) { Integer downIndex = graph.getNodeIndex(downId); if (downIndex != null) { nodesToShow.add(downIndex); } } } } for (GraphChanges.Node<Integer> e : changes.getChangedNodes()) { if (!e.removed()) { Integer nodeIndex = graph.getNodeIndex(e.getNodeId()); if (nodeIndex != null) { nodesToShow.add(nodeIndex); } } } CollapsedActionManager.expandNodes(myCollapsedGraph, nodesToShow); } | applyDelegateChanges |
274,219 | LinearGraphAnswer (@NotNull LinearGraphAction action) { return CollapsedActionManager.performAction(this, action); } | performAction |
274,220 | LinearGraph () { return myCollapsedGraph.getCompiledGraph(); } | getCompiledGraph |
274,221 | CollapsedGraph () { return myCollapsedGraph; } | getCollapsedGraph |
274,222 | GraphElement (@NotNull GraphElement graphElement) { return convertToDelegate(graphElement, myCollapsedGraph); } | convertToDelegate |
274,223 | GraphElement (@NotNull GraphElement graphElement, CollapsedGraph collapsedGraph) { if (graphElement instanceof GraphEdge) { Integer upIndex = ((GraphEdge)graphElement).getUpNodeIndex(); Integer downIndex = ((GraphEdge)graphElement).getDownNodeIndex(); if (upIndex != null && downIndex != null && collapsedGraph.isMyCollapsedEdge(upIndex, downIndex)) return null; Integer convertedUpIndex = upIndex == null ? null : collapsedGraph.convertToDelegateNodeIndex(upIndex); Integer convertedDownIndex = downIndex == null ? null : collapsedGraph.convertToDelegateNodeIndex(downIndex); return new GraphEdge(convertedUpIndex, convertedDownIndex, ((GraphEdge)graphElement).getTargetId(), ((GraphEdge)graphElement).getType()); } else if (graphElement instanceof GraphNode) { return new GraphNode(collapsedGraph.convertToDelegateNodeIndex((((GraphNode)graphElement).getNodeIndex())), ((GraphNode)graphElement).getType()); } return null; } | convertToDelegate |
274,224 | int () { return myLinearGraph.nodesCount(); } | size |
274,225 | boolean (int index) { return myNodeVisibilityById.get(nodeId(index)); } | get |
274,226 | void (int index, boolean value) { myNodeVisibilityById.set(nodeId(index), value); } | set |
274,227 | void (boolean value) { for (int index = 0; index < size(); index++) set(index, value); } | setAll |
274,228 | int (int nodeIndex) { return myLinearGraph.getNodeId(nodeIndex); } | nodeId |
274,229 | Integer () { Integer next = myWalkNodes.first(); myWalkNodes.remove(next); return next; } | pop |
274,230 | boolean () { return !myWalkNodes.isEmpty(); } | notEmpty |
274,231 | void (List<Integer> nodes) { myWalkNodes.addAll(nodes); } | addAll |
274,232 | LinearGraphAnswer (@NotNull CollapsedController graphController, @NotNull LinearGraphAction action) { ActionContext context = new ActionContext(graphController.getCollapsedGraph(), graphController.getPermanentGraphInfo(), action); for (ActionCase actionCase : FILTER_ACTION_CASES) { if (actionCase.supportedActionTypes().contains(context.getActionType())) { LinearGraphAnswer graphAnswer = actionCase.performAction(context); if (graphAnswer != null) return graphAnswer; } } return null; } | performAction |
274,233 | void (@NotNull final CollapsedGraph collapsedGraph, Set<Integer> nodesToShow) { FragmentGenerator generator = new FragmentGenerator(LinearGraphUtils.asLiteLinearGraph(collapsedGraph.getDelegatedGraph()), nodeIndex -> collapsedGraph.isNodeVisible(nodeIndex)); CollapsedGraph.Modification modification = collapsedGraph.startModification(); for (Integer nodeToShow : nodesToShow) { if (modification.isNodeShown(nodeToShow)) continue; FragmentGenerator.GreenFragment fragment = generator.getGreenFragmentForCollapse(nodeToShow, Integer.MAX_VALUE); if (fragment.getUpRedNode() == null || fragment.getDownRedNode() == null || fragment.getUpRedNode().equals(fragment.getDownRedNode())) { continue; } for (Integer n : fragment.getMiddleGreenNodes()) { modification.showNode(n); } modification.removeEdge(GraphEdge.createNormalEdge(fragment.getUpRedNode(), fragment.getDownRedNode(), GraphEdgeType.DOTTED)); } modification.apply(); } | expandNodes |
274,234 | LinearGraphAnswer (@NotNull final ActionContext context) { if (isForDelegateGraph(context)) return null; GraphElement affectedGraphElement = context.getAffectedGraphElement(); if (affectedGraphElement == null) return null; LinearFragmentGenerator compiledLinearFragmentGenerator = context.myCompiledFragmentGenerators.linearFragmentGenerator; FragmentGenerator compiledFragmentGenerator = context.myCompiledFragmentGenerators.fragmentGenerator; if (context.getActionType() == GraphAction.Type.MOUSE_OVER) { GraphFragment fragment = compiledLinearFragmentGenerator.getPartLongFragment(affectedGraphElement); if (fragment == null) return null; Set<Integer> middleCompiledNodes = compiledFragmentGenerator.getMiddleNodes(fragment.upNodeIndex, fragment.downNodeIndex, false); return LinearGraphUtils.createSelectedAnswer(context.getCompiledGraph(), middleCompiledNodes); } GraphFragment fragment = compiledLinearFragmentGenerator.getLongFragment(affectedGraphElement); if (fragment == null) return null; Set<Integer> middleCompiledNodes = compiledFragmentGenerator.getMiddleNodes(fragment.upNodeIndex, fragment.downNodeIndex, true); Set<GraphEdge> dottedCompiledEdges = new HashSet<>(); for (Integer middleNodeIndex : middleCompiledNodes) { dottedCompiledEdges.addAll(ContainerUtil.filter(context.getCompiledGraph().getAdjacentEdges(middleNodeIndex, EdgeFilter.NORMAL_ALL), edge -> edge.getType() == GraphEdgeType.DOTTED)); } int upNodeIndex = context.convertToDelegateNodeIndex(fragment.upNodeIndex); int downNodeIndex = context.convertToDelegateNodeIndex(fragment.downNodeIndex); Set<Integer> middleNodes = context.convertToDelegateNodeIndex(middleCompiledNodes); Set<GraphEdge> dottedEdges = ContainerUtil.map2Set(dottedCompiledEdges, edge -> context.convertToDelegateEdge(edge)); CollapsedGraph.Modification modification = context.myCollapsedGraph.startModification(); for (GraphEdge edge : dottedEdges) modification.removeEdge(edge); for (Integer middleNode : middleNodes) modification.hideNode(middleNode); modification.createEdge(new GraphEdge(upNodeIndex, downNodeIndex, null, GraphEdgeType.DOTTED)); modification.apply(); return new LinearGraphController.LinearGraphAnswer(GraphChangesUtil.SOME_CHANGES); } | performAction |
274,235 | LinearGraphAnswer (@NotNull ActionContext context) { CollapsedGraph.Modification modification = context.myCollapsedGraph.startModification(); modification.removeAdditionalEdges(); modification.resetNodesVisibility(); return new DeferredGraphAnswer(GraphChangesUtil.SOME_CHANGES, modification); } | performAction |
274,236 | LinearGraphAnswer (@NotNull ActionContext context) { CollapsedGraph.Modification modification = context.myCollapsedGraph.startModification(); modification.removeAdditionalEdges(); modification.resetNodesVisibility(); LinearGraph delegateGraph = context.getDelegatedGraph(); for (int nodeIndex = 0; nodeIndex < delegateGraph.nodesCount(); nodeIndex++) { if (modification.isNodeHidden(nodeIndex)) continue; GraphFragment fragment = context.myDelegatedFragmentGenerators.linearFragmentGenerator.getLongDownFragment(nodeIndex); if (fragment != null) { Set<Integer> middleNodes = context.myDelegatedFragmentGenerators.fragmentGenerator.getMiddleNodes(fragment.upNodeIndex, fragment.downNodeIndex, true); for (Integer nodeIndexForHide : middleNodes) modification.hideNode(nodeIndexForHide); modification.createEdge(new GraphEdge(fragment.upNodeIndex, fragment.downNodeIndex, null, GraphEdgeType.DOTTED)); } } return new DeferredGraphAnswer(GraphChangesUtil.SOME_CHANGES, modification); } | performAction |
274,237 | LinearGraphAnswer (@NotNull ActionContext context) { if (isForDelegateGraph(context)) return null; GraphEdge dottedEdge = getDottedEdge(context.getAffectedGraphElement(), context.getCompiledGraph()); if (dottedEdge != null) { int upNodeIndex = context.convertToDelegateNodeIndex(assertInt(dottedEdge.getUpNodeIndex())); int downNodeIndex = context.convertToDelegateNodeIndex(assertInt(dottedEdge.getDownNodeIndex())); if (context.getActionType() == GraphAction.Type.MOUSE_OVER) { return LinearGraphUtils.createSelectedAnswer(context.getDelegatedGraph(), Set.of(upNodeIndex, downNodeIndex)); } Set<Integer> middleNodes = context.myDelegatedFragmentGenerators.fragmentGenerator.getMiddleNodes(upNodeIndex, downNodeIndex, true); CollapsedGraph.Modification modification = context.myCollapsedGraph.startModification(); for (Integer middleNode : middleNodes) { modification.showNode(middleNode); } modification.removeEdge(new GraphEdge(upNodeIndex, downNodeIndex, null, GraphEdgeType.DOTTED)); modification.apply(); return new LinearGraphController.LinearGraphAnswer(GraphChangesUtil.SOME_CHANGES); } return null; } | performAction |
274,238 | boolean (@NotNull ActionContext context) { GraphElement affectedGraphElement = context.getAffectedGraphElement(); if (affectedGraphElement == null) return false; GraphEdge dottedEdge = getDottedEdge(context.getAffectedGraphElement(), context.getCompiledGraph()); if (dottedEdge != null) { int upNodeIndex = context.convertToDelegateNodeIndex(assertInt(dottedEdge.getUpNodeIndex())); int downNodeIndex = context.convertToDelegateNodeIndex(assertInt(dottedEdge.getDownNodeIndex())); if (!context.myCollapsedGraph.isMyCollapsedEdge(upNodeIndex, downNodeIndex)) return true; } return false; } | isForDelegateGraph |
274,239 | int (@Nullable Integer value) { assert value != null; return value; } | assertInt |
274,240 | GraphEdge (@Nullable GraphElement graphElement, @NotNull LinearGraph graph) { if (graphElement == null) return null; if (graphElement instanceof GraphEdge && ((GraphEdge)graphElement).getType() == GraphEdgeType.DOTTED) return (GraphEdge)graphElement; if (graphElement instanceof GraphNode node) { for (GraphEdge edge : graph.getAdjacentEdges(node.getNodeIndex(), EdgeFilter.NORMAL_ALL)) { if (edge.getType() == GraphEdgeType.DOTTED) return edge; } } return null; } | getDottedEdge |
274,241 | Runnable () { return () -> myModification.apply(); } | getGraphUpdater |
274,242 | IntSet () { IntSet collapsedMerges = new IntOpenHashSet(); for (int i = myLinearBekGraph.myGraph.nodesCount() - 1; i >= 0; i--) { MergeFragment fragment = getFragment(i); if (fragment != null) { fragment.collapse(myLinearBekGraph); collapsedMerges.add(fragment.getParent()); } } return collapsedMerges; } | collapseAll |
274,243 | MergeFragment (int mergeCommit) { MergeFragment fragment = getFragment(mergeCommit); if (fragment != null) { fragment.collapse(myLinearBekGraph); return fragment; } return null; } | collapseFragment |
274,244 | MergeFragment (int mergeCommit) { List<Integer> downNodes = ContainerUtil.sorted(LinearGraphUtils.getDownNodes(myLinearBekGraph, mergeCommit)); if (downNodes.size() != 2) return null; return getFragment(downNodes.get(1), downNodes.get(0), mergeCommit); } | getFragment |
274,245 | MergeFragment (int leftChild, int rightChild, int parent) { MergeFragment fragment = new MergeFragment(parent, leftChild, rightChild); int leftLi = myGraphLayout.getLayoutIndex(leftChild); int rightLi = myGraphLayout.getLayoutIndex(rightChild); int rowsCount = 1; int blockSize = 1; PriorityQueue<GraphEdge> queue = new PriorityQueue<>(MAX_BLOCK_SIZE, new GraphEdgeComparator()); queue.addAll(myLinearBekGraph.getAdjacentEdges(rightChild, EdgeFilter.NORMAL_DOWN)); @Nullable Set<Integer> magicSet = null; while (!queue.isEmpty()) { GraphEdge nextEdge = queue.poll(); Integer next = nextEdge.getDownNodeIndex(); Integer upNodeIndex = nextEdge.getUpNodeIndex(); assert upNodeIndex != null; // can not happen if (next == null) { fragment.addTail(upNodeIndex); continue; // allow very long edges down } if (next == leftChild) { // found first child fragment.addTail(upNodeIndex); fragment.setMergeWithOldCommit(true); } else if (next == rightChild + rowsCount) { // all is fine, continuing rowsCount++; blockSize++; queue.addAll(myLinearBekGraph.getAdjacentEdges(next, EdgeFilter.NORMAL_DOWN)); fragment.addBody(upNodeIndex); } else if (next > rightChild + rowsCount && next < leftChild) { rowsCount = next - rightChild + 1; blockSize++; queue.addAll(myLinearBekGraph.getAdjacentEdges(next, EdgeFilter.NORMAL_DOWN)); fragment.addBody(upNodeIndex); } else if (next > leftChild) { int li = myGraphLayout.getLayoutIndex(next); if (leftLi > rightLi && !fragment.isMergeWithOldCommit()) { if (next > leftChild + MAGIC_SET_SIZE) { return null; } if (magicSet == null) { magicSet = calculateMagicSet(leftChild); } if (magicSet.contains(next)) { fragment.addTailEdge(upNodeIndex, next); } else { return null; } } else { if ((li > leftLi && li < rightLi) || (li == leftLi)) { fragment.addTailEdge(upNodeIndex, next); } else { if (li >= rightLi) { return null; } else { if (next > leftChild + MAGIC_SET_SIZE) { if (!fragment.hasTailEdge(upNodeIndex) && !fragment.isBody(upNodeIndex)) return null; } else { if (magicSet == null) { magicSet = calculateMagicSet(leftChild); } if (magicSet.contains(next)) { fragment.addTailEdge(upNodeIndex, next); } else { return null; } } } } } } if (blockSize >= MAX_BLOCK_SIZE) { return null; } } if (fragment.getTails().isEmpty()) { return null; // this can happen if we ran into initial import } return fragment; } | getFragment |
274,246 | Set<Integer> (int node) { Set<Integer> magicSet; magicSet = new HashSet<>(MAGIC_SET_SIZE); PriorityQueue<Integer> magicQueue = new PriorityQueue<>(MAGIC_SET_SIZE); magicQueue.addAll(ContainerUtil.map(myLinearBekGraph.getAdjacentEdges(node, EdgeFilter.NORMAL_DOWN), GRAPH_EDGE_TO_DOWN_NODE)); while (!magicQueue.isEmpty()) { Integer i = magicQueue.poll(); if (i > node + MAGIC_SET_SIZE) break; magicSet.add(i); magicQueue.addAll(ContainerUtil.map(myLinearBekGraph.getAdjacentEdges(i, EdgeFilter.NORMAL_DOWN), GRAPH_EDGE_TO_DOWN_NODE)); } return magicSet; } | calculateMagicSet |
274,247 | boolean () { return myMergeWithOldCommit; } | isMergeWithOldCommit |
274,248 | void (boolean mergeWithOldCommit) { myMergeWithOldCommit = mergeWithOldCommit; } | setMergeWithOldCommit |
274,249 | void (int tail) { if (!myBlockBody.contains(tail)) { myTails.add(tail); } } | addTail |
274,250 | void (int upNodeIndex, int downNodeIndex) { if (!myBlockBody.contains(upNodeIndex)) { myTails.add(upNodeIndex); myTailEdges.putValue(upNodeIndex, downNodeIndex); } } | addTailEdge |
274,251 | void (int body) { myBlockBody.add(body); } | addBody |
274,252 | IntSet () { return myTails; } | getTails |
274,253 | Set<Integer> () { Set<Integer> nodes = new HashSet<>(); IntIterator it = myBlockBody.iterator(); while (it.hasNext()) { nodes.add(it.nextInt()); } it = myTails.iterator(); while (it.hasNext()) { nodes.add(it.nextInt()); } return nodes; } | getTailsAndBody |
274,254 | Set<Integer> () { Set<Integer> nodes = new HashSet<>(); nodes.add(myParent); nodes.add(myLeftChild); nodes.add(myRightChild); nodes.addAll(getTailsAndBody()); return nodes; } | getAllNodes |
274,255 | void (LinearBekGraph graph) { for (int upNodeIndex : myTailEdges.keys()) { for (int downNodeIndex : myTailEdges.get(upNodeIndex)) { removeEdge(graph, upNodeIndex, downNodeIndex); } } IntIterator it = myTails.iterator(); while (it.hasNext()) { int tail = it.nextInt(); if (!LinearGraphUtils.getDownNodes(graph, tail).contains(myLeftChild)) { addEdge(graph, tail, myLeftChild); } else { replaceEdge(graph, tail, myLeftChild); } } removeEdge(graph, myParent, myLeftChild); } | collapse |
274,256 | void (LinearBekGraph graph, int up, int down) { graph.myDottedEdges.createEdge(new GraphEdge(up, down, null, GraphEdgeType.DOTTED)); } | addEdge |
274,257 | void (LinearBekGraph graph, int up, int down) { if (graph.myDottedEdges.hasEdge(up, down)) { graph.myDottedEdges.removeEdge(new GraphEdge(up, down, null, GraphEdgeType.DOTTED)); graph.myHiddenEdges.createEdge(new GraphEdge(up, down, null, GraphEdgeType.DOTTED)); } else { GraphEdge edge = LinearGraphUtils.getEdge(graph.myGraph, up, down); assert edge != null : "No edge between " + up + " and " + down; graph.myHiddenEdges.createEdge(edge); } } | removeEdge |
274,258 | void (LinearBekGraph graph, int up, int down) { if (!graph.myDottedEdges.hasEdge(up, down)) { GraphEdge edge = LinearGraphUtils.getEdge(graph.myGraph, up, down); assert edge != null : "No edge between " + up + " and " + down; graph.myHiddenEdges.createEdge(edge); graph.myDottedEdges.createEdge(new GraphEdge(up, down, null, GraphEdgeType.DOTTED)); } } | replaceEdge |
274,259 | int () { return myParent; } | getParent |
274,260 | boolean (Integer index) { return !myTailEdges.get(index).isEmpty(); } | hasTailEdge |
274,261 | boolean (int index) { return myBlockBody.contains(index); } | isBody |
274,262 | int () { return myLeftChild; } | getLeftChild |
274,263 | int (@NotNull GraphEdge e1, @NotNull GraphEdge e2) { Integer d1 = e1.getDownNodeIndex(); Integer d2 = e2.getDownNodeIndex(); if (d1 == null) { if (d2 == null) return e1.hashCode() - e2.hashCode(); return 1; } if (d2 == null) return -1; return d1.compareTo(d2); } | compare |
274,264 | Integer (GraphEdge graphEdge) { return graphEdge.getDownNodeIndex(); } | fun |
274,265 | int () { return myGraph.nodesCount(); } | nodesCount |
274,266 | List<GraphEdge> (int nodeIndex, @NotNull EdgeFilter filter) { List<GraphEdge> result = new ArrayList<>(); result.addAll(myDottedEdges.getAdjacentEdges(nodeIndex, filter)); result.addAll(myGraph.getAdjacentEdges(nodeIndex, filter)); result.removeAll(myHiddenEdges.getAdjacentEdges(nodeIndex, filter)); return result; } | getAdjacentEdges |
274,267 | GraphNode (int nodeIndex) { return myGraph.getGraphNode(nodeIndex); } | getGraphNode |
274,268 | int (int nodeIndex) { return myGraph.getNodeId(nodeIndex); } | getNodeId |
274,269 | Integer (int nodeId) { return myGraph.getNodeIndex(nodeId); } | getNodeIndex |
274,270 | Collection<GraphEdge> (@NotNull final GraphEdge edge) { Set<GraphEdge> result = new HashSet<>(); assert edge.getType() == GraphEdgeType.DOTTED; myDottedEdges.removeEdge(edge); Integer tail = edge.getUpNodeIndex(); Integer firstChild = edge.getDownNodeIndex(); assert tail != null : "Collapsed from to an unloaded node"; assert firstChild != null : "Collapsed edge to an unloaded node"; List<GraphEdge> downDottedEdges = myHiddenEdges.getAdjacentEdges(tail, EdgeFilter.NORMAL_DOWN); List<GraphEdge> upDottedEdges = myHiddenEdges.getAdjacentEdges(firstChild, EdgeFilter.NORMAL_UP); for (GraphEdge e : ContainerUtil.concat(downDottedEdges, upDottedEdges)) { myHiddenEdges.removeEdge(e); if (e.getType() == GraphEdgeType.DOTTED) { result.addAll(expandEdge(e)); } else { result.add(e); } } return result; } | expandEdge |
274,271 | Collection<GraphEdge> () { Set<GraphEdge> result = myDottedEdges.getEdges(); result.removeAll(ContainerUtil.filter(myHiddenEdges.getEdges(), graphEdge -> graphEdge.getType() == GraphEdgeType.DOTTED)); result.removeAll(myLinearGraph.myDottedEdges.getEdges()); return result; } | getAddedEdges |
274,272 | Collection<GraphEdge> () { Set<GraphEdge> result = new HashSet<>(); Set<GraphEdge> hidden = myHiddenEdges.getEdges(); result.addAll(ContainerUtil.filter(hidden, graphEdge -> graphEdge.getType() != GraphEdgeType.DOTTED)); result.addAll(ContainerUtil.intersection(hidden, myLinearGraph.myDottedEdges.getEdges())); result.removeAll(myLinearGraph.myHiddenEdges.getEdges()); return result; } | getRemovedEdges |
274,273 | void () { myLinearGraph.myDottedEdges.removeAll(); myLinearGraph.myHiddenEdges.removeAll(); for (GraphEdge e : myDottedEdges.getEdges()) { myLinearGraph.myDottedEdges.createEdge(e); } for (GraphEdge e : myHiddenEdges.getEdges()) { myLinearGraph.myHiddenEdges.createEdge(e); } } | applyChanges |
274,274 | NodeFilter (boolean isUp) { return isUp ? UP : DOWN; } | filter |
274,275 | boolean () { return myIsNormalEdge; } | isNormalEdge |
274,276 | GraphEdge (int nodeIndex1, int nodeIndex2, @NotNull GraphEdgeType type) { assert type.isNormalEdge() : "Unexpected edge type: " + type; return new GraphEdge(Math.min(nodeIndex1, nodeIndex2), Math.max(nodeIndex1, nodeIndex2), null, type); } | createNormalEdge |
274,277 | GraphEdge (int nodeIndex, @Nullable Integer targetId, @NotNull GraphEdgeType type) { return switch (type) { case DOTTED_ARROW_UP -> new GraphEdge(null, nodeIndex, targetId, type); case NOT_LOAD_COMMIT, DOTTED_ARROW_DOWN -> new GraphEdge(nodeIndex, null, targetId, type); default -> throw new AssertionError("Unexpected edge type: " + type); }; } | createEdgeWithTargetId |
274,278 | Integer () { return myUpNodeIndex; } | getUpNodeIndex |
274,279 | Integer () { return myDownNodeIndex; } | getDownNodeIndex |
274,280 | Integer () { return myTargetId; } | getTargetId |
274,281 | GraphEdgeType () { return myType; } | getType |
274,282 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GraphEdge graphEdge = (GraphEdge)o; if (myType != graphEdge.myType) return false; if (!Objects.equals(myUpNodeIndex, graphEdge.myUpNodeIndex)) return false; if (!Objects.equals(myDownNodeIndex, graphEdge.myDownNodeIndex)) return false; if (!Objects.equals(myTargetId, graphEdge.myTargetId)) return false; return true; } | equals |
274,283 | int () { int result = myUpNodeIndex != null ? myUpNodeIndex.hashCode() : 0; result = 31 * result + (myDownNodeIndex != null ? myDownNodeIndex.hashCode() : 0); result = 31 * result + (myTargetId != null ? myTargetId.hashCode() : 0); result = 31 * result + myType.hashCode(); return result; } | hashCode |
274,284 | int () { return myNodeIndex; } | getNodeIndex |
274,285 | GraphNodeType () { return myType; } | getType |
274,286 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GraphNode graphNode = (GraphNode)o; if (myNodeIndex != graphNode.myNodeIndex) return false; if (myType != graphNode.myType) return false; return true; } | equals |
274,287 | int () { int result = myNodeIndex; result = 31 * result + myType.hashCode(); return result; } | hashCode |
274,288 | List<Integer> (Integer integer) { return myLinearGraph.getNodes(integer, UP); } | fun |
274,289 | List<Integer> (Integer integer) { return myLinearGraph.getNodes(integer, DOWN); } | fun |
274,290 | GraphFragment (@NotNull GraphElement element) { int upNodeIndex; int downNodeIndex; if (element instanceof GraphNode) { upNodeIndex = ((GraphNode)element).getNodeIndex(); downNodeIndex = upNodeIndex; } else { NormalEdge graphEdge = LinearGraphUtils.asNormalEdge(((GraphEdge)element)); if (graphEdge == null) return null; upNodeIndex = graphEdge.up; downNodeIndex = graphEdge.down; } for (int i = 0; i < MAX_SEARCH_SIZE; i++) { GraphFragment graphFragment = getDownFragment(upNodeIndex); if (graphFragment != null && graphFragment.downNodeIndex >= downNodeIndex) return graphFragment; List<Integer> upNodes = myLinearGraph.getNodes(upNodeIndex, UP); if (upNodes.size() != 1) { break; } upNodeIndex = upNodes.get(0); } return null; } | getRelativeFragment |
274,291 | GraphFragment (int upperVisibleNodeIndex) { return getFragment(upperVisibleNodeIndex, downNodesFun, upNodesFun, myPinnedNodes, true); } | getDownFragment |
274,292 | GraphFragment (int lowerNodeIndex) { return getFragment(lowerNodeIndex, upNodesFun, downNodesFun, myPinnedNodes, false); } | getUpFragment |
274,293 | GraphFragment (int rowIndex) { return getLongFragment(getDownFragment(rowIndex), Integer.MAX_VALUE); } | getLongDownFragment |
274,294 | GraphFragment (@NotNull GraphElement element) { return getLongFragment(getRelativeFragment(element), Integer.MAX_VALUE); } | getLongFragment |
274,295 | GraphFragment (@NotNull GraphElement element) { return getLongFragment(getRelativeFragment(element), 500); } | getPartLongFragment |
274,296 | GraphFragment (@Nullable GraphFragment startFragment, int bound) { if (startFragment == null) return null; GraphFragment shortFragment; int maxDown = startFragment.downNodeIndex; while ((shortFragment = getDownFragment(maxDown)) != null && !myPinnedNodes.contains(maxDown)) { maxDown = shortFragment.downNodeIndex; if (maxDown - startFragment.downNodeIndex > bound) break; } int maxUp = startFragment.upNodeIndex; while ((shortFragment = getUpFragment(maxUp)) != null && !myPinnedNodes.contains(maxUp)) { maxUp = shortFragment.upNodeIndex; if (startFragment.upNodeIndex - maxUp > bound) break; } if (maxUp != startFragment.upNodeIndex || maxDown != startFragment.downNodeIndex) { return new GraphFragment(maxUp, maxDown); } else { // start fragment is Simple if (myLinearGraph.getNodes(startFragment.upNodeIndex, DOWN).size() != 1) return startFragment; } return null; } | getLongFragment |
274,297 | GraphFragment (int startNode, Function<? super Integer, ? extends List<Integer>> getNextNodes, Function<? super Integer, ? extends List<Integer>> getPrevNodes, Set<Integer> thisNodeCantBeInMiddle, boolean isDown) { Set<Integer> blackNodes = new HashSet<>(); blackNodes.add(startNode); Set<Integer> grayNodes = new HashSet<>(getNextNodes.fun(startNode)); int endNode = -1; while (blackNodes.size() < SHORT_FRAGMENT_MAX_SIZE) { int nextBlackNode = -1; for (int grayNode : grayNodes) { if (blackNodes.containsAll(getPrevNodes.fun(grayNode))) { nextBlackNode = grayNode; break; } } if (nextBlackNode == -1) return null; if (grayNodes.size() == 1) { endNode = nextBlackNode; break; } List<Integer> nextGrayNodes = getNextNodes.fun(nextBlackNode); if (nextGrayNodes.isEmpty() || thisNodeCantBeInMiddle.contains(nextBlackNode)) return null; blackNodes.add(nextBlackNode); grayNodes.remove(nextBlackNode); grayNodes.addAll(nextGrayNodes); } if (endNode != -1) { return isDown ? GraphFragment.create(startNode, endNode) : GraphFragment.create(endNode, startNode); } else { return null; } } | getFragment |
274,298 | GraphFragment (int startNode, int endNode) { return new GraphFragment(startNode, endNode); } | create |
274,299 | void (int upNodeIndex, CommitId downCommitId) { List<Integer> upNodes = upAdjacentNodes.get(downCommitId); if (upNodes == null) { upNodes = new SmartList<>(); upAdjacentNodes.put(downCommitId, upNodes); } upNodes.add(upNodeIndex); } | addUnderdoneEdge |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.