aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/rule_8cpp-source.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/rule_8cpp-source.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/rule_8cpp-source.html555
1 files changed, 555 insertions, 0 deletions
diff --git a/docs/doxygen/nel/rule_8cpp-source.html b/docs/doxygen/nel/rule_8cpp-source.html
new file mode 100644
index 00000000..90abda60
--- /dev/null
+++ b/docs/doxygen/nel/rule_8cpp-source.html
@@ -0,0 +1,555 @@
+<!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>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</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>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</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>
+&nbsp;
+
+<!-- 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>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.14 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <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> &nbsp; </center>
+<hr><h1>rule.cpp</h1><a href="rule_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 &lt;MODULE_NAME&gt;.</font>
+00004 <font class="comment"> * NEVRAX &lt;MODULE_NAME&gt; 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 &lt;MODULE_NAME&gt; 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 &lt;MODULE_NAME&gt;; 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="rule_8h.html">nel/ai/logic/rule.h</a>"</font>
+00021 <font class="preprocessor">#include "<a class="code" href="ai__assert_8h.html">nel/ai/logic/ai_assert.h</a>"</font>
+00022 <font class="preprocessor">#include "<a class="code" href="valueset_8h.html">nel/ai/logic/valueset.h</a>"</font>
+00023 <font class="preprocessor">#include "<a class="code" href="fo__assert_8h.html">nel/ai/logic/fo_assert.h</a>"</font>
+00024
+00025 <font class="keyword">namespace </font>NLAILOGIC
+00026 {
+00027 <font class="keyword">using</font> <font class="keyword">namespace </font>NLAIAGENT;
+00028
+<a name="l00029"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a0">00029</a> CRule::CRule()
+00030 {
+00031 }
+00032
+<a name="l00033"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a1">00033</a> CRule::CRule(<a class="code" href="classstd_1_1list.html">std::list&lt;CFactPattern *&gt;</a> &amp;conds, <a class="code" href="classstd_1_1list.html">std::list&lt;CFactPattern *&gt;</a> &amp;concs) : CClause( conds )
+00034 {
+00035 <a class="code" href="classstd_1_1list.html">std::list&lt;CFactPattern *&gt;</a>::iterator it_c = concs.begin();
+00036 <font class="keywordflow">while</font> ( it_c != concs.end() )
+00037 {
+00038 <a class="code" href="classNLAILOGIC_1_1CRule.html#a5">addConc</a>( *it_c );
+00039 it_c++;
+00040 }
+00041 }
+00042
+<a name="l00043"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a2">00043</a> CRule::CRule(<font class="keyword">const</font> CRule &amp;c) : CClause(c)
+00044 {
+00045 std::vector&lt;IBaseAssert *&gt;::const_iterator it_c = c._Concs.begin();
+00046 <font class="keywordflow">while</font> ( it_c != c._Concs.end() )
+00047 {
+00048 <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.push_back( *it_c );
+00049 it_c++;
+00050 }
+00051
+00052 std::vector&lt; std::vector&lt;sint32&gt; &gt;::const_iterator it_li = c._PosVarsConc.begin();
+00053 <font class="keywordflow">while</font> ( it_li != c._PosVarsConc.end() )
+00054 {
+00055 std::vector&lt;sint32&gt;::const_iterator it_i = (*it_li).begin();
+00056 <a class="code" href="classNLAILOGIC_1_1CRule.html#o1">_PosVarsConc</a>.push_back( std::vector&lt;sint32&gt;() );
+00057
+00058 <font class="keywordflow">while</font> ( it_i != (*it_li).end() )
+00059 {
+00060 <a class="code" href="classNLAILOGIC_1_1CRule.html#o1">_PosVarsConc</a>.back().push_back( *it_i ) ;
+00061 it_i++;
+00062 }
+00063 it_li++;
+00064 }
+00065 }
+00066
+<a name="l00067"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a6">00067</a> <font class="keywordtype">void</font> CRule::setCond(CClause &amp;c)
+00068 {
+00069 <font class="comment">/* std::list&lt; std::vector&lt;sint32&gt; &gt;::const_iterator it_li = c._pos_vars.begin();</font>
+00070 <font class="comment"> while ( it_li != c._pos_vars.end() )</font>
+00071 <font class="comment"> {</font>
+00072 <font class="comment"> std::vector&lt;sint32&gt;::const_iterator it_i = (*it_li).begin();</font>
+00073 <font class="comment"> _pos_vars.push_back( std::vector&lt;sint32&gt;() );</font>
+00074 <font class="comment"></font>
+00075 <font class="comment"> while ( it_i != (*it_li).end() )</font>
+00076 <font class="comment"> {</font>
+00077 <font class="comment"> _pos_vars.back().push_back( *it_i ) ;</font>
+00078 <font class="comment"> it_i++;</font>
+00079 <font class="comment"> }</font>
+00080 <font class="comment"> it_li++;</font>
+00081 <font class="comment"> }*/</font>
+00082 }
+00083
+<a name="l00084"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a4">00084</a> CRule::~CRule()
+00085 {
+00086 }
+00087
+<a name="l00088"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a10">00088</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1IBasicType.html">NLAIC::IBasicType</a> *CRule::clone()<font class="keyword"> const</font>
+00089 <font class="keyword"> </font>{
+00090 <a class="code" href="classNLAIC_1_1IBasicInterface.html">NLAIC::IBasicInterface</a> *m = <font class="keyword">new</font> <a class="code" href="classNLAILOGIC_1_1CRule.html#a0">CRule</a>(*<font class="keyword">this</font>);
+00091 <font class="keywordflow">return</font> m;
+00092 }
+00093
+<a name="l00094"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a11">00094</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1IBasicType.html">NLAIC::IBasicType</a> *CRule::newInstance()<font class="keyword"> const</font>
+00095 <font class="keyword"> </font>{
+00096 <a class="code" href="classNLAILOGIC_1_1CRule.html#a0">CRule</a> *instance = <font class="keyword">new</font> <a class="code" href="classNLAILOGIC_1_1CRule.html#a0">CRule</a>();
+00097 <font class="keywordflow">return</font> instance;
+00098 }
+00099
+00100
+<a name="l00101"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a5">00101</a> <font class="keywordtype">void</font> CRule::addConc(CFactPattern *conc)
+00102 {
+00103 <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.push_back( conc-&gt;getAssert() );
+00104
+00105 <font class="comment">// Recherche l'assertion</font>
+00106 <a class="code" href="types__nl_8h.html#a8">sint32</a> pos_assert= <a class="code" href="classNLAILOGIC_1_1CClause.html#b0">findAssert</a>( conc-&gt;getAssert() );
+00107 <font class="keywordflow">if</font> ( pos_assert &lt; 0 )
+00108 {
+00109 <a class="code" href="classNLAILOGIC_1_1CClause.html#n7">_Asserts</a>.push_back( conc-&gt;getAssert() );
+00110 pos_assert = <a class="code" href="classNLAILOGIC_1_1CClause.html#n7">_Asserts</a>.size();
+00111 }
+00112
+00113 <font class="comment">// Recherche si variables à ajouter</font>
+00114 std::vector&lt;sint32&gt; pos_vars;
+00115 std::vector&lt;IBaseVar *&gt; *vars_conc = conc-&gt;getVars();
+00116 <font class="keywordflow">if</font> ( vars_conc )
+00117 {
+00118 std::vector&lt;IBaseVar *&gt;::iterator it_conc = vars_conc-&gt;begin();
+00119 <font class="keywordflow">while</font> ( it_conc != vars_conc-&gt;end() )
+00120 {
+00121 <font class="keywordtype">bool</font> found;
+00122 <font class="keywordflow">if</font> ( <a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>.size() )
+00123 {
+00124 found = <font class="keyword">false</font>;
+00125 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i &lt; (sint32)<a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>.size() ; i++ )
+00126 {
+00127 <font class="keywordflow">if</font> ( ( *it_conc )-&gt;getName() == <a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>[ i ]-&gt;getName() )
+00128 {
+00129 found = <font class="keyword">true</font>;
+00130 pos_vars.push_back( i );
+00131 }
+00132 }
+00133 }
+00134 <font class="keywordflow">else</font>
+00135 found = <font class="keyword">false</font>;
+00136
+00137 <font class="keywordflow">if</font> ( !found )
+00138 {
+00139 <a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>.push_back( (IBaseVar *)(*it_conc)-&gt;clone() );
+00140 pos_vars.push_back( <a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>.size() - 1);
+00141 }
+00142 it_conc++;
+00143 }
+00144 }
+00145
+00146 <font class="comment">// Prévenir l'assertion</font>
+00147 <font class="keywordflow">if</font> ( conc-&gt;getAssert() )
+00148 {
+00149 ((CFirstOrderAssert *)conc-&gt;getAssert())-&gt;addInput( <font class="keyword">this</font>, pos_vars );
+00150 <a class="code" href="classNLAILOGIC_1_1CRule.html#o1">_PosVarsConc</a>.push_back( pos_vars );
+00151 }
+00152
+00153 <font class="keywordflow">for</font> ( <a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i &lt; (sint32) vars_conc-&gt;size(); i++ )
+00154 {
+00155 (*vars_conc)[i]-&gt;release();
+00156 }
+00157 <font class="keyword">delete</font> vars_conc;
+00158 }
+00159
+<a name="l00160"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a7">00160</a> <font class="keywordtype">void</font> CRule::forward(CVarSet *fp)
+00161 {
+00162
+00163 }
+00164
+<a name="l00165"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a8">00165</a> <font class="keywordtype">void</font> CRule::addConflicts()
+00166 {
+00167 <font class="comment">// Execute la conclusion de la règle</font>
+00168 <a class="code" href="classstd_1_1list.html">std::list&lt;CValueSet *&gt;</a>::iterator it_conf = <a class="code" href="classNLAILOGIC_1_1CClause.html#n5">_Conflits</a>.begin();
+00169 <font class="keywordflow">while</font> ( it_conf != <a class="code" href="classNLAILOGIC_1_1CClause.html#n5">_Conflits</a>.end() )
+00170 {
+00171 <a class="code" href="types__nl_8h.html#a8">sint32</a> pos = 0;
+00172 std::vector&lt;IBaseAssert *&gt;::iterator it_conc = <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.begin();
+00173 std::vector&lt; std::vector&lt;sint32&gt; &gt;::iterator it_pos = <a class="code" href="classNLAILOGIC_1_1CRule.html#o1">_PosVarsConc</a>.begin();
+00174 <font class="keywordflow">while</font> ( it_conc != <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.end() )
+00175 {
+00176 <font class="comment">// Construire le fait correspondant par rapport à la position des variables</font>
+00177 CValueSet *conflit = <font class="keyword">new</font> CValueSet( *it_conf , *it_pos );
+00178
+00180 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00181 <font class="preprocessor"></font> std::string buf;
+00182 std::string buf2;
+00183 (*it_conc)-&gt;getDebugString( buf );
+00184 conflit-&gt;getDebugString( buf2 );
+00185 <font class="preprocessor">#endif</font>
+00186 <font class="preprocessor"></font> <font class="comment">//TRACE("\nCONCLUSION DE LA REGLE: \n ASSERTION: %s VALEURS: %s\n", buf, buf2);</font>
+00188 <font class="comment"> it_conc++;</font>
+00189 }
+00190 it_conf++;
+00191 pos++;
+00192 }
+00193 }
+00194
+<a name="l00195"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a3">00195</a> <font class="keywordtype">void</font> CRule::init(IObjectIA *<a class="code" href="driver__opengl__extension__def_8h.html#a224">params</a>)
+00196 {
+00197 <font class="comment">/* if ( params-&gt;size() != 3 )</font>
+00198 <font class="comment"> {</font>
+00199 <font class="comment"> // TODO throw Exc::....</font>
+00200 <font class="comment"> }*/</font>
+00201
+00202 <font class="comment">// Conditions</font>
+00203 <a class="code" href="classNLAILOGIC_1_1CClause.html#a0">CClause</a> *cond = (<a class="code" href="classNLAILOGIC_1_1CClause.html#a0">CClause</a> *) ((IBaseGroupType *)<a class="code" href="driver__opengl__extension__def_8h.html#a224">params</a>)-&gt;popFront();
+00204 std::vector&lt;IBaseVar *&gt; *vars = cond-&gt;getVars();
+00205
+00206 <font class="keywordtype">int</font> i;
+00207
+00208 <font class="keywordflow">for</font> ( i = 0; i &lt; (sint32)vars-&gt;size() ; i++ )
+00209 {
+00210 <a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>.push_back( (IBaseVar *) (* vars)[ i ]-&gt;<a class="code" href="classNLAILOGIC_1_1CRule.html#a10">clone</a>() );
+00211 }
+00212
+00213 <font class="keywordflow">for</font> ( i = 0; i &lt; (sint32) vars-&gt;size() ; i++ )
+00214 (*vars)[i]-&gt;release();
+00215 <font class="keyword">delete</font> vars;
+00216 cond-&gt;release();
+00217
+00218 <font class="comment">// Conclusions</font>
+00219 IBaseGroupType *concs = (IBaseGroupType *) ((IBaseGroupType *)<a class="code" href="driver__opengl__extension__def_8h.html#a224">params</a>)-&gt;popFront();
+00220 CIteratorContener it_fp = concs-&gt;getIterator();
+00221 <a class="code" href="types__nl_8h.html#a8">sint32</a> <a class="code" href="driver__opengl__extension__def_8h.html#a244">s</a> = concs-&gt;size();
+00222 <font class="keywordflow">while</font> ( !it_fp.isInEnd() )
+00223 {
+00224 CFactPattern *tmp = (CFactPattern *) ( it_fp ++)-&gt;clone();
+00225 <a class="code" href="classNLAILOGIC_1_1CRule.html#a5">addConc</a>( tmp);
+00226 tmp-&gt;release();
+00227 <font class="comment">//it_fp++;</font>
+00228 }
+00229
+00230 concs-&gt;release();
+00231 }
+00232
+<a name="l00233"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a9">00233</a> <font class="keyword">const</font> <a class="code" href="classNLAIC_1_1CIdentType.html">NLAIC::CIdentType</a> &amp;CRule::getType()<font class="keyword"> const</font>
+00234 <font class="keyword"> </font>{
+00235 <font class="keywordflow">return</font> <a class="code" href="classNLAILOGIC_1_1CRule.html#p0">IdRule</a>;
+00236 }
+00237
+<a name="l00238"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a12">00238</a> <font class="keywordtype">void</font> CRule::getDebugString(std::string &amp;txt)<font class="keyword"> const</font>
+00239 <font class="keyword"> </font>{
+00240 txt += <font class="stringliteral">"CRule\n - Conditions: "</font>;
+00241 std::vector&lt;IBaseBoolType *&gt;::const_iterator it_c = <a class="code" href="classNLAILOGIC_1_1CClause.html#n1">_Conds</a>.begin();
+00242 <font class="keywordflow">while</font> ( it_c != <a class="code" href="classNLAILOGIC_1_1CClause.html#n1">_Conds</a>.end() )
+00243 {
+00244 std::string buf;
+00245 ( *it_c )-&gt;getDebugString( buf );
+00246 txt += <font class="stringliteral">" - "</font>;
+00247 txt += buf;
+00248 it_c++;
+00249 }
+00250
+00251 txt += <font class="stringliteral">"\n - Conclusions: "</font>;
+00252
+00253 std::vector&lt;IBaseAssert *&gt;::const_iterator it_cc = <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.begin();
+00254
+00255 <font class="keywordflow">while</font> ( it_cc != <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.end() )
+00256 {
+00257 std::string buf;
+00258 ( *it_cc )-&gt;getDebugString( buf );
+00259 txt += <font class="stringliteral">" - "</font>;
+00260 txt += buf;
+00261 it_cc++;
+00262 }
+00263
+00264 txt += <font class="stringliteral">"\n - Variables "</font>;
+00265 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i &lt; (sint32)<a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>.size(); i++ )
+00266 {
+00267 std::string buf;
+00268 <a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>[ i ]-&gt;getDebugString( buf );
+00269 txt += <font class="stringliteral">" - "</font>;
+00270 txt += buf;
+00271 }
+00272 }
+00273
+00276 <font class="comment">// Chainage arrière</font>
+00277
+00278
+<a name="l00279"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a14">00279</a> CVarSet *CRule::backWard(CFactPattern *fp)
+00280 {
+00281 <font class="comment">// Vecteur temporaire des variables</font>
+00282 <a class="code" href="classNLAILOGIC_1_1CVarSet.html#a0">CVarSet</a> *tmp_vars = <font class="keyword">new</font> <a class="code" href="classNLAILOGIC_1_1CVarSet.html#a0">CVarSet</a>;
+00283 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i &lt; (sint32) <a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>.size() ; i++)
+00284 tmp_vars-&gt;addVar( <a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>[i] );
+00285
+00286 <font class="comment">// Trouver l'assertion dans la conclusion</font>
+00287 std::vector&lt;IBaseAssert *&gt;::iterator it_a = <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.begin();
+00288 std::vector&lt; std::vector&lt;sint32&gt; &gt;::iterator it_p = <a class="code" href="classNLAILOGIC_1_1CRule.html#o1">_PosVarsConc</a>.begin();
+00289 <font class="keywordflow">while</font> ( it_a != <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.end() &amp;&amp; (*it_a) != fp-&gt;getAssert() )
+00290 {
+00291 it_a++;
+00292 it_p++;
+00293 }
+00294 <font class="keywordflow">if</font> ( it_a == <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.end() )
+00295 <font class="keywordflow">return</font> NULL;
+00296
+00297 std::vector&lt;sint32&gt; pos_list = *it_p;
+00298 std::vector&lt;sint32&gt;::iterator it_pos = pos_list.begin();
+00299
+00300 <font class="comment">// Unification avec la valeur des variables</font>
+00301 <a class="code" href="types__nl_8h.html#a8">sint32</a> <a class="code" href="driver__opengl__extension__def_8h.html#a225">index</a> = 0;
+00302 <font class="keywordflow">while</font> ( it_pos != pos_list.end() )
+00303 {
+00304 <font class="keywordflow">if</font> ( (*tmp_vars-&gt;getVars())[*it_pos]-&gt;getValue() == NULL)
+00305 (*tmp_vars)[*it_pos]-&gt;setValue( (*fp)[<a class="code" href="driver__opengl__extension__def_8h.html#a225">index</a>]-&gt;getValue() );
+00306 <font class="keywordflow">else</font>
+00307 {
+00308 <font class="keywordflow">return</font> NULL;
+00309 }
+00310 it_pos++;
+00311 <a class="code" href="driver__opengl__extension__def_8h.html#a225">index</a>++;
+00312 }
+00313 <font class="keywordflow">return</font> tmp_vars;
+00314 }
+00315
+00316 <font class="comment">// Retourne une liste de faits complets</font>
+<a name="l00317"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a17">00317</a> <a class="code" href="classstd_1_1list.html">std::list&lt;CValueSet *&gt;</a> *CRule::unifyBack(CFactPattern *fp)
+00318 {
+00319 <a class="code" href="classstd_1_1list.html">std::list&lt;CValueSet *&gt;</a> *unified_list = <font class="keyword">new</font> <a class="code" href="classstd_1_1list.html">std::list&lt;CValueSet *&gt;</a>;
+00320
+00321 <font class="comment">// Vecteur temporaire des variables</font>
+00322 <a class="code" href="classNLAILOGIC_1_1CVarSet.html#a0">CVarSet</a> *tmp_vars = <font class="keyword">new</font> <a class="code" href="classNLAILOGIC_1_1CVarSet.html#a0">CVarSet</a>;
+00323 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a8">sint32</a> i = 0; i &lt; (sint32) <a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>.size() ; i++)
+00324 tmp_vars-&gt;addVar( <a class="code" href="classNLAILOGIC_1_1CVarSet.html#n0">_Vars</a>[i] );
+00325
+00326 <font class="comment">// Trouver l'assertion dans la conclusion</font>
+00327 std::vector&lt;IBaseAssert *&gt;::iterator it_a = <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.begin();
+00328 std::vector&lt; std::vector&lt;sint32&gt; &gt;::iterator it_p = <a class="code" href="classNLAILOGIC_1_1CRule.html#o1">_PosVarsConc</a>.begin();
+00329 <font class="keywordflow">while</font> ( it_a != <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.end() &amp;&amp; (*it_a) != fp-&gt;getAssert() )
+00330 {
+00331 it_a++;
+00332 it_p++;
+00333 }
+00334 <font class="keywordflow">if</font> ( it_a == <a class="code" href="classNLAILOGIC_1_1CRule.html#o0">_Concs</a>.end() )
+00335 <font class="keywordflow">return</font> NULL;
+00336
+00337 IBaseAssert *my_assert = *it_a;
+00338
+00339 <font class="comment">// Créé la liste des valeurs </font>
+00340 <a class="code" href="classstd_1_1list.html">std::list&lt;IObjetOp *&gt;</a> *vals = fp-&gt;getValues();
+00341
+00342 <font class="comment">// Pour chaque liaison...</font>
+00343 <a class="code" href="classstd_1_1list.html">std::list&lt; CValueSet *&gt;</a>::iterator it_l = <a class="code" href="classNLAILOGIC_1_1CClause.html#n3">_Liaisons</a>.begin();
+00344
+00345 <font class="keywordflow">while</font> ( it_l != <a class="code" href="classNLAILOGIC_1_1CClause.html#n3">_Liaisons</a>.end() )
+00346 {
+00347 CValueSet *<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = *it_l;
+00348 <font class="keywordtype">bool</font> complete;
+00349 CValueSet *result = <a class="code" href="classNLAILOGIC_1_1CRule.html#a13">unifyLiaisonBack</a>( <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, *vals, *it_p, complete );
+00350 <font class="keywordflow">if</font> ( result )
+00351 {
+00352 <font class="keywordflow">if</font> ( complete )
+00353 {
+00354 <font class="comment">// Ceux là on les rajoute direct dans la liste</font>
+00355 <font class="comment">//char test[1024 * 2];</font>
+00356 <font class="comment">//result-&gt;getDebugString( test );</font>
+00357 CValueSet *n = fp-&gt;asCValueSet();
+00358 <a class="code" href="types__nl_8h.html#a8">sint32</a> pos_r = 0;
+00359 std::vector&lt;sint32&gt;::iterator it_i = (*it_p).begin();
+00360 <font class="keywordflow">while</font> ( it_i != (*it_p).end() )
+00361 {
+00362 <a class="code" href="types__nl_8h.html#a8">sint32</a> i = *it_i;
+00363 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00364 <font class="preprocessor"></font> std::string buf;
+00365 (*result)[ *it_i ]-&gt;getDebugString(buf);
+00366 <font class="preprocessor">#endif</font>
+00367 <font class="preprocessor"></font>
+00368 n-&gt;setValue( pos_r, (*result)[ *it_i ] );
+00369 it_i++;
+00370 pos_r++;
+00371 }
+00372 unified_list-&gt;push_back( n );
+00373 }
+00374 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00375 <font class="preprocessor"></font> <font class="keywordflow">else</font>
+00376 {
+00377 <font class="comment">// Ceux là on continue à les propager en arrière!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</font>
+00378
+00379 std::string <a class="code" href="namespaceNLAISCRIPT.html#a21">test</a>;
+00380 result-&gt;getDebugString( <a class="code" href="namespaceNLAISCRIPT.html#a21">test</a> );
+00381 }
+00382 <font class="preprocessor">#endif</font>
+00383 <font class="preprocessor"></font> }
+00384 it_l++;
+00385 }
+00386 <font class="keywordflow">return</font> unified_list;
+00387 }
+00388
+<a name="l00389"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a16">00389</a> <font class="keywordtype">void</font> CRule::backward( <a class="code" href="classstd_1_1list.html">std::list&lt;CValueSet *&gt;</a> *vs )
+00390 {
+00391 std::vector&lt;IBaseBoolType *&gt;::iterator it_cond = <a class="code" href="classNLAILOGIC_1_1CClause.html#n1">_Conds</a>.begin();
+00392 <font class="keywordflow">while</font> ( it_cond != <a class="code" href="classNLAILOGIC_1_1CClause.html#n1">_Conds</a>.end() )
+00393 {
+00394 <a class="code" href="classstd_1_1list.html">std::list&lt;CValueSet *&gt;</a>::iterator it_vs = vs-&gt;begin();
+00395 <font class="keywordflow">while</font> ( it_vs != vs-&gt;end() )
+00396 {
+00397 <font class="comment">// ( (CFirstOrderAssert *) *it_cond )-&gt;backward( *it_vs );</font>
+00398 it_vs++;
+00399 }
+00400 it_cond++;
+00401 }
+00402 }
+00403
+00404 CValueSet *CRule::unifyLiaisonBack(CValueSet *liaison, <a class="code" href="classstd_1_1list.html">std::list&lt;IObjetOp *&gt;</a> &amp;vals, std::vector&lt;sint32&gt; &amp;pos, <font class="keywordtype">bool</font> &amp;defined)
+00405 {
+00406 <a class="code" href="types__nl_8h.html#a8">sint32</a> nb_undefined = pos.size();
+00407 CValueSet *unified = <font class="keyword">new</font> CValueSet( *liaison );
+00408 std::vector&lt;sint32&gt;::iterator it_pos = pos.begin();
+00409 <a class="code" href="classstd_1_1list.html">std::list&lt;IObjetOp *&gt;</a>::iterator it_v = vals.begin();
+00410 <font class="keywordflow">while</font> ( it_pos != pos.end() )
+00411 {
+00412 <a class="code" href="classNLAIAGENT_1_1IObjectIA.html#b0">IObjectIA</a> *l_val = (*unified)[*it_pos];
+00413 <a class="code" href="classNLAIAGENT_1_1IObjectIA.html#b0">IObjectIA</a> *r_val = *it_v;
+00414 <a class="code" href="types__nl_8h.html#a8">sint32</a> p = *it_pos;
+00415 <font class="keywordflow">if</font> ( !l_val )
+00416 {
+00417 <font class="comment">/* if ( r_val )</font>
+00418 <font class="comment"> {</font>
+00419 <font class="comment"> unified-&gt;setValue( p , r_val );</font>
+00420 <font class="comment"> nb_undefined--;</font>
+00421 <font class="comment"> }*/</font>
+00422 }
+00423 <font class="keywordflow">else</font>
+00424 {
+00425 <font class="keywordflow">if</font> ( r_val &amp;&amp; ( l_val != r_val ) )
+00426 {
+00427 unified-&gt;release();
+00428 <font class="keywordflow">return</font> NULL;
+00429 }
+00430 <font class="keywordflow">else</font>
+00431 <font class="keywordflow">if</font> ( r_val )
+00432 nb_undefined--;
+00433 }
+00434 it_pos++;
+00435 it_v++;
+00436 }
+00437 defined = ( nb_undefined == 0 );
+00438
+00439 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00440 <font class="preprocessor"></font> std::string buf;
+00441 unified-&gt;getDebugString(buf);
+00442 <font class="preprocessor">#endif</font>
+00443 <font class="preprocessor"></font>
+00444
+00445 <font class="keywordflow">return</font> unified;
+00446 }
+00447
+00448 <font class="comment">// Retourne les assertions avec les positions des variables d'une conclusion dans les conditions</font>
+<a name="l00449"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a18">00449</a> <font class="keywordtype">void</font> CRule::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&lt;sint32&gt; &amp;cond_pos)
+00450 {
+00451 std::vector&lt;sint32&gt;::iterator it_conc = <a class="code" href="classNLAILOGIC_1_1CRule.html#o1">_PosVarsConc</a>[ no_conc ].begin();
+00452 <font class="keywordflow">while</font> ( it_conc != <a class="code" href="classNLAILOGIC_1_1CRule.html#o1">_PosVarsConc</a>[ no_conc ].end() )
+00453 {
+00454 std::vector&lt;sint32&gt;::iterator it_cond = <a class="code" href="classNLAILOGIC_1_1CClause.html#n2">_PosVarsCond</a>[ no_cond ].begin();
+00455 <font class="keywordflow">while</font> ( it_cond != <a class="code" href="classNLAILOGIC_1_1CClause.html#n2">_PosVarsCond</a>[ no_cond ].end() )
+00456 {
+00457 <font class="keywordflow">if</font> ( (*it_conc) == (*it_cond) )
+00458 {
+00459 cond_pos.push_back( *it_cond );
+00460 }
+00461 it_cond++;
+00462 }
+00463 it_conc++;
+00464 }
+00465 }
+00466
+00467 <font class="comment">// Retourne les assertions avec les positions des variables d'une conclusion dans les conditions</font>
+<a name="l00468"></a><a class="code" href="classNLAILOGIC_1_1CRule.html#a19">00468</a> <font class="keywordtype">void</font> CRule::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&lt;sint32&gt; &amp;conc_pos)
+00469 {
+00470 std::vector&lt;sint32&gt;::iterator it_cond = <a class="code" href="classNLAILOGIC_1_1CClause.html#n2">_PosVarsCond</a>[ no_cond ].begin();
+00471 <font class="keywordflow">while</font> ( it_cond != <a class="code" href="classNLAILOGIC_1_1CClause.html#n2">_PosVarsCond</a>[ no_cond ].end() )
+00472 {
+00473 std::vector&lt;sint32&gt;::iterator it_conc = <a class="code" href="classNLAILOGIC_1_1CRule.html#o1">_PosVarsConc</a>[ no_conc ].begin();
+00474 <font class="keywordflow">while</font> ( it_conc != <a class="code" href="classNLAILOGIC_1_1CRule.html#o1">_PosVarsConc</a>[ no_conc ].end() )
+00475 {
+00476 <font class="keywordflow">if</font> ( (*it_cond) == (*it_conc) )
+00477 {
+00478 conc_pos.push_back( *it_conc );
+00479 }
+00480 it_conc++;
+00481 }
+00482 it_cond++;
+00483 }
+00484 }
+00485 }
+</pre></div>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </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>