# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

clause.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_CLAUSE_H
00027 #define NL_CLAUSE_H
00028 #include "nel/ai/logic/varset.h"
00029 
00030 namespace NLAILOGIC {
00031 
00032         class IBaseBoolType;
00033         class IBaseAssert;
00034         class CValueSet;
00035         class CBoolAssert;
00036 
00037         class CClause : public CVarSet {
00038                 protected:
00039                         std::list<CBoolAssert *>                        _SimpleConds;   
00040                         std::vector<IBaseBoolType *>            _Conds;
00041                         std::vector< std::vector<sint32> >      _PosVarsCond;
00042                         std::list< CValueSet *>                         _Liaisons;
00043                         std::list< CValueSet *>                         _BufLiaisons;
00044                         std::list< CValueSet *>                         _Conflits;
00045                         sint32 _NbValid;
00046                         
00047                 protected:
00048                         std::vector<IBaseAssert *>      _Asserts;
00049                         sint32 findAssert(IBaseAssert *);
00050                         bool _FirstOrderTrue;
00051 
00052                 public:
00053                         static const NLAIC::CIdentType IdClause;
00054 
00055                         CClause();
00056                         CClause(const CClause &);
00057                         CClause(std::list<CFactPattern   *> &);
00058                         ~CClause();
00059                         virtual void addCond(CFactPattern   *cond);
00060                         virtual void getDebugString(std::string &) const;
00061                         virtual CVarSet *unify(CVarSet *);
00062                         CValueSet *unifyLiaison( const CValueSet *, std::list<NLAIAGENT::IObjectIA *> *, std::vector<sint32> &);
00063                         virtual void propagate(std::list<NLAIAGENT::IObjectIA *> *, std::vector<sint32> &);
00064                         virtual void propagate(CFactPattern   *);
00065                         std::list<CClause *> *getInputs();
00066 
00067                         virtual const NLAIC::IBasicType *clone() const;
00068                         virtual const NLAIC::IBasicType *newInstance() const;
00069 
00070                         virtual NLAIAGENT::IObjetOp *operator ! () const;
00071                         virtual NLAIAGENT::IObjetOp *operator != (NLAIAGENT::IObjetOp &a) const;
00072                         virtual NLAIAGENT::IObjetOp *operator == (NLAIAGENT::IObjetOp &a) const;
00073                         virtual bool isTrue() const;
00074                         virtual float truthValue() const;
00075 
00076                         void showConflicts();
00077                         void showBuffer();
00078                         void showLiaisons();
00079 
00080                         virtual void addBuffer();
00081                         virtual void addConflicts();
00082 
00083                         std::vector<IBaseAssert *> &CClause::getAssert();
00084                         sint32 nbVars();
00085                         void CClause::init(NLAIAGENT::IObjectIA *);
00086         };
00087 }
00088 #endif