Exemplo n.º 1
0
// get clause data
int
Expression::getClauses(ombt::Set_List<Clause> &clist, Clause &c, 
		int storeClause, int negated, int concluded) const
{
	switch (type)
	{
	case And:
		MustBeTrue(left != NULL && right != NULL);
		if (left->getClauses(clist, c, 1, negated, concluded) != OK)
			return(NOTOK);
		if (right->getClauses(clist, c, 1, negated, concluded) != OK)
			return(NOTOK);
		break;
	case Or:
		MustBeTrue(left != NULL && right != NULL);
		if (left->getClauses(clist, c, 0, negated, concluded) != OK)
			return(NOTOK);
		if (right->getClauses(clist, c, 0, negated, concluded) != OK)
			return(NOTOK);
		break;
	case Negation:
		MustBeTrue(right != NULL && left == NULL);
		if (right->getClauses(clist, c, 0, 1, concluded) != OK)
			return(NOTOK);
		break;
	default:
		MustBeTrue(0);
	}
	c.setPartOfConclusion(concluded);
	return(OK);
}
Exemplo n.º 2
0
// get clause data
int
Atomic::getClauses(ombt::Set_List<Clause> &clist, Clause &c, 
		int storeClause, int negated, int concluded) const
{
	Atom atom;
	switch (type)
	{
	case Constant:
		atom = Atom(value);
		if (negated)
		{
			if (atom == Atom("true"))
				atom = Atom("false");
			else
				atom = Atom("true");
		}
		break;
	case Variable:
		if (negated)
			atom = ~Atom(name);
		else
			atom = Atom(name);
		break;
	default:
		MustBeTrue(0);
		return(NOTOK);
	}
	c.setPartOfConclusion(concluded);
	c.insert(atom);
	return(OK);
}
Exemplo n.º 3
0
int
Semantic::getClauses(ombt::Set_List<Clause> &clist, Clause &c, 
	int storeClause, int negated, int concluded) const
{
	if (prep->getClauses(clist, c, 0, negated, concluded) != OK)
		return(NOTOK);
	if (storeClause && !c.isEmpty())
	{
		c.setPartOfConclusion(concluded);
		clist.insert(c);
		c.clear();
	}
	return(OK);
}