示例#1
0
tribool SumAggrLit::accumulate(Grounder *g, const Val &weight, Lit &lit) throw(const Val*)
{
	(void)g;
	int32_t num = weight.number();
	if(num == 0 && !head()) return true;
	if(set() && !lit.testUnique(uniques_))	return true;
	if(lit.fact())
	{
		fixed_ += num;
		if(checkUpperBound_ && fixed_ > upperBound_) return false;
	}
	else
	{
		factOnly_ = false;
		if(num < 0) valLower_ += num;
		if(num > 0)	valUpper_ += num;
	}
	return lit.fact() ? tribool(true) : unknown;
}
示例#2
0
/**
 * \overload
 */
inline tribool operator!=(tribool x, indeterminate_keyword_t)
{ return x != tribool(indeterminate); }
示例#3
0
/**
 * \overload
 */
inline tribool operator!=(indeterminate_keyword_t, tribool x)
{ return tribool(indeterminate) != x; }
示例#4
0
/**
 * \overload
 */
inline tribool operator!=(bool x, tribool y) { return tribool(x) != y; }
示例#5
0
/**
 * \overload
 */
inline tribool operator!=(tribool x, bool y) { return x != tribool(y); }
示例#6
0
/**
 * \overload
 */
inline tribool operator==(tribool x, indeterminate_keyword_t)
{ return tribool(indeterminate) == x; }
示例#7
0
/**
 * \overload
 */
inline tribool operator==(bool x, tribool y) { return tribool(x) == y; }
示例#8
0
/**
 * \overload
 */
inline tribool operator==(tribool x, bool y) { return x == tribool(y); }
示例#9
0
/**
 * \overload
 */
inline tribool operator||(tribool x, indeterminate_keyword_t)
{ return x? tribool(true) : tribool(indeterminate); }
示例#10
0
/**
 * \overload
 */
inline tribool operator||(bool x, tribool y)
{ return x? tribool(true) : y; }
示例#11
0
/**
 * \overload
 */
inline tribool operator||(tribool x, bool y)
{ return y? tribool(true) : x; }
示例#12
0
/**
 * \overload
 */
inline tribool operator&&(tribool x, indeterminate_keyword_t)
{ return !x? tribool(false) : tribool(indeterminate); }
示例#13
0
/**
 * \overload
 */
inline tribool operator&&(bool x, tribool y)
{ return x? y : tribool(false); }
示例#14
0
/**
 * \overload
 */
inline tribool operator&&(tribool x, bool y)
{ return y? x : tribool(false); }
示例#15
0
/**
 * \brief Computes the logical negation of a tribool
 *
 * \returns the logical negation of the tribool, according to the
 * table:
 *  <table border=1>
 *    <tr>
 *      <th><center><code>!</code></center></th>
 *      <th/>
 *    </tr>
 *    <tr>
 *      <th><center>false</center></th>
 *      <td><center>true</center></td>
 *    </tr>
 *    <tr>
 *      <th><center>true</center></th>
 *      <td><center>false</center></td>
 *    </tr>
 *    <tr>
 *      <th><center>indeterminate</center></th>
 *      <td><center>indeterminate</center></td>
 *    </tr>
 *  </table>
 * \throws nothrow
 */
inline tribool operator!(tribool x)
{
  return x.value == tribool::false_value? tribool(true)
        :x.value == tribool::true_value? tribool(false)
        :tribool(indeterminate);
}