diff options
Diffstat (limited to 'docs/doxygen/nel/fo__operator_8cpp-source.html')
-rw-r--r-- | docs/doxygen/nel/fo__operator_8cpp-source.html | 722 |
1 files changed, 722 insertions, 0 deletions
diff --git a/docs/doxygen/nel/fo__operator_8cpp-source.html b/docs/doxygen/nel/fo__operator_8cpp-source.html new file mode 100644 index 00000000..c1ffe22a --- /dev/null +++ b/docs/doxygen/nel/fo__operator_8cpp-source.html @@ -0,0 +1,722 @@ +<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> +<HTML> +<HEAD> + <TITLE>nevrax.org : docs</TITLE> + <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css"> + <link href="doxygen.css" rel="stylesheet" type="text/css"> +</HEAD> +<BODY MARGINHEIGHT="0" MARGINWIDTH="0"> + +<!-- uplinks --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD> + <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </TD> + </TR> +</TABLE> + +<!-- banner Nevrax --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%> + <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR> +</TABLE> + +<!-- main table --> +<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%> + <TR> + <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD> + <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + + <!------ Begin Box ------> + <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black> + <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF> + <TABLE cellspacing=0 cellpadding=1 border=0> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr> + <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr> + </TABLE> + </TD></TR></TABLE></TD></TR></TABLE> + <!------ End Box ------> + + </TD> + <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD> + <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT=""> + +<!-- title --> +<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td> +<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A> +</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT=""> +</td></tr></table> + + +<!-- block --> +<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD> + <TD><B>Documentation</B></TD> + <TD ALIGN=RIGHT> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center> +<hr><h1>fo_operator.cpp</h1><a href="fo__operator_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font> +00002 <font class="comment"> *</font> +00003 <font class="comment"> * This file is part of NEVRAX <MODULE_NAME>.</font> +00004 <font class="comment"> * NEVRAX <MODULE_NAME> is free software; you can redistribute it and/or modify</font> +00005 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> +00006 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font> +00007 <font class="comment"> * any later version.</font> +00008 <font class="comment"></font> +00009 <font class="comment"> * NEVRAX <MODULE_NAME> is distributed in the hope that it will be useful, but</font> +00010 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> +00011 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> +00012 <font class="comment"> * General Public License for more details.</font> +00013 <font class="comment"></font> +00014 <font class="comment"> * You should have received a copy of the GNU General Public License</font> +00015 <font class="comment"> * along with NEVRAX <MODULE_NAME>; see the file COPYING. If not, write to the</font> +00016 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font> +00017 <font class="comment"> * MA 02111-1307, USA.</font> +00018 <font class="comment"> */</font> +00019 +00020 <font class="preprocessor">#include "<a class="code" href="fo__operator_8h.html">nel/ai/logic/fo_operator.h</a>"</font> +00021 +00022 <font class="preprocessor">#include <list></font> +00023 <font class="preprocessor">#include <vector></font> +00024 <font class="preprocessor">#include "<a class="code" href="ai__assert_8h.html">nel/ai/logic/ai_assert.h</a>"</font> +00025 <font class="preprocessor">#include "<a class="code" href="varset_8h.html">nel/ai/logic/varset.h</a>"</font> +00026 <font class="preprocessor">#include "<a class="code" href="valueset_8h.html">nel/ai/logic/valueset.h</a>"</font> +00027 <font class="preprocessor">#include "<a class="code" href="fact_8h.html">nel/ai/logic/fact.h</a>"</font> +00028 <font class="preprocessor">#include "<a class="code" href="factbase_8h.html">nel/ai/logic/factbase.h</a>"</font> +00029 <font class="preprocessor">#include "<a class="code" href="fo__assert_8h.html">nel/ai/logic/fo_assert.h</a>"</font> +00030 +00031 <font class="keyword">namespace </font>NLAILOGIC +00032 { +00033 <font class="keyword">using</font> <font class="keyword">namespace </font>NLAIAGENT; +00034 +<a name="l00035"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a0">00035</a> CFirstOrderOperator::CFirstOrderOperator() +00036 { +00037 <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n0">_Comment</a> = NULL; +00038 } +00039 +<a name="l00040"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a1">00040</a> CFirstOrderOperator::CFirstOrderOperator(<font class="keyword">const</font> CFirstOrderOperator &c) +00041 { +00042 <font class="keywordflow">if</font> ( c._Comment ) +00043 { +00044 <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n0">_Comment</a> = <font class="keyword">new</font> <font class="keywordtype">char</font>[ strlen( c._Comment ) ]; +00045 strcpy( <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n0">_Comment</a>, c._Comment ); +00046 } +00047 <font class="keywordflow">else</font> +00048 <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n0">_Comment</a> = NULL; +00049 +00050 std::vector<IBaseAssert *>::const_iterator it_c = c._Concs.begin(); +00051 <font class="keywordflow">while</font> ( it_c != c._Concs.end() ) +00052 { +00053 <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n3">_Concs</a>.push_back( *it_c ); +00054 it_c++; +00055 } +00056 +00057 it_c = c._Conds.begin(); +00058 <font class="keywordflow">while</font> ( it_c != c._Conds.end() ) +00059 { +00060 <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>.push_back( *it_c ); +00061 it_c++; +00062 } +00063 +00064 std::vector< std::vector<sint32> >::const_iterator it_li = c._PosVarsCond.begin(); +00065 <font class="keywordflow">while</font> ( it_li != c._PosVarsCond.end() ) +00066 { +00067 std::vector<sint32>::const_iterator it_i = (*it_li).begin(); +00068 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>.push_back( std::vector<sint32>() ); +00069 +00070 <font class="keywordflow">while</font> ( it_i != (*it_li).end() ) +00071 { +00072 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>.back().push_back( *it_i ) ; +00073 it_i++; +00074 } +00075 it_li++; +00076 } +00077 +00078 it_li = c._PosVarsConc.begin(); +00079 <font class="keywordflow">while</font> ( it_li != c._PosVarsConc.end() ) +00080 { +00081 std::vector<sint32>::const_iterator it_i = (*it_li).begin(); +00082 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>.push_back( std::vector<sint32>() ); +00083 +00084 <font class="keywordflow">while</font> ( it_i != (*it_li).end() ) +00085 { +00086 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>.back().push_back( *it_i ) ; +00087 it_i++; +00088 } +00089 it_li++; +00090 } +00091 } +00092 +00094 <a class="code" href="types__nl_8h.html#a8">sint32</a> CFirstOrderOperator::getVarPos(IBaseVar *var) +00095 { +00096 <font class="keywordflow">if</font> ( <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>.size() ) +00097 { +00098 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32)<a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>.size() ; i++ ) +00099 { +00100 <font class="keywordflow">if</font> ( var->getName() == <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>[ i ]->getName() ) +00101 { +00102 <font class="keywordflow">return</font> i; +00103 } +00104 } +00105 } +00106 <font class="keywordflow">return</font> -1; +00107 } +00108 +<a name="l00109"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a2">00109</a> CFirstOrderOperator::~CFirstOrderOperator() +00110 { +00111 <font class="keywordflow">for</font> ( <a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32) <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>.size() ; i++ ) +00112 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>[ i ]->release(); +00113 } +00114 +<a name="l00115"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b0">00115</a> <font class="keywordtype">void</font> CFirstOrderOperator::compileFactPattern(CFactPattern *fp, std::vector<IBaseAssert *>&patterns, std::vector<sint32> &pos_Vars) +00116 { +00117 <font class="comment">// Recherche si variables à ajouter</font> +00118 std::vector<IBaseVar *> *vars_pattern = fp->getVars(); +00119 <font class="keywordflow">if</font> ( vars_pattern ) +00120 { +00121 std::vector<IBaseVar *>::iterator it_cond = vars_pattern->begin(); +00122 <font class="keywordflow">while</font> ( it_cond != vars_pattern->end() ) +00123 { +00124 <a class="code" href="types__nl_8h.html#a8">sint32</a> id_var = getVarPos( *it_cond ); +00125 <font class="keywordflow">if</font> ( id_var != -1 ) +00126 { +00127 pos_Vars.push_back( id_var ); +00128 } +00129 <font class="keywordflow">else</font> +00130 { +00131 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>.push_back( (IBaseVar *)(*it_cond)->clone() ); +00132 pos_Vars.push_back( <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>.size() - 1); +00133 } +00134 it_cond++; +00135 } +00136 } +00137 +00138 <font class="keywordflow">for</font> ( <a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32) vars_pattern->size(); i++ ) +00139 { +00140 (*vars_pattern)[i]->release(); +00141 } +00142 <font class="keyword">delete</font> vars_pattern; +00143 } +00144 +<a name="l00145"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a5">00145</a> <font class="keywordtype">void</font> CFirstOrderOperator::addPrecondition(CFactPattern *pattern) +00146 { +00147 <font class="keywordflow">if</font> ( pattern->getAssert() ) +00148 { +00149 std::vector<sint32> pos_Vars; +00150 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b0">compileFactPattern</a>( pattern, <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>, pos_Vars); +00151 +00152 <font class="comment">// pattern->getAssert()->addClause( this, pos_Vars );</font> +00153 <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>.push_back( pattern->getAssert() ); +00154 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>.push_back( pos_Vars ); +00155 +00156 } +00157 } +00158 +<a name="l00159"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a6">00159</a> <font class="keywordtype">void</font> CFirstOrderOperator::addPostcondition(CFactPattern *pattern) +00160 { +00161 <font class="keywordflow">if</font> ( pattern->getAssert() ) +00162 { +00163 std::vector<sint32> pos_Vars; +00164 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b0">compileFactPattern</a>( pattern, <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>, pos_Vars); +00165 +00166 pattern->getAssert()->addInput( <font class="keyword">this</font> ); +00167 <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n3">_Concs</a>.push_back( pattern->getAssert() ); +00168 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>.push_back( pos_Vars ); +00169 } +00170 } +00171 +00172 +00173 <font class="comment">// Retourne les assertions avec les positions des variables d'une conclusion dans les conditions</font> +<a name="l00174"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b3">00174</a> <font class="keywordtype">void</font> CFirstOrderOperator::getPosListBackward(<a class="code" href="types__nl_8h.html#a8">sint32</a> no_conc, <a class="code" href="types__nl_8h.html#a8">sint32</a> no_cond, std::vector<sint32> &cond_pos) +00175 { +00176 std::vector<sint32>::iterator it_conc = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>[ no_conc ].begin(); +00177 <font class="keywordflow">while</font> ( it_conc != <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>[ no_conc ].end() ) +00178 { +00179 std::vector<sint32>::iterator it_cond = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>[ no_cond ].begin(); +00180 <font class="keywordflow">while</font> ( it_cond != <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>[ no_cond ].end() ) +00181 { +00182 <font class="keywordflow">if</font> ( (*it_conc) == (*it_cond) ) +00183 { +00184 cond_pos.push_back( *it_cond ); +00185 } +00186 it_cond++; +00187 } +00188 it_conc++; +00189 } +00190 } +00191 +00192 <font class="comment">// Retourne les assertions avec les positions des variables d'une conclusion dans les conditions</font> +<a name="l00193"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b2">00193</a> <font class="keywordtype">void</font> CFirstOrderOperator::getPosListForward(<a class="code" href="types__nl_8h.html#a8">sint32</a> no_cond, <a class="code" href="types__nl_8h.html#a8">sint32</a> no_conc, std::vector<sint32> &conc_pos) +00194 { +00195 std::vector<sint32>::iterator it_cond = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>[ no_cond ].begin(); +00196 <font class="keywordflow">while</font> ( it_cond != <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>[ no_cond ].end() ) +00197 { +00198 std::vector<sint32>::iterator it_conc = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>[ no_conc ].begin(); +00199 <font class="keywordflow">while</font> ( it_conc != <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>[ no_conc ].end() ) +00200 { +00201 <font class="keywordflow">if</font> ( (*it_cond) == (*it_conc) ) +00202 { +00203 conc_pos.push_back( *it_conc ); +00204 } +00205 it_conc++; +00206 } +00207 it_cond++; +00208 } +00209 } +00210 +<a name="l00211"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b4">00211</a> <font class="keywordtype">void</font> CFirstOrderOperator::getAssertPos(IBaseAssert *a, std::vector<IBaseAssert *> &<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, std::vector<sint32> &pos) +00212 { +00213 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32) <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>.size() ; i++ ) +00214 { +00215 <font class="keywordflow">if</font> ( (*(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>[i])) == a ) +00216 pos.push_back(i); +00217 } +00218 } +00219 +<a name="l00220"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a3">00220</a> <a class="code" href="classstd_1_1list.html">std::list<CFactPattern *></a> *CFirstOrderOperator::forward(CFactPattern *fact) +00221 { +00222 <font class="keywordflow">return</font> NULL; +00223 } +00224 +<a name="l00225"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b5">00225</a> CValueSet *CFirstOrderOperator::unifyBackward(<a class="code" href="classstd_1_1list.html">std::list<CFact *></a> &facts) +00226 { +00227 CValueSet *unified = <font class="keyword">new</font> CValueSet( <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>.size() ); +00228 <a class="code" href="classstd_1_1list.html">std::list<CFact *></a>::iterator it_f = facts.begin(); +00229 <font class="keywordflow">while</font> ( it_f != facts.end() ) +00230 { +00231 std::vector<sint32> pos_assert; +00232 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b4">getAssertPos</a>( (*it_f)->getAssert(), <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n3">_Concs</a>, pos_assert ); +00233 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> pos = 0; pos < (sint32) pos_assert.size(); pos++) +00234 { +00235 <font class="keywordflow">for</font> ( <a class="code" href="types__nl_8h.html#a8">sint32</a> ivar = 0; ivar < (sint32) <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>[ pos_assert[pos] ].size(); ivar++ ) +00236 { +00237 <a class="code" href="types__nl_8h.html#a8">sint32</a> l_pos = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>[ pos_assert[pos] ][ivar]; +00238 +00239 <a class="code" href="classNLAIAGENT_1_1IObjectIA.html#b0">IObjectIA</a> *l_val = (*unified)[ l_pos ]; +00240 <a class="code" href="classNLAIAGENT_1_1IObjectIA.html#b0">IObjectIA</a> *r_val = (**it_f)[ ivar ]; +00241 +00242 <font class="keywordflow">if</font> ( !l_val ) +00243 { +00244 <font class="keywordflow">if</font> ( r_val ) +00245 { +00246 unified->setValue( l_pos, r_val ); +00247 } +00248 } +00249 <font class="keywordflow">else</font> +00250 { +00251 <font class="keywordflow">if</font> ( r_val && ( l_val != r_val ) ) +00252 { +00253 unified->release(); +00254 <font class="keywordflow">return</font> NULL; +00255 } +00256 } +00257 } +00258 } +00259 it_f++; +00260 } +00261 <font class="keywordflow">return</font> unified; +00262 } +00263 +<a name="l00264"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b6">00264</a> CValueSet *CFirstOrderOperator::unifyForward(<a class="code" href="classstd_1_1list.html">std::list<CFact *></a> &facts) +00265 { +00266 CValueSet *unified = <font class="keyword">new</font> CValueSet( <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>.size() ); +00267 <a class="code" href="classstd_1_1list.html">std::list<CFact *></a>::iterator it_f = facts.begin(); +00268 <font class="keywordflow">while</font> ( it_f != facts.end() ) +00269 { +00270 std::vector<sint32> pos_assert; +00271 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b4">getAssertPos</a>( (*it_f)->getAssert(), <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>, pos_assert ); +00272 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> pos = 0; pos < (sint32) pos_assert.size(); pos++) +00273 { +00274 <font class="keywordflow">for</font> ( <a class="code" href="types__nl_8h.html#a8">sint32</a> ivar = 0; ivar < (sint32) <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>[ pos_assert[pos] ].size(); ivar++ ) +00275 { +00276 <a class="code" href="types__nl_8h.html#a8">sint32</a> l_pos = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>[ pos_assert[pos] ][ivar]; +00277 +00278 <a class="code" href="classNLAIAGENT_1_1IObjectIA.html#b0">IObjectIA</a> *l_val = (*unified)[ l_pos ]; +00279 <a class="code" href="classNLAIAGENT_1_1IObjectIA.html#b0">IObjectIA</a> *r_val = (**it_f)[ ivar ]; +00280 +00281 <font class="keywordflow">if</font> ( !l_val ) +00282 { +00283 <font class="keywordflow">if</font> ( r_val ) +00284 { +00285 unified->setValue( l_pos, r_val ); +00286 } +00287 } +00288 <font class="keywordflow">else</font> +00289 { +00290 <font class="keywordflow">if</font> ( r_val && ( l_val != r_val ) ) +00291 { +00292 unified->release(); +00293 <font class="keywordflow">return</font> NULL; +00294 } +00295 } +00296 } +00297 } +00298 it_f++; +00299 } +00300 <font class="keywordflow">return</font> unified; +00301 } +00302 +<a name="l00303"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b7">00303</a> CFact *CFirstOrderOperator::buildFromVars(IBaseAssert *<a class="code" href="debug_8h.html#a15">assert</a>, std::vector<sint32> &pl, CValueSet *vars) +00304 { +00305 CFact *result = <font class="keyword">new</font> CFact( <a class="code" href="debug_8h.html#a15">assert</a>); <font class="comment">// TODO:: pas besoin du nombre dans ce constructeur puisqu'on a l'assert</font> +00306 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32) pl.size() ; i++ ) +00307 { +00308 <a class="code" href="types__nl_8h.html#a8">sint32</a> p = pl[i]; +00309 result->setValue( i, (*vars)[ pl[i] ] ); +00310 } +00311 <font class="keywordflow">return</font> result; +00312 } +00313 +<a name="l00314"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a7">00314</a> <a class="code" href="classstd_1_1list.html">std::list<CFact *></a> *CFirstOrderOperator::backward(<a class="code" href="classstd_1_1list.html">std::list<CFact *></a> &facts) +00315 { +00316 CValueSet *unified = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b5">unifyBackward</a>( facts ); +00317 <a class="code" href="classstd_1_1list.html">std::list<CFact *></a> *result = <font class="keyword">new</font> <a class="code" href="classstd_1_1list.html">std::list<CFact *></a>; +00318 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32) <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>.size(); i++ ) +00319 { +00320 CFact *tmp = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b7">buildFromVars</a>( <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>[i], <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>[i], unified ); +00321 result->push_back( tmp ); +00322 <font class="preprocessor">#ifdef NL_DEBUG</font> +00323 <font class="preprocessor"></font> std::string buffer; +00324 tmp->getDebugString(buffer); +00325 <font class="preprocessor">#endif</font> +00326 <font class="preprocessor"></font> } +00327 unified->release(); +00328 <font class="keywordflow">return</font> result; +00329 } +00330 +<a name="l00331"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a8">00331</a> <a class="code" href="classstd_1_1list.html">std::list<CFact *></a> *CFirstOrderOperator::forward(<a class="code" href="classstd_1_1list.html">std::list<CFact *></a> &facts) +00332 { +00333 CValueSet *unified = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b6">unifyForward</a>( facts ); +00334 +00335 <font class="preprocessor">#ifdef NL_DEBUG</font> +00336 <font class="preprocessor"></font> std::string buf; +00337 unified->getDebugString( buf ); +00338 <font class="preprocessor">#endif</font> +00339 <font class="preprocessor"></font> +00340 <a class="code" href="classstd_1_1list.html">std::list<CFact *></a> *result = <font class="keyword">new</font> <a class="code" href="classstd_1_1list.html">std::list<CFact *></a>; +00341 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32) <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n3">_Concs</a>.size(); i++ ) +00342 { +00343 CFact *tmp = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b7">buildFromVars</a>( <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n3">_Concs</a>[i], <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>[i], unified ); +00344 result->push_back( tmp ); +00345 +00346 <font class="preprocessor">#ifdef NL_DEBUG</font> +00347 <font class="preprocessor"></font> std::string buffer; +00348 tmp->getDebugString(buffer); +00349 <font class="preprocessor">#endif</font> +00350 <font class="preprocessor"></font> } +00351 unified->release(); +00352 <font class="keywordflow">return</font> result; +00353 } +00354 +00355 +<a name="l00356"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a9">00356</a> <a class="code" href="classstd_1_1list.html">std::list<CFact *></a> *CFirstOrderOperator::propagate(<a class="code" href="classstd_1_1list.html">std::list<CFact *></a> &facts) +00357 { +00358 <a class="code" href="classstd_1_1list.html">std::list<CFact *></a> *conflicts = <font class="keyword">new</font> <a class="code" href="classstd_1_1list.html">std::list<CFact *></a>; +00359 <a class="code" href="classstd_1_1list.html">std::list< CValueSet *></a> liaisons; +00360 CValueSet *empty = <font class="keyword">new</font> CValueSet( <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>.size() ); +00361 liaisons.push_back( empty ); +00362 +00363 std::list<CFact *>::iterator it_f = facts.begin(); +00364 <font class="keywordflow">while</font> ( it_f != facts.end() ) +00365 { +00366 std::vector<sint32> pos_asserts; +00367 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b4">getAssertPos</a>( (*it_f)->getAssert() , <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>, pos_asserts); +00368 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32) pos_asserts.size(); i++ ) +00369 { +00370 <a class="code" href="classstd_1_1list.html">std::list<CValueSet *></a> *links = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b8">propagate</a>( liaisons, *it_f, <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>[ pos_asserts[i] ] ); +00371 <font class="keywordflow">if</font> ( links ) +00372 { +00373 <font class="keywordflow">while</font> ( links->size() ) +00374 { +00375 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32) <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n3">_Concs</a>.size(); i++ ) +00376 { +00377 CFact *<a class="code" href="driver__opengl__extension__def_8h.html#a246">r</a> = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b7">buildFromVars</a>( <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n3">_Concs</a>[i], <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>[i], links->front() ); +00378 <font class="preprocessor">#ifdef NL_DEBUG</font> +00379 <font class="preprocessor"></font> std::string buf; +00380 <a class="code" href="driver__opengl__extension__def_8h.html#a246">r</a>->getDebugString( buf ); +00381 <font class="preprocessor">#endif</font> +00382 <font class="preprocessor"></font> <font class="comment">// Tests if the fact is already in the conflicts list</font> +00383 <font class="keywordtype">bool</font> found = <font class="keyword">false</font>; +00384 std::list<CFact *>::iterator it_c = conflicts->begin(); +00385 <font class="keywordflow">while</font> ( ! found && it_c != conflicts->end() ) +00386 { +00387 found = (**it_c) == *<a class="code" href="driver__opengl__extension__def_8h.html#a246">r</a>; +00388 it_c++; +00389 } +00390 <font class="keywordflow">if</font> ( !found ) +00391 { +00392 <font class="preprocessor">#ifdef NL_DEBUG</font> +00393 <font class="preprocessor"></font> std::string buf; +00394 <a class="code" href="driver__opengl__extension__def_8h.html#a246">r</a>->getDebugString( buf ); +00395 <font class="preprocessor">#endif</font> +00396 <font class="preprocessor"></font> conflicts->push_back( <a class="code" href="driver__opengl__extension__def_8h.html#a246">r</a> ); +00397 } +00398 } +00399 links->front()->release(); +00400 links->pop_front(); +00401 } +00402 <font class="keyword">delete</font> links; +00403 } +00404 } +00405 it_f++; +00406 } +00407 +00408 <font class="keywordflow">while</font> ( liaisons.size() ) +00409 { +00410 liaisons.front()->release(); +00411 liaisons.pop_front(); +00412 } +00413 +00414 <font class="keywordflow">return</font> conflicts; +00415 } +00416 +<a name="l00417"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b9">00417</a> CValueSet *CFirstOrderOperator::unifyLiaison( <font class="keyword">const</font> CValueSet *fp, CValueSet *vals, std::vector<sint32> &pos_vals) +00418 { +00419 CValueSet *result; +00420 +00421 <font class="keywordflow">if</font> ( result = fp->unify( vals, pos_vals ) ) +00422 <font class="keywordflow">return</font> result; +00423 <font class="keywordflow">else</font> +00424 { +00425 <font class="keyword">delete</font> result; +00426 <font class="keywordflow">return</font> NULL; +00427 } +00428 } +00429 +<a name="l00430"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b8">00430</a> <a class="code" href="classstd_1_1list.html">std::list<CValueSet *></a> *CFirstOrderOperator::propagate(<a class="code" href="classstd_1_1list.html">std::list<CValueSet *></a> &liaisons, CValueSet *fact, std::vector<sint32> &pos_vals) +00431 { +00432 <a class="code" href="classstd_1_1list.html">std::list<CValueSet *></a> *conflits = <font class="keyword">new</font> <a class="code" href="classstd_1_1list.html">std::list<CValueSet *></a>; +00433 std::list<CValueSet *> buf_liaisons; +00434 <font class="comment">// Pour chaque liaison...</font> +00435 <a class="code" href="classstd_1_1list.html">std::list< CValueSet *></a>::iterator it_l = liaisons.begin(); +00436 +00437 <font class="keywordflow">while</font> ( it_l != liaisons.end() ) +00438 { +00439 +00440 CValueSet *<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = *it_l; +00441 <font class="preprocessor">#ifdef NL_DEBUG</font> +00442 <font class="preprocessor"></font> std::string buf; +00443 <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>->getDebugString( buf ); +00444 <font class="preprocessor">#endif</font> +00445 <font class="preprocessor"></font> +00446 CValueSet *result = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b9">unifyLiaison</a>( <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, fact, pos_vals ); +00447 <font class="keywordflow">if</font> ( result ) +00448 { +00449 <font class="preprocessor">#ifdef NL_DEBUG</font> +00450 <font class="preprocessor"></font> std::string buf; +00451 result->getDebugString( buf ); +00452 <font class="preprocessor">#endif</font> +00453 <font class="preprocessor"></font> +00454 <font class="keywordflow">if</font> ( result->undefined() == 0 ) +00455 { +00456 conflits->push_back( result ); +00457 } +00458 <font class="keywordflow">else</font> +00459 buf_liaisons.push_back( result ); +00460 } +00461 it_l++; +00462 } +00463 +00464 <font class="keywordflow">while</font> ( buf_liaisons.size() ) +00465 { +00466 liaisons.push_back( buf_liaisons.front() ); +00467 buf_liaisons.pop_front(); +00468 } +00469 +00470 <font class="keywordflow">return</font> conflits; +00471 } +00472 +<a name="l00473"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a20">00473</a> <a class="code" href="classstd_1_1list.html">std::list<CFact *></a> *CFirstOrderOperator::test(<a class="code" href="classstd_1_1list.html">std::list<CFact *></a> &facts) +00474 { +00475 <a class="code" href="classstd_1_1list.html">std::list<CFact *></a> *preconds = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a4">backward</a>( facts ); +00476 +00477 <a class="code" href="classstd_1_1list.html">std::list<CFact *></a>::iterator it_f = preconds->begin(); +00478 <font class="keywordflow">while</font> ( it_f != preconds->end() ) +00479 { +00480 ( (CFirstOrderAssert *)(*it_f)->getAssert() )->backward( *it_f ); +00481 it_f++; +00482 } +00483 <font class="keywordflow">return</font> NULL; +00484 } +00485 +00486 +<a name="l00487"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a10">00487</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1IBasicType.html">NLAIC::IBasicType</a> *CFirstOrderOperator::clone()<font class="keyword"> const</font> +00488 <font class="keyword"> </font>{ +00489 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a0">CFirstOrderOperator</a> *<a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a10">clone</a> = <font class="keyword">new</font> <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a0">CFirstOrderOperator</a>( *<font class="keyword">this</font> ); +00490 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a10">clone</a>; +00491 } +00492 +<a name="l00493"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a11">00493</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1IBasicType.html">NLAIC::IBasicType</a> *CFirstOrderOperator::newInstance()<font class="keyword"> const</font> +00494 <font class="keyword"> </font>{ +00495 <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a0">CFirstOrderOperator</a> *instance = <font class="keyword">new</font> <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a0">CFirstOrderOperator</a>; +00496 <font class="keywordflow">return</font> instance; +00497 } +00498 +<a name="l00499"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a12">00499</a> <font class="keywordtype">void</font> CFirstOrderOperator::save(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &os) +00500 { +00501 } +00502 +<a name="l00503"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a13">00503</a> <font class="keywordtype">void</font> CFirstOrderOperator::load(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &is) +00504 { +00505 } +00506 +<a name="l00507"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a14">00507</a> <font class="keywordtype">void</font> CFirstOrderOperator::getDebugString(std::string &txt)<font class="keyword"> const</font> +00508 <font class="keyword"> </font>{ +00509 txt += <font class="stringliteral">"Operator:\n -Preconditions:\n"</font>; +00510 <font class="keywordflow">if</font> ( _Comment ) +00511 { +00512 txt += <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n0">_Comment</a>; +00513 txt += <font class="stringliteral">"\n"</font>; +00514 } +00515 +00516 std::vector<IBaseAssert *>::const_iterator it_a = <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>.begin(); +00517 std::vector<std::vector<sint32> >::const_iterator it_p = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>.begin(); +00518 <font class="keywordflow">while</font> ( it_a != <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>.end() ) +00519 { +00520 std::string buf; +00521 (*it_a)->getDebugString(buf); +00522 txt += <font class="stringliteral">" ( "</font>; +00523 txt += buf; +00524 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32) (*it_p).size(); i++ ) +00525 { +00526 txt += <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>[ (*it_p)[i] ]->getName().getString(); +00527 txt += <font class="stringliteral">" "</font>; +00528 } +00529 txt += <font class="stringliteral">")\n"</font>; +00530 +00531 it_a++; +00532 it_p++; +00533 } +00534 +00535 txt += <font class="stringliteral">" -Postconditions:\n"</font>; +00536 it_a = <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n3">_Concs</a>.begin(); +00537 it_p = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>.begin(); +00538 <font class="keywordflow">while</font> ( it_a != <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n3">_Concs</a>.end() ) +00539 { +00540 std::string buf; +00541 (*it_a)->getDebugString(buf); +00542 txt += <font class="stringliteral">" ( "</font>; +00543 txt += buf; +00544 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32) (*it_p).size(); i++ ) +00545 { +00546 txt += <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>[ (*it_p)[i] ]->getName().getString(); +00547 txt += <font class="stringliteral">" "</font>; +00548 } +00549 txt += <font class="stringliteral">")\n"</font>; +00550 +00551 it_a++; +00552 it_p++; +00553 } +00554 } +00555 +<a name="l00556"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a15">00556</a> <font class="keywordtype">bool</font> <a class="code" href="chain_8cpp.html#a2">CFirstOrderOperator::isEqual</a>(<font class="keyword">const</font> CFirstOrderOperator &a)<font class="keyword"> const</font> +00557 <font class="keyword"> </font>{ +00558 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00559 } +00560 +<a name="l00561"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a16">00561</a> <font class="keyword">const</font> IObjectIA::CProcessResult &CFirstOrderOperator::run() +00562 { +00563 <font class="keywordflow">return</font> IObjectIA::ProcessRun; +00564 } +00565 +<a name="l00566"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a17">00566</a> <font class="keywordtype">bool</font> <a class="code" href="chain_8cpp.html#a2">CFirstOrderOperator::isEqual</a>(<font class="keyword">const</font> IBasicObjectIA &a)<font class="keyword"> const</font> +00567 <font class="keyword"> </font>{ +00568 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00569 } +00570 +<a name="l00571"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a21">00571</a> <font class="keywordtype">bool</font> CFirstOrderOperator::isTrue()<font class="keyword"> const</font> +00572 <font class="keyword"> </font>{ +00573 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00574 } +00575 +<a name="l00576"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a18">00576</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1CIdentType.html">NLAIC::CIdentType</a> &CFirstOrderOperator::getType()<font class="keyword"> const</font> +00577 <font class="keyword"> </font>{ +00578 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#p0">IdCFirstOrderOperator</a>; +00579 } +00580 +<a name="l00581"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a19">00581</a> <font class="keywordtype">bool</font> CFirstOrderOperator::operator==(CFirstOrderOperator *) +00582 { +00583 <font class="keywordflow">return</font> <font class="keyword">false</font>; +00584 } +00585 +<a name="l00586"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a22">00586</a> <font class="keywordtype">float</font> CFirstOrderOperator::truthValue()<font class="keyword"> const</font> +00587 <font class="keyword"> </font>{ +00588 <font class="keywordflow">return</font> 0.0; +00589 } +00590 +00591 <font class="comment">// Vérifie si l'opérateur est activable avec les informations d'une base de faits</font> +<a name="l00592"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a23">00592</a> <font class="keywordtype">bool</font> CFirstOrderOperator::isValid(CFactBase *fb) +00593 { +00594 <a class="code" href="classstd_1_1list.html">std::list<CFact *></a> *facts = <font class="keyword">new</font> <a class="code" href="classstd_1_1list.html">std::list<CFact *></a>; +00595 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i < (sint32) <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>.size(); i++ ) +00596 { +00597 std::list<CFact *> *fa = fb->getAssertFacts( <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>[i] ); +00598 <font class="keywordflow">while</font> ( fa->size() ) +00599 { +00600 facts->push_back( fa->front() ); +00601 fa->pop_front(); +00602 } +00603 <font class="keyword">delete</font> fa; +00604 } +00605 std::list<CFact *> *res = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b8">propagate</a>( *facts ); +00606 <font class="keywordtype">bool</font> is_valid = !res->empty(); +00607 <font class="keywordflow">while</font> ( res->size() ) +00608 { +00609 <font class="preprocessor">#ifdef NL_DEBUG</font> +00610 <font class="preprocessor"></font> std::string buffer; +00611 res->front()->getDebugString( buffer ); +00612 <font class="preprocessor">#endif</font> +00613 <font class="preprocessor"></font> res->front()->release(); +00614 res->pop_front(); +00615 } +00616 <font class="keyword">delete</font> res; +00617 +00618 <font class="keywordflow">while</font> ( facts->size() ) +00619 { +00620 facts->front()->release(); +00621 facts->pop_front(); +00622 } +00623 <font class="keyword">delete</font> facts; +00624 +00625 <font class="keywordflow">return</font> is_valid; +00626 } +00627 +<a name="l00628"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a24">00628</a> <font class="keywordtype">float</font> CFirstOrderOperator::priority()<font class="keyword"> const</font> +00629 <font class="keyword"> </font>{ +00630 <font class="keywordflow">return</font> 0.0; +00631 } +00632 +<a name="l00633"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a25">00633</a> <font class="keywordtype">void</font> CFirstOrderOperator::success() +00634 { +00635 } +00636 +<a name="l00637"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a26">00637</a> <font class="keywordtype">void</font> CFirstOrderOperator::failure() +00638 { +00639 } +00640 +<a name="l00641"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a27">00641</a> <font class="keywordtype">void</font> CFirstOrderOperator::success(IBaseOperator *) +00642 { +00643 } +00644 +<a name="l00645"></a><a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#a28">00645</a> <font class="keywordtype">void</font> CFirstOrderOperator::failure(IBaseOperator *) +00646 { +00647 } +00648 +00649 } +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </FONT> +</TD> +<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD> +</TR> +</TABLE> +</BODY> +</HTML> |