Introduce method isBasis to Rule class, use that for feedback
Feedback basis are calculated for rules in history that are marked as "basis" instead of "principal".
This commit is contained in:
parent
87a843088c
commit
0cef5ad298
|
|
@ -175,7 +175,7 @@ internal class ControllerImpl (
|
|||
if (status.feedback?.alreadyHandled() == false) {
|
||||
status.feedback.handle(match,
|
||||
newParent.match.feedbackKey,
|
||||
processing.principalRuleTags(newParent),
|
||||
processing.basisRuleTags(newParent),
|
||||
supervisor)
|
||||
}
|
||||
}
|
||||
|
|
@ -199,7 +199,7 @@ internal class ControllerImpl (
|
|||
} else if (status.feedback?.alreadyHandled() == false
|
||||
&& status.failure.handle(match,
|
||||
newParent.match.feedbackKey,
|
||||
processing.principalRuleTags(newParent),
|
||||
processing.basisRuleTags(newParent),
|
||||
supervisor)) {
|
||||
|
||||
status.recover()
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ interface MatchJournal : EvidenceSource {
|
|||
*/
|
||||
fun index(): Index
|
||||
|
||||
fun principalRuleTags(chunk: Chunk): List<Any>
|
||||
fun basisRuleTags(chunk: Chunk): List<Any>
|
||||
|
||||
/**
|
||||
* Simplifies some search operations on [MatchJournal].
|
||||
|
|
|
|||
|
|
@ -243,12 +243,12 @@ internal open class MatchJournalImpl(
|
|||
|
||||
override fun index(): MatchJournal.Index = IndexImpl(hist)
|
||||
|
||||
override fun principalRuleTags(chunk: Chunk): List<Any> {
|
||||
override fun basisRuleTags(chunk: Chunk): List<Any> {
|
||||
val ptags = mutableListOf<Any>()
|
||||
chunk.justifications().forEach { jn ->
|
||||
// hist is sequential, random access can be expensive
|
||||
(lookupChunkByEvidence(jn) as? MatchChunk)?.let {
|
||||
if (it.match.isPrincipal) {
|
||||
if (it.match.rule().isBasis) {
|
||||
ptags.add(it.ruleUniqueTag)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ public abstract class Rule {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public boolean isBasis() { return false; }
|
||||
|
||||
/**
|
||||
* A tag uniquely identifies the rule.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue