Coverage Summary for Class: ContextRetract (it.unibo.tuprolog.argumentation.core.primitives.context)
| Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| ContextRetract |
100%
(1/1)
|
100%
(2/2)
|
|
100%
(5/5)
|
100%
(35/35)
|
package it.unibo.tuprolog.argumentation.core.primitives.context
import it.unibo.tuprolog.argumentation.core.primitives.PrimitiveWithSignature
import it.unibo.tuprolog.argumentation.core.runtime.context.ContextBranches
import it.unibo.tuprolog.solve.ExecutionContext
import it.unibo.tuprolog.solve.Signature
import it.unibo.tuprolog.solve.primitive.Solve
/** context_retract(+Clause): the clauses of the active branch unifying with Clause removed */
internal class ContextRetract(
private val branches: ContextBranches,
) : PrimitiveWithSignature {
override val signature = Signature("context_retract", 1)
override fun solve(request: Solve.Request<ExecutionContext>): Sequence<Solve.Response> {
branches.selected.retractAll(request.arguments[0])
return sequenceOf(request.replyWith(true))
}
}