Sync
This commit is contained in:
parent
a85169dced
commit
a937b1bc44
15 changed files with 93 additions and 30 deletions
|
@ -7,6 +7,7 @@ import prolog.ast.logic.LogicOperator
|
|||
import prolog.ast.terms.Atom
|
||||
import prolog.ast.terms.Body
|
||||
import prolog.ast.terms.Goal
|
||||
import prolog.ast.terms.Structure
|
||||
import prolog.flags.AppliedCut
|
||||
|
||||
/**
|
||||
|
@ -34,6 +35,8 @@ class Cut() : Atom("!") {
|
|||
override fun satisfy(subs: Substitutions): Answers {
|
||||
return sequenceOf(Result.failure(AppliedCut(emptyMap())))
|
||||
}
|
||||
|
||||
override fun applySubstitution(subs: Substitutions): Cut = Cut()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,6 +97,11 @@ class Conjunction(val left: LogicOperand, private val right: LogicOperand) :
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun applySubstitution(subs: Substitutions): Conjunction = Conjunction(
|
||||
left.applySubstitution(subs) as LogicOperand,
|
||||
right.applySubstitution(subs) as LogicOperand
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,6 +113,12 @@ open class Disjunction(private val left: LogicOperand, private val right: LogicO
|
|||
yieldAll(left.satisfy(subs))
|
||||
yieldAll(right.satisfy(subs))
|
||||
}
|
||||
|
||||
override fun clone(): Disjunction = Disjunction(left.clone() as LogicOperand, right.clone() as LogicOperand)
|
||||
override fun applySubstitution(subs: Substitutions): Disjunction = Disjunction(
|
||||
left.applySubstitution(subs) as LogicOperand,
|
||||
right.applySubstitution(subs) as LogicOperand
|
||||
)
|
||||
}
|
||||
|
||||
@Deprecated("Use Disjunction instead")
|
||||
|
|
Reference in a new issue