MCPcopy Create free account
hub / github.com/ShiftLeftSecurity/overflowdb / removeEdge

Method removeEdge

core/src/main/java/overflowdb/NodeDb.java:529–542  ·  view source on GitHub ↗

Removes an 'edge', i.e. in reality it removes the information about the adjacent node from `adjacentNodesWithEdgeProperties`. The corresponding elements will be set to `null`, i.e. we'll have holes. Note: this decrements the `offset` of the following edges in the same block by one, but that's ok bec

(Direction direction, String label, int blockOffset)

Source from the content-addressed store, hash-verified

527 * @param blockOffset must have been initialized
528 */
529 protected final synchronized void removeEdge(Direction direction, String label, int blockOffset) {
530 AdjacentNodes adjacentNodesTmp = this.adjacentNodes;
531 int offsetPos = getPositionInEdgeOffsets(direction, label);
532 int start = startIndex(adjacentNodesTmp, offsetPos) + blockOffset;
533 int strideSize = getStrideSize(label);
534 Object[] adjacentNodesWithEdgeProperties = adjacentNodesTmp.nodesWithEdgeProperties;
535
536 for (int i = start; i < start + strideSize; i++) {
537 adjacentNodesWithEdgeProperties[i] = null;
538 }
539
540 /* marking as dirty *after* we updated - if node gets serialized before we finish, it'll be marked as dirty */
541 this.markAsDirty();
542 }
543
544 private Iterator<Edge> createDummyEdgeIterator(Direction direction, String... labels) {
545 if (labels.length == 1) {

Callers 1

removeImplMethod · 0.45

Calls 4

startIndexMethod · 0.95
getStrideSizeMethod · 0.95
markAsDirtyMethod · 0.95

Tested by

no test coverage detected