Drop obsolete interface
This commit is contained in:
parent
20a6b70de1
commit
78deea3df2
|
|
@ -41,7 +41,7 @@ fun emptyHeadBits() = BitSet()
|
||||||
*
|
*
|
||||||
* @author Fedor Isakov
|
* @author Fedor Isakov
|
||||||
*/
|
*/
|
||||||
class RuleIndex(rules: Iterable<Rule>, profiler: Profiler? = null) : RuleLookup
|
class RuleIndex(rules: Iterable<Rule>, profiler: Profiler? = null)
|
||||||
{
|
{
|
||||||
private class OrderedRule(var order: Int, val rule: Rule)
|
private class OrderedRule(var order: Int, val rule: Rule)
|
||||||
|
|
||||||
|
|
@ -64,8 +64,6 @@ class RuleIndex(rules: Iterable<Rule>, profiler: Profiler? = null) : RuleLookup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun lookupRuleByTag(tag: Any): Rule? = tag2rule[tag]
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns instances of [Rule] that can potentially match the specified [ConstraintOccurrence].
|
* Returns instances of [Rule] that can potentially match the specified [ConstraintOccurrence].
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2014-2019 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package jetbrains.mps.logic.reactor.core
|
|
||||||
|
|
||||||
import jetbrains.mps.logic.reactor.program.Rule
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables to lookup a rule by the tag, which uniquely identifies the rule.
|
|
||||||
*
|
|
||||||
* @author Fedor Isakov
|
|
||||||
*/
|
|
||||||
|
|
||||||
interface RuleLookup {
|
|
||||||
|
|
||||||
fun lookupRuleByTag(tag: Any): Rule?
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -55,10 +55,6 @@ internal class ReteRuleMatcherImpl(private val rule: Rule) : RuleMatcher
|
||||||
|
|
||||||
override fun rule() = lookupRule()
|
override fun rule() = lookupRule()
|
||||||
|
|
||||||
// override fun setRuleLookup(ruleLookup: RuleLookup) { this.ruleLookup = ruleLookup }
|
|
||||||
//
|
|
||||||
// override fun resetRuleLookup() { this.ruleLookup = null }
|
|
||||||
|
|
||||||
override fun newProbe(): RuleMatchingProbe = ReteNetwork(head.size).also { probe = it }
|
override fun newProbe(): RuleMatchingProbe = ReteNetwork(head.size).also { probe = it }
|
||||||
|
|
||||||
override fun probe(): RuleMatchingProbe = probe ?: newProbe()
|
override fun probe(): RuleMatchingProbe = probe ?: newProbe()
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import java.util.*
|
||||||
* @author Fedor Isakov
|
* @author Fedor Isakov
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Builder(var rulesList: List<Rule>) : RuleLookup {
|
class Builder(var rulesList: List<Rule>) {
|
||||||
|
|
||||||
val tag2rule = LinkedHashMap<Any, Rule>()
|
val tag2rule = LinkedHashMap<Any, Rule>()
|
||||||
|
|
||||||
|
|
@ -26,8 +26,6 @@ class Builder(var rulesList: List<Rule>) : RuleLookup {
|
||||||
val rules: List<Rule>
|
val rules: List<Rule>
|
||||||
get() = tag2rule.values.toList()
|
get() = tag2rule.values.toList()
|
||||||
|
|
||||||
override fun lookupRuleByTag(tag: Any): Rule? = tag2rule[tag]
|
|
||||||
|
|
||||||
fun ruleMatcher(): RuleMatcher = createRuleMatcher(rules.first())
|
fun ruleMatcher(): RuleMatcher = createRuleMatcher(rules.first())
|
||||||
|
|
||||||
fun program(name: String): Program = programBuilder.program(name, rulesList)
|
fun program(name: String): Program = programBuilder.program(name, rulesList)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue