Remove some unused code
This commit is contained in:
parent
840d02c9f7
commit
3b0008ad22
|
|
@ -115,15 +115,6 @@ internal class ExecutionQueue(
|
|||
return currentMatches
|
||||
}
|
||||
|
||||
/**
|
||||
* Replays [processing] until a match of [matchedRule] can be inserted according to [RuleOrdering]
|
||||
* If [ConstraintsProcessing.isFront] is true, then no unnecessary work is done.
|
||||
*/
|
||||
fun replayToMatch(matchedRule: Rule, activationChunk: MatchJournal.OccChunk, processing: ConstraintsProcessing) =
|
||||
processing.replayUntil(processing.logicalState) { chunk ->
|
||||
canBeInserted(matchedRule, activationChunk, chunk)
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether [candidateRule] can be inserted in journal as a child
|
||||
* of [parentChunk] before one of its child chunks, [beforeChunk].
|
||||
|
|
@ -158,11 +149,6 @@ internal class ExecutionQueue(
|
|||
if (seen.add(it)) execQueue.offer(it) else false
|
||||
}
|
||||
|
||||
// todo: remove
|
||||
// special case when position in trace corresponds to position of activated occurrence
|
||||
// fun offer(posInJournal: MatchJournal.Pos): Boolean =
|
||||
// offer(posInJournal, posInJournal.occ)
|
||||
|
||||
fun isEmpty(): Boolean = execQueue.isEmpty()
|
||||
|
||||
fun isNotEmpty(): Boolean = execQueue.isNotEmpty()
|
||||
|
|
|
|||
|
|
@ -80,11 +80,6 @@ interface MatchJournal : MutableIterable<MatchJournal.Chunk> {
|
|||
*/
|
||||
fun replayDescendants(observable: LogicalStateObservable, ancestor: Chunk, until: Pos)
|
||||
|
||||
/**
|
||||
* Same as [replay]: replays [Chunk]s until [pred] returns true.
|
||||
* May replay the whole journal, in which case position will point to the end of journal.
|
||||
*/
|
||||
fun replayUntil(observable: LogicalStateObservable, pred: (Chunk) -> Boolean)
|
||||
|
||||
/**
|
||||
* Returns snapshot of the journal.
|
||||
|
|
@ -121,14 +116,6 @@ interface MatchJournal : MutableIterable<MatchJournal.Chunk> {
|
|||
*/
|
||||
fun lastDescendantOf(occChunk: OccChunk): Chunk?
|
||||
|
||||
// todo: remove
|
||||
/**
|
||||
* Returns [Pos] at which provided [RuleMatch] can be inserted
|
||||
* according to its indexed head [Occurrence]s and rule ordering.
|
||||
* Returns for matches of non-principal rules.
|
||||
*/
|
||||
// fun positionFor(newMatch: RuleMatchEx): Pos?
|
||||
|
||||
/**
|
||||
* Returns [Pos] at which provided [RuleMatch] is triggered
|
||||
* according to its indexed head [Occurrence]s.
|
||||
|
|
@ -170,8 +157,8 @@ interface MatchJournal : MutableIterable<MatchJournal.Chunk> {
|
|||
fun isDescendantOf(chunkId: Int): Boolean = justifications.contains(chunkId)
|
||||
fun isTopLevel(): Boolean = justifications.size() <= 1 // this condition implies that there're no ancestor chunks
|
||||
|
||||
fun activatedLog(): List<Occurrence> = entriesLog().filter { !it.discarded() }.map { it.occ() as Occurrence }
|
||||
fun discardedLog(): List<Occurrence> = entriesLog().filter { it.discarded() }.map { it.occ() as Occurrence }
|
||||
fun activatedLog(): List<Occurrence> = entriesLog().filter { !it.discarded() }.map { it.occ() }
|
||||
fun discardedLog(): List<Occurrence> = entriesLog().filter { it.discarded() }.map { it.occ() }
|
||||
|
||||
/**
|
||||
* Returns the resulting collection of activated occurrences
|
||||
|
|
@ -204,10 +191,6 @@ interface MatchJournal : MutableIterable<MatchJournal.Chunk> {
|
|||
}
|
||||
|
||||
open class Pos(val chunk: Chunk, val entriesCount: Int) {
|
||||
// todo: remove
|
||||
val occ: Occurrence
|
||||
get() = chunk.entriesLog()[entriesCount - 1].occ()
|
||||
|
||||
override fun equals(other: Any?) =
|
||||
other is Pos
|
||||
&& other.chunk === chunk
|
||||
|
|
|
|||
|
|
@ -163,21 +163,6 @@ internal open class MatchJournalImpl(
|
|||
if (currentPos() != until) throw IllegalStateException()
|
||||
}
|
||||
|
||||
override fun replayUntil(observable: LogicalStateObservable, pred: (Chunk) -> Boolean) {
|
||||
// todo: case when pred(current) == true? need replaying rest of current.entries?
|
||||
while (posPtr.hasNext()) {
|
||||
val previous = current
|
||||
current = posPtr.next()
|
||||
if (pred(current)) {
|
||||
// reset ptr so that it points after previous chunk
|
||||
current = previous
|
||||
posPtr.previous()
|
||||
return
|
||||
}
|
||||
replayOccurrences(observable, current.entries)
|
||||
}
|
||||
}
|
||||
|
||||
private fun resetOccurrences(occSpecs: Iterable<MatchJournal.Chunk.Entry>) =
|
||||
occSpecs.forEach {
|
||||
if (it.discarded) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue