fun forOccurrenceWithMask()

in reactor/Core/src/jetbrains/mps/logic/reactor/core/RuleIndex.kt [86:102]


    fun forOccurrenceWithMask(occ: ConstraintOccurrence): Iterable<Pair<Rule, BitSet>> {
        val (ruleBits, argSlotMasks) = symbol2index[occ.constraint().symbol()]?.select(occ) ?: return emptyList()
        val result = ArrayList<Pair<OrderedRule, BitSet>>()
        val itr = ruleBits.iterator()
        while (itr.hasNext()) {
            val ruleBit = itr.next()
            bit2ruleAndMask[ruleBit]?.let {(irule, slotMask) ->
                slotMask[occ]?.let { mask ->
                    val effMask = argSlotMasks[ruleBit]?.copyApply { and(mask) } ?: mask
                    result.add(irule to effMask)
                }
            }
        }
//        }
        result.sortBy { it.first.order }
        return result.map { it.first.rule to it.second }
    }