aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/fo__operator_8cpp-source.html
blob: c1ffe22ac3bb61c84aa78da9369af24a3d5832bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
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>&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>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 &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="fo__operator_8h.html">nel/ai/logic/fo_operator.h</a>"</font>
00021 
00022 <font class="preprocessor">#include &lt;list&gt;</font>
00023 <font class="preprocessor">#include &lt;vector&gt;</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 &amp;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&lt;IBaseAssert *&gt;::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&lt; std::vector&lt;sint32&gt; &gt;::const_iterator it_li = c._PosVarsCond.begin();
00065                 <font class="keywordflow">while</font> ( it_li != c._PosVarsCond.end() )
00066                 {
00067                         std::vector&lt;sint32&gt;::const_iterator it_i = (*it_li).begin();
00068                         <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n1">_PosVarsCond</a>.push_back( std::vector&lt;sint32&gt;() );
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&lt;sint32&gt;::const_iterator it_i = (*it_li).begin();
00082                         <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n2">_PosVarsConc</a>.push_back( std::vector&lt;sint32&gt;() );
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 &lt; (sint32)<a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>.size() ; i++ ) 
00099                         {
00100                                 <font class="keywordflow">if</font> ( var-&gt;getName() == <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>[ i ]-&gt;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 &lt; (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 ]-&gt;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&lt;IBaseAssert *&gt;&amp;patterns, std::vector&lt;sint32&gt; &amp;pos_Vars)
00116         {
00117                 <font class="comment">// Recherche si variables � ajouter</font>
00118                 std::vector&lt;IBaseVar *&gt; *vars_pattern = fp-&gt;getVars();
00119                 <font class="keywordflow">if</font> ( vars_pattern )
00120                 {
00121                         std::vector&lt;IBaseVar *&gt;::iterator it_cond = vars_pattern-&gt;begin();
00122                         <font class="keywordflow">while</font> ( it_cond != vars_pattern-&gt;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)-&gt;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 &lt; (sint32) vars_pattern-&gt;size(); i++ )
00139                 {
00140                         (*vars_pattern)[i]-&gt;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-&gt;getAssert() )
00148                 {
00149                         std::vector&lt;sint32&gt; 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-&gt;getAssert()-&gt;addClause( this, pos_Vars );</font>
00153                         <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>.push_back( pattern-&gt;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-&gt;getAssert() )
00162                 {
00163                         std::vector&lt;sint32&gt; 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-&gt;getAssert()-&gt;addInput( <font class="keyword">this</font> );
00167                         <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n3">_Concs</a>.push_back( pattern-&gt;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&lt;sint32&gt; &amp;cond_pos)
00175         {
00176                 std::vector&lt;sint32&gt;::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&lt;sint32&gt;::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&lt;sint32&gt; &amp;conc_pos)
00194         {
00195                 std::vector&lt;sint32&gt;::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&lt;sint32&gt;::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&lt;IBaseAssert *&gt; &amp;<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>, std::vector&lt;sint32&gt; &amp;pos)
00212         {
00213                 <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="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&lt;CFactPattern *&gt;</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&lt;CFact *&gt;</a> &amp;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&lt;CFact *&gt;</a>::iterator it_f = facts.begin();
00229                 <font class="keywordflow">while</font> ( it_f != facts.end() )
00230                 {
00231                         std::vector&lt;sint32&gt; pos_assert;
00232                         <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b4">getAssertPos</a>( (*it_f)-&gt;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 &lt; (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 &lt; (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-&gt;setValue( l_pos, r_val );
00247                                                 }
00248                                         }
00249                                         <font class="keywordflow">else</font>
00250                                         {
00251                                                 <font class="keywordflow">if</font> ( r_val &amp;&amp; ( l_val != r_val ) )
00252                                                 {
00253                                                         unified-&gt;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&lt;CFact *&gt;</a> &amp;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&lt;CFact *&gt;</a>::iterator it_f = facts.begin();
00268                 <font class="keywordflow">while</font> ( it_f != facts.end() )
00269                 {
00270                         std::vector&lt;sint32&gt; pos_assert;
00271                         <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b4">getAssertPos</a>( (*it_f)-&gt;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 &lt; (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 &lt; (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-&gt;setValue( l_pos, r_val );
00286                                                 }
00287                                         }
00288                                         <font class="keywordflow">else</font>
00289                                         {
00290                                                 <font class="keywordflow">if</font> ( r_val &amp;&amp; ( l_val != r_val ) )
00291                                                 {
00292                                                         unified-&gt;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&lt;sint32&gt; &amp;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 &lt; (sint32) pl.size() ; i++ )
00307                 {
00308                         <a class="code" href="types__nl_8h.html#a8">sint32</a> p = pl[i];
00309                         result-&gt;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&lt;CFact *&gt;</a> *CFirstOrderOperator::backward(<a class="code" href="classstd_1_1list.html">std::list&lt;CFact *&gt;</a> &amp;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&lt;CFact *&gt;</a> *result = <font class="keyword">new</font> <a class="code" href="classstd_1_1list.html">std::list&lt;CFact *&gt;</a>;
00318                 <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_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-&gt;push_back( tmp );
00322 <font class="preprocessor">#ifdef NL_DEBUG</font>
00323 <font class="preprocessor"></font>                        std::string buffer;
00324                         tmp-&gt;getDebugString(buffer);
00325 <font class="preprocessor">#endif</font>
00326 <font class="preprocessor"></font>                }
00327                 unified-&gt;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&lt;CFact *&gt;</a> *CFirstOrderOperator::forward(<a class="code" href="classstd_1_1list.html">std::list&lt;CFact *&gt;</a> &amp;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-&gt;getDebugString( buf );
00338 <font class="preprocessor">#endif</font>
00339 <font class="preprocessor"></font>
00340                 <a class="code" href="classstd_1_1list.html">std::list&lt;CFact *&gt;</a> *result = <font class="keyword">new</font> <a class="code" href="classstd_1_1list.html">std::list&lt;CFact *&gt;</a>;
00341                 <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_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-&gt;push_back( tmp );
00345 
00346 <font class="preprocessor">#ifdef NL_DEBUG</font>
00347 <font class="preprocessor"></font>                        std::string buffer;
00348                         tmp-&gt;getDebugString(buffer);
00349 <font class="preprocessor">#endif</font>
00350 <font class="preprocessor"></font>                }
00351                 unified-&gt;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&lt;CFact *&gt;</a> *CFirstOrderOperator::propagate(<a class="code" href="classstd_1_1list.html">std::list&lt;CFact *&gt;</a> &amp;facts)
00357         {
00358                 <a class="code" href="classstd_1_1list.html">std::list&lt;CFact *&gt;</a> *conflicts = <font class="keyword">new</font> <a class="code" href="classstd_1_1list.html">std::list&lt;CFact *&gt;</a>;
00359                 <a class="code" href="classstd_1_1list.html">std::list&lt; CValueSet *&gt;</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&lt;CFact *&gt;::iterator it_f = facts.begin();
00364                 <font class="keywordflow">while</font> ( it_f != facts.end() )
00365                 {
00366                         std::vector&lt;sint32&gt; pos_asserts;
00367                         <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b4">getAssertPos</a>( (*it_f)-&gt;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 &lt; (sint32) pos_asserts.size(); i++ )
00369                         {
00370                                 <a class="code" href="classstd_1_1list.html">std::list&lt;CValueSet *&gt;</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-&gt;size() )
00374                                         {
00375                                                 <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_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-&gt;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>-&gt;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&lt;CFact *&gt;::iterator it_c = conflicts-&gt;begin();
00385                                                         <font class="keywordflow">while</font> ( ! found &amp;&amp; it_c != conflicts-&gt;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>-&gt;getDebugString( buf );
00395 <font class="preprocessor">#endif</font>
00396 <font class="preprocessor"></font>                                                                conflicts-&gt;push_back( <a class="code" href="driver__opengl__extension__def_8h.html#a246">r</a> );
00397                                                         }
00398                                                 }
00399                                                 links-&gt;front()-&gt;release();
00400                                                 links-&gt;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()-&gt;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&lt;sint32&gt; &amp;pos_vals)
00418         {
00419                 CValueSet *result;
00420 
00421                 <font class="keywordflow">if</font> ( result = fp-&gt;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&lt;CValueSet *&gt;</a> *CFirstOrderOperator::propagate(<a class="code" href="classstd_1_1list.html">std::list&lt;CValueSet *&gt;</a> &amp;liaisons, CValueSet *fact, std::vector&lt;sint32&gt; &amp;pos_vals) 
00431         {
00432                 <a class="code" href="classstd_1_1list.html">std::list&lt;CValueSet *&gt;</a> *conflits = <font class="keyword">new</font> <a class="code" href="classstd_1_1list.html">std::list&lt;CValueSet *&gt;</a>;
00433                 std::list&lt;CValueSet *&gt; buf_liaisons;
00434                 <font class="comment">// Pour chaque liaison...</font>
00435                 <a class="code" href="classstd_1_1list.html">std::list&lt; CValueSet *&gt;</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>-&gt;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-&gt;getDebugString( buf );
00452 <font class="preprocessor">#endif</font>
00453 <font class="preprocessor"></font>
00454                                 <font class="keywordflow">if</font> ( result-&gt;undefined() == 0 )
00455                                 {
00456                                         conflits-&gt;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&lt;CFact *&gt;</a> *CFirstOrderOperator::test(<a class="code" href="classstd_1_1list.html">std::list&lt;CFact *&gt;</a> &amp;facts)
00474         {
00475                 <a class="code" href="classstd_1_1list.html">std::list&lt;CFact *&gt;</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&lt;CFact *&gt;</a>::iterator it_f = preconds-&gt;begin();
00478                 <font class="keywordflow">while</font> ( it_f != preconds-&gt;end() )
00479                 {
00480                         ( (CFirstOrderAssert *)(*it_f)-&gt;getAssert() )-&gt;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> &amp;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> &amp;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 &amp;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&lt;IBaseAssert *&gt;::const_iterator it_a = <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>.begin();
00517                 std::vector&lt;std::vector&lt;sint32&gt; &gt;::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)-&gt;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 &lt; (sint32) (*it_p).size(); i++ )
00525                         {
00526                                 txt += <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>[ (*it_p)[i] ]-&gt;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)-&gt;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 &lt; (sint32) (*it_p).size(); i++ )
00545                         {
00546                                 txt += <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#n0">_Vars</a>[ (*it_p)[i] ]-&gt;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 &amp;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 &amp;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 &amp;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> &amp;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&lt;CFact *&gt;</a> *facts = <font class="keyword">new</font> <a class="code" href="classstd_1_1list.html">std::list&lt;CFact *&gt;</a>;
00595                 <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_1IBaseOperator.html#n2">_Conds</a>.size(); i++ )
00596                 {
00597                         std::list&lt;CFact *&gt; *fa = fb-&gt;getAssertFacts( <a class="code" href="classNLAILOGIC_1_1IBaseOperator.html#n2">_Conds</a>[i] );
00598                         <font class="keywordflow">while</font> ( fa-&gt;size() )
00599                         {
00600                                 facts-&gt;push_back( fa-&gt;front() );
00601                                 fa-&gt;pop_front();
00602                         }
00603                         <font class="keyword">delete</font> fa;
00604                 }
00605                 std::list&lt;CFact *&gt; *res = <a class="code" href="classNLAILOGIC_1_1CFirstOrderOperator.html#b8">propagate</a>( *facts );
00606                 <font class="keywordtype">bool</font> is_valid = !res-&gt;empty();
00607                 <font class="keywordflow">while</font> ( res-&gt;size() )
00608                 {
00609 <font class="preprocessor">#ifdef NL_DEBUG</font>
00610 <font class="preprocessor"></font>                        std::string buffer;
00611                         res-&gt;front()-&gt;getDebugString( buffer );
00612 <font class="preprocessor">#endif</font>
00613 <font class="preprocessor"></font>                        res-&gt;front()-&gt;release();
00614                         res-&gt;pop_front();
00615                 }
00616                 <font class="keyword">delete</font> res;
00617 
00618                 <font class="keywordflow">while</font> ( facts-&gt;size() )
00619                 {
00620                         facts-&gt;front()-&gt;release();
00621                         facts-&gt;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>&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>