MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / segmentChildren

Function segmentChildren

ui/plugins/ui/jasmine/jasmine.js:9693–9732  ·  view source on GitHub ↗
(node, orderedChildren, nodeStats, executableIndex)

Source from the content-addressed store, hash-verified

9691 }
9692
9693 function segmentChildren(node, orderedChildren, nodeStats, executableIndex) {
9694 let currentSegment = {
9695 index: 0,
9696 owner: node,
9697 nodes: [],
9698 min: startingMin(executableIndex),
9699 max: startingMax(executableIndex),
9700 },
9701 result = [currentSegment],
9702 lastMax = defaultMax,
9703 orderedChildSegments = orderChildSegments(orderedChildren)
9704
9705 function isSegmentBoundary(minIndex) {
9706 return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1
9707 }
9708
9709 for (let i = 0; i < orderedChildSegments.length; i++) {
9710 const childSegment = orderedChildSegments[i],
9711 maxIndex = childSegment.max,
9712 minIndex = childSegment.min
9713
9714 if (isSegmentBoundary(minIndex)) {
9715 currentSegment = {
9716 index: result.length,
9717 owner: node,
9718 nodes: [],
9719 min: defaultMin,
9720 max: defaultMax,
9721 }
9722 result.push(currentSegment)
9723 }
9724
9725 currentSegment.nodes.push(childSegment)
9726 currentSegment.min = Math.min(currentSegment.min, minIndex)
9727 currentSegment.max = Math.max(currentSegment.max, maxIndex)
9728 lastMax = maxIndex
9729 }
9730
9731 nodeStats.segments = result
9732 }
9733
9734 function orderChildSegments(children) {
9735 const specifiedOrder = [],

Callers 1

processNodeFunction · 0.85

Calls 5

startingMinFunction · 0.85
startingMaxFunction · 0.85
orderChildSegmentsFunction · 0.85
isSegmentBoundaryFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected