Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
274,100 | long (int index) { int delta = myDeltas.get(index); if (delta != BROKEN_DELTA) return delta; return myBrokenDeltas.get(index); } | getDelta |
274,101 | void (int index) { if (index < 0) throw new IndexOutOfBoundsException("index < 0:" + index); if (index >= size()) throw new IndexOutOfBoundsException("index: " + index + " >= size: " + size()); } | checkRange |
274,102 | IntList (final int[] delegateArray) { return newInstance(delegateArray, DEFAULT_BLOCK_SIZE); } | newInstance |
274,103 | IntList (final int[] delegateArray, int blockSize) { return newInstance(new IntList() { @Override public int size() { return delegateArray.length; } @Override public int get(int index) { return delegateArray[index]; } }, blockSize); } | newInstance |
274,104 | int () { return delegateArray.length; } | size |
274,105 | int (int index) { return delegateArray[index]; } | get |
274,106 | IntList (final IntList delegateList, final int blockSize) { if (blockSize < 1) throw new IllegalArgumentException("Unsupported blockSize:" + blockSize); if (delegateList.size() == 0) return new FullIntList(new int[0]); IntList intDeltaCompressor = SmartDeltaCompressor.newInstance(new IntList() { @Override public int size() { return delegateList.size(); } @Override public int get(int index) { return delegateList.get(index) - delegateList.get(index - (index % blockSize)); } }); int[] strongValues = new int[(delegateList.size() - 1) / blockSize + 1]; for (int i = 0; i < strongValues.length; i++) { strongValues[i] = delegateList.get(i * blockSize); } return new CompressedIntList(blockSize, strongValues, intDeltaCompressor); } | newInstance |
274,107 | int () { return delegateList.size(); } | size |
274,108 | int (int index) { return delegateList.get(index) - delegateList.get(index - (index % blockSize)); } | get |
274,109 | int () { return myCompressedDeltas.size(); } | size |
274,110 | int (int index) { int strongIndex = index / myBlockSize; return myStrongValues[strongIndex] + myCompressedDeltas.get(index); } | get |
274,111 | int () { return mySize; } | size |
274,112 | boolean (int index) { checkRange(index); return myBitSet.get(index); } | get |
274,113 | void (int index, boolean value) { checkRange(index); myBitSet.set(index, value); } | set |
274,114 | void (boolean value) { myBitSet.set(0, mySize, value); } | setAll |
274,115 | void (int index) { if (index < 0) throw new IndexOutOfBoundsException("index is " + index + " which is less than zero"); if (index >= mySize) throw new IndexOutOfBoundsException("index is " + index + " and set size is " + mySize); } | checkRange |
274,116 | boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; BitSetFlags flags = (BitSetFlags)o; return mySize == flags.mySize && myBitSet.equals(flags.myBitSet); } | equals |
274,117 | int () { return Objects.hash(mySize, myBitSet); } | hashCode |
274,118 | String () { return myBitSet + ", size = " + mySize; // NON-NLS } | toString |
274,119 | UpdatableIntToIntMap (@NotNull final Predicate<? super Integer> thisIsVisible, final int longSize) { if (longSize < 0) throw new NegativeArraySizeException("size < 0: " + longSize); if (longSize == 0) return IDIntToIntMap.EMPTY; int countLevels; // longSize -> countLevels: 1..2 -> 2; 3..4 -> 3; 5..8 -> 4 if (longSize == 1) { countLevels = 2; } else { countLevels = countDigits(longSize - 1) + 1; } int[] emptyTree = new int[(1 << (countLevels - 1))]; TreeIntToIntMap intToIntMap = new TreeIntToIntMap(thisIsVisible, longSize, countLevels, emptyTree); intToIntMap.update(0, longSize - 1); return intToIntMap; } | newInstance |
274,120 | int (int longSize) { int count = 0; while (longSize != 0) { count++; longSize >>= 1; } return count; } | countDigits |
274,121 | int () { return myTree[1]; } | shortSize |
274,122 | int () { return myLongSize; } | longSize |
274,123 | int (int shortIndex) { checkShortIndex(shortIndex); int node = 1; for (int level = 0; level < myCountLevels - 1; level++) { int child = node << 1; int countInChildNode = getCountInNode(child); if (countInChildNode > shortIndex) { node = child; } else { node = child + 1; shortIndex -= countInChildNode; } } return node - myTree.length; } | getLongIndex |
274,124 | void (int startLongIndex, int endLongIndex) { checkUpdateParameters(startLongIndex, endLongIndex); int startNode = startLongIndex + myTree.length; int endNode = endLongIndex + myTree.length; int commonNode = startNode >> countDigits(startNode ^ endNode); updateNodeCount(commonNode); int parent = commonNode >> 1; while (parent != 0) { myTree[parent] = getCountInNode(parent << 1) + getCountInNode((parent << 1) + 1); parent >>= 1; } } | update |
274,125 | boolean (int node) { return node >= myTree.length; } | isLastLevel |
274,126 | int (int node) { if (isLastLevel(node)) return getCountInLastLevel(node); int child = node << 1; myTree[node] = updateNodeCount(child) + updateNodeCount(child + 1); return myTree[node]; } | updateNodeCount |
274,127 | int (int node) { node -= myTree.length; if (node < myLongSize && myThisIsVisible.test(node)) { return 1; } else { return 0; } } | getCountInLastLevel |
274,128 | int (int node) { if (isLastLevel(node)) { return getCountInLastLevel(node); } else { return myTree[node]; } } | getCountInNode |
274,129 | int () { return size; } | shortSize |
274,130 | int () { return size; } | longSize |
274,131 | int (int shortIndex) { return shortIndex; } | getLongIndex |
274,132 | int (int longIndex) { return longIndex; } | getShortIndex |
274,133 | void (int startLongIndex, int endLongIndex) { // do nothing } | update |
274,134 | int () { return mySize; } | size |
274,135 | boolean (int index) { return myVisible.test(index); } | get |
274,136 | void (int index, boolean value) { throw new UnsupportedOperationException("Modification is not supported"); } | set |
274,137 | void (boolean value) { throw new UnsupportedOperationException("Modification is not supported"); } | setAll |
274,138 | FullIntList (@NotNull IntList delegateList) { int[] list = new int[delegateList.size()]; for (int i = 0; i < list.length; i++) { list[i] = delegateList.get(i); } return new FullIntList(list); } | newInstance |
274,139 | int () { return myList.length; } | size |
274,140 | int (int index) { return myList[index]; } | get |
274,141 | IntToIntMap (@NotNull Flags visibleIndexes, int shortSize) { return newInstance(visibleIndexes, shortSize, DEFAULT_BLOCK_SIZE); } | newInstance |
274,142 | IntToIntMap (@NotNull final Flags visibleIndexes, int shortSize, int blockSize) { if (shortSize < 0) throw new NegativeArraySizeException("shortSize < 0: " + shortSize); if (shortSize == 0) return createEmptyIntToIntMap(visibleIndexes); int[] strongShortIndexes = new int[(shortSize - 1) / blockSize + 1]; int currentShortIndex = -1; for (int longIndex = 0; longIndex < visibleIndexes.size(); longIndex++) { if (visibleIndexes.get(longIndex)) { currentShortIndex++; if (currentShortIndex % blockSize == 0) strongShortIndexes[currentShortIndex / blockSize] = longIndex; } } return new PermanentListIntToIntMap(visibleIndexes, shortSize, blockSize, strongShortIndexes); } | newInstance |
274,143 | IntToIntMap (@NotNull final Flags visibleIndexes) { return new IntToIntMap() { @Override public int shortSize() { return 0; } @Override public int longSize() { return visibleIndexes.size(); } @Override public int getLongIndex(int shortIndex) { return 0; } @Override public int getShortIndex(int longIndex) { return 0; } }; } | createEmptyIntToIntMap |
274,144 | int () { return 0; } | shortSize |
274,145 | int () { return visibleIndexes.size(); } | longSize |
274,146 | int (int shortIndex) { return 0; } | getLongIndex |
274,147 | int (int longIndex) { return 0; } | getShortIndex |
274,148 | int () { return myShortSize; } | shortSize |
274,149 | int () { return myLongSize; } | longSize |
274,150 | int (int shortIndex) { checkShortIndex(shortIndex); int strongIndex = shortIndex / myBlockSize; int sub = shortIndex - strongIndex * myBlockSize; for (int longIndex = myStrongShortIndexes[strongIndex]; longIndex < myLongSize; longIndex++) { if (myVisibleIndexes.get(longIndex)) sub--; if (sub == -1) return longIndex; } throw new IllegalStateException( "Not found long index for short index: " + shortIndex + ". Long & short size is: " + myLongSize + ", " + myShortSize + "."); } | getLongIndex |
274,151 | int (int longIndex) { checkLongIndex(longIndex); if (shortSize() == 0 || getLongIndex(0) > longIndex) return 0; int a = 0; int b = shortSize() - 1; while (b > a + 1) { int middle = (a + b) / 2; if (getLongIndex(middle) <= longIndex) { a = middle; } else { b = middle; } } return getLongIndex(b) <= longIndex ? b : a; } | getShortIndex |
274,152 | void (int longIndex) { if (longIndex < 0 || longIndex >= longSize()) { throw new IndexOutOfBoundsException("LongSize is: " + longSize() + ", but longIndex: " + longIndex); } } | checkLongIndex |
274,153 | void (int shortIndex) { if (shortIndex < 0 || shortIndex >= shortSize()) { throw new IndexOutOfBoundsException("ShortSize is: " + shortSize() + ", but shortIndex: " + shortIndex); } } | checkShortIndex |
274,154 | void (int startLongIndex, int endLongIndex) { if (startLongIndex < 0 || endLongIndex < startLongIndex || endLongIndex >= longSize()) { throw new IllegalArgumentException( "ShortSize is: " + shortSize() + ", but updateRequest is: (" + startLongIndex + ", " + endLongIndex + ")"); } } | checkUpdateParameters |
274,155 | void (@NotNull GraphEdge graphEdge) { Pair<Integer, Integer> nodeIds = getNodeIds(graphEdge); myEdgeStorage.removeEdge(nodeIds.first, nodeIds.second, graphEdge.getType()); } | removeEdge |
274,156 | void (@NotNull GraphEdge graphEdge) { Pair<Integer, Integer> nodeIds = getNodeIds(graphEdge); myEdgeStorage.createEdge(nodeIds.first, nodeIds.second, graphEdge.getType()); } | createEdge |
274,157 | boolean (int fromIndex, int toIndex) { int toId = myGetNodeIdByIndex.fun(toIndex); for (Pair<Integer, GraphEdgeType> edge : myEdgeStorage.getEdges(myGetNodeIdByIndex.fun(fromIndex))) { if (edge.second.isNormalEdge() && intEqual(edge.first, toId)) return true; } return false; } | hasEdge |
274,158 | List<GraphEdge> (int nodeIndex, @NotNull EdgeFilter filter) { List<GraphEdge> result = new SmartList<>(); for (Pair<Integer, GraphEdgeType> retrievedEdge : myEdgeStorage.getEdges(myGetNodeIdByIndex.fun(nodeIndex))) { GraphEdge edge = decompressEdge(nodeIndex, retrievedEdge.first, retrievedEdge.second); if (matchedEdge(nodeIndex, edge, filter)) result.add(edge); } return result; } | getAdjacentEdges |
274,159 | Set<GraphEdge> () { Set<GraphEdge> result = new HashSet<>(); for (int id : myEdgeStorage.getKnownIds()) { result.addAll(getAdjacentEdges(myGetNodeIndexById.fun(id), EdgeFilter.ALL)); } return result; } | getEdges |
274,160 | GraphEdge (int nodeIndex, @Nullable Integer targetId, @NotNull GraphEdgeType edgeType) { if (edgeType.isNormalEdge()) { assert targetId != null; Integer anotherNodeIndex = myGetNodeIndexById.fun(targetId); if (anotherNodeIndex == null) return null; // todo edge to hide node return GraphEdge.createNormalEdge(nodeIndex, anotherNodeIndex, edgeType); } else { return GraphEdge.createEdgeWithTargetId(nodeIndex, targetId, edgeType); } } | decompressEdge |
274,161 | boolean (int startNodeIndex, @Nullable GraphEdge edge, @NotNull EdgeFilter filter) { if (edge == null) return false; if (edge.getType().isNormalEdge()) { return (startNodeIndex == convertToInt(edge.getDownNodeIndex()) && filter.upNormal) || (startNodeIndex == convertToInt(edge.getUpNodeIndex()) && filter.downNormal); } else { return filter.special; } } | matchedEdge |
274,162 | int (@Nullable Integer value) { return value == null ? EdgeStorage.NULL_ID : value; } | convertToInt |
274,163 | void () { myEdgeStorage.removeAll(); } | removeAll |
274,164 | EdgeStorageWrapper () { return new EdgeStorageWrapper(new EdgeStorage(), Functions.id(), Functions.id()); } | createSimpleEdgeStorage |
274,165 | CollapsedGraph (@NotNull LinearGraph delegateGraph, @NotNull UnsignedBitSet matchedNodeId) { return new CollapsedGraph(delegateGraph, matchedNodeId, matchedNodeId.clone(), new EdgeStorage()); } | newInstance |
274,166 | CollapsedGraph (@NotNull CollapsedGraph prevCollapsedGraph, @NotNull LinearGraph newDelegateGraph) { UnsignedBitSet visibleNodesId = prevCollapsedGraph.myDelegateNodesVisibility.getNodeVisibilityById(); return new CollapsedGraph(newDelegateGraph, prevCollapsedGraph.myMatchedNodeId, visibleNodesId, prevCollapsedGraph.myEdgeStorage); } | updateInstance |
274,167 | LinearGraph () { return myDelegatedGraph; } | getDelegatedGraph |
274,168 | boolean (int delegateNodeIndex) { return myDelegateNodesVisibility.isVisible(delegateNodeIndex); } | isNodeVisible |
274,169 | Modification () { Modification modification = new Modification(); if (myCurrentModification.compareAndSet(null, modification)) { return modification; } throw new RuntimeException("Can not start a new modification while the other one is still running."); } | startModification |
274,170 | LinearGraph () { assertNotUnderModification(); return myCompiledGraph; } | getCompiledGraph |
274,171 | int (int compiledNodeIndex) { assertNotUnderModification(); return myNodesMap.getLongIndex(compiledNodeIndex); } | convertToDelegateNodeIndex |
274,172 | UnsignedBitSet () { return myMatchedNodeId; } | getMatchedNodeId |
274,173 | boolean (int upNodeIndex, int downNodeIndex) { return new EdgeStorageWrapper(myEdgeStorage, myDelegatedGraph).hasEdge(upNodeIndex, downNodeIndex); } | isMyCollapsedEdge |
274,174 | void (int nodeIndex) { assert myProgress == COLLECTING; minAffectedNodeIndex = Math.min(minAffectedNodeIndex, nodeIndex); maxAffectedNodeIndex = Math.max(maxAffectedNodeIndex, nodeIndex); } | touchIndex |
274,175 | void () { assert myProgress == COLLECTING; minAffectedNodeIndex = 0; maxAffectedNodeIndex = getDelegatedGraph().nodesCount() - 1; } | touchAll |
274,176 | void (@NotNull GraphEdge edge) { assert myProgress == COLLECTING; if (edge.getUpNodeIndex() != null) touchIndex(edge.getUpNodeIndex()); if (edge.getDownNodeIndex() != null) touchIndex(edge.getDownNodeIndex()); } | touchEdge |
274,177 | void (int nodeIndex) { assert myProgress == COLLECTING; myNodesToShow.add(nodeIndex); touchIndex(nodeIndex); } | showNode |
274,178 | void (int nodeIndex) { assert myProgress == COLLECTING; myNodesToHide.add(nodeIndex); touchIndex(nodeIndex); } | hideNode |
274,179 | void (@NotNull GraphEdge edge) { assert myProgress == COLLECTING; myEdgesToAdd.createEdge(edge); touchEdge(edge); } | createEdge |
274,180 | void (@NotNull GraphEdge edge) { // todo add support for removing edge from delegate graph assert myProgress == COLLECTING; myEdgesToRemove.createEdge(edge); touchEdge(edge); } | removeEdge |
274,181 | void () { assert myProgress == COLLECTING; myClearEdges = true; touchAll(); } | removeAdditionalEdges |
274,182 | void () { assert myProgress == COLLECTING; myClearVisibility = true; touchAll(); } | resetNodesVisibility |
274,183 | int (int nodeIndex) { return CollapsedGraph.this.convertToDelegateNodeIndex(nodeIndex); } | convertToDelegateNodeIndex |
274,184 | void () { assert myCurrentModification.get() == this; myProgress = APPLYING; if (myClearVisibility) { myDelegateNodesVisibility.setNodeVisibilityById(myMatchedNodeId.clone()); } if (myClearEdges) { myEdgeStorage.removeAll(); } IntIterator toShow = myNodesToShow.iterator(); while (toShow.hasNext()) { myDelegateNodesVisibility.show(toShow.nextInt()); } IntIterator toHide = myNodesToHide.iterator(); while (toHide.hasNext()) { myDelegateNodesVisibility.hide(toHide.nextInt()); } EdgeStorageWrapper edgeStorageWrapper = new EdgeStorageWrapper(myEdgeStorage, getDelegatedGraph()); for (GraphEdge edge : myEdgesToAdd.getEdges()) { edgeStorageWrapper.createEdge(edge); } for (GraphEdge edge : myEdgesToRemove.getEdges()) { edgeStorageWrapper.removeEdge(edge); } if (minAffectedNodeIndex != Integer.MAX_VALUE && maxAffectedNodeIndex != Integer.MIN_VALUE) { myNodesMap.update(minAffectedNodeIndex, maxAffectedNodeIndex); } myProgress = DONE; myCurrentModification.set(null); } | apply |
274,185 | void () { Modification modification = myCurrentModification.get(); if (modification != null && modification.myProgress == Modification.APPLYING) { throw new IllegalStateException("CompiledGraph is under modification"); } } | assertNotUnderModification |
274,186 | int () { assertNotUnderModification(); return myNodesMap.shortSize(); } | nodesCount |
274,187 | GraphEdge (@NotNull GraphEdge delegateEdge, @Nullable Integer upNodeIndex, @Nullable Integer downNodeIndex) { return new GraphEdge(upNodeIndex, downNodeIndex, delegateEdge.getTargetId(), delegateEdge.getType()); } | createEdge |
274,188 | Integer (@Nullable Integer delegateNodeIndex) { if (delegateNodeIndex == null) return null; if (myDelegateNodesVisibility.isVisible(delegateNodeIndex)) { return myNodesMap.getShortIndex(delegateNodeIndex); } else { return -1; } } | compiledNodeIndex |
274,189 | boolean (@Nullable Integer compiledUpNode, @Nullable Integer compiledDownNode) { if (compiledUpNode != null && compiledUpNode == -1) return false; if (compiledDownNode != null && compiledDownNode == -1) return false; return true; } | isVisibleEdge |
274,190 | List<GraphEdge> (int nodeIndex, @NotNull EdgeFilter filter) { assertNotUnderModification(); List<GraphEdge> result = new SmartList<>(); int delegateIndex = myNodesMap.getLongIndex(nodeIndex); // add delegate edges for (GraphEdge delegateEdge : myDelegatedGraph.getAdjacentEdges(delegateIndex, filter)) { Integer compiledUpIndex = compiledNodeIndex(delegateEdge.getUpNodeIndex()); Integer compiledDownIndex = compiledNodeIndex(delegateEdge.getDownNodeIndex()); if (isVisibleEdge(compiledUpIndex, compiledDownIndex)) result.add(createEdge(delegateEdge, compiledUpIndex, compiledDownIndex)); } result.addAll(myEdgeStorageWrapper.getAdjacentEdges(nodeIndex, filter)); return result; } | getAdjacentEdges |
274,191 | GraphNode (int nodeIndex) { assertNotUnderModification(); int delegateIndex = myNodesMap.getLongIndex(nodeIndex); GraphNode graphNode = myDelegatedGraph.getGraphNode(delegateIndex); return new GraphNode(nodeIndex, graphNode.getType()); } | getGraphNode |
274,192 | int (int nodeIndex) { assertNotUnderModification(); int delegateIndex = myNodesMap.getLongIndex(nodeIndex); return myDelegatedGraph.getNodeId(delegateIndex); } | getNodeId |
274,193 | Integer (int nodeId) { assertNotUnderModification(); Integer delegateIndex = myDelegatedGraph.getNodeIndex(nodeId); if (delegateIndex == null) return null; if (myDelegateNodesVisibility.isVisible(delegateIndex)) { return myNodesMap.getShortIndex(delegateIndex); } else { return null; } } | getNodeIndex |
274,194 | CollapsedGraph () { return CollapsedGraph.newInstance(getDelegateController().getCompiledGraph(), myVisibility); } | update |
274,195 | LinearGraphAnswer (@NotNull LinearGraphAnswer delegateAnswer) { if (delegateAnswer.getGraphChanges() != null) myCollapsedGraph = update(); return delegateAnswer; } | delegateGraphChanged |
274,196 | LinearGraphAnswer (@NotNull LinearGraphAction action) { return null; } | performAction |
274,197 | LinearGraph () { return myCollapsedGraph.getCompiledGraph(); } | getCompiledGraph |
274,198 | GraphElement (@NotNull GraphElement graphElement) { return CollapsedController.convertToDelegate(graphElement, myCollapsedGraph); } | convertToDelegate |
274,199 | Integer () { return myUpRedNode; } | getUpRedNode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.