| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2003-2015 Dmitry Tsarkov and The University of Manchester |
| 3 | Copyright (C) 2015-2017 Dmitry Tsarkov |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #ifndef CONCEPTWITHDEP_H |
| 21 | #define CONCEPTWITHDEP_Hcxx . . $ `Kernel/ConceptWithDep.h:21:9`! |
| 22 | |
| 23 | #include "BiPointer.h"cxx . . $ `<file>/Kernel/BiPointer.h`/ |
| 24 | #include "DepSet.h"cxx . . $ `<file>/Kernel/DepSet.h`/ |
| 25 | |
| 26 | /// Concept with dependence: bipolar pointer to concept and a set of dependencies |
| 27 | class ConceptWDepcxx . . $ ConceptWDep# |
| 28 | { |
| 29 | protected: // members |
| 30 | /// "pointer" to a concept in DAG |
| 31 | BipolarPointercxx . . $ BipolarPointer# Conceptcxx . . $ ConceptWDep#Concept. = bpINVALIDcxx . . $ bpINVALID.; |
| 32 | /// dep-set for a concept |
| 33 | DepSetcxx . . $ DepSet# depSetcxx . . $ ConceptWDep#depSet.; |
| 34 | |
| 35 | public: // methods |
| 36 | /// empty c'tor |
| 37 | ConceptWDepcxx . . $ ConceptWDep#ConceptWDep(49f6e7a06ebc5aa8).() = default; |
| 38 | /// c'tor with empty dep-set |
| 39 | explicit ConceptWDepcxx . . $ ConceptWDep#ConceptWDep(d4f767463ce0a6b3). ( BipolarPointercxx . . $ BipolarPointer# p ) : Conceptcxx . . $ ConceptWDep#Concept.(p) {} |
| 40 | /// usual c'tor |
| 41 | ConceptWDepcxx . . $ ConceptWDep#ConceptWDep(12a183a495b39f91). ( BipolarPointercxx . . $ BipolarPointer# p, const DepSetcxx . . $ DepSet#& dep ) : Conceptcxx . . $ ConceptWDep#Concept.(p), depSetcxx . . $ ConceptWDep#depSet.(dep) {} |
| 42 | /// copy c'tor |
| 43 | ConceptWDepcxx . . $ ConceptWDep#ConceptWDep(ae2a9648ed5e6860). ( const ConceptWDepcxx . . $ ConceptWDep#& c ) = default; |
| 44 | /// copy c'tor with additional dep-set |
| 45 | ConceptWDepcxx . . $ ConceptWDep#ConceptWDep(66c5db4ad72ed917). ( const ConceptWDepcxx . . $ ConceptWDep#& c, const DepSetcxx . . $ DepSet#& dep ) : Conceptcxx . . $ ConceptWDep#Concept.(c.Conceptcxx . . $ ConceptWDep#Concept.), depSetcxx . . $ TDepSet#TDepSet(d0e32107376501c0).(c.depSetcxx . . $ ConceptWDep#depSet.) { depSetcxx . . $ ConceptWDep#depSet..addcxx . . $ TDepSet#add(d0e32107376501c0).(dep); } |
| 46 | |
| 47 | // comparison |
| 48 | |
| 49 | bool operatorcxx . . $ ConceptWDep#`operator==`(4e0e5e4d692fd127). == ( const ConceptWDepcxx . . $ ConceptWDep#& ce ) const { return Conceptcxx . . $ ConceptWDep#Concept. == ce.Conceptcxx . . $ ConceptWDep#Concept.; } |
| 50 | bool operatorcxx . . $ ConceptWDep#`operator!=`(4e0e5e4d692fd127). != ( const ConceptWDepcxx . . $ ConceptWDep#& ce ) const { return Conceptcxx . . $ ConceptWDep#Concept. != ce.Conceptcxx . . $ ConceptWDep#Concept.; } |
| 51 | bool operatorcxx . . $ ConceptWDep#`operator==`(4a668f6de69bf818). == ( BipolarPointercxx . . $ BipolarPointer# p ) const { return Conceptcxx . . $ ConceptWDep#Concept. == p; } |
| 52 | bool operatorcxx . . $ ConceptWDep#`operator!=`(4a668f6de69bf818). != ( BipolarPointercxx . . $ BipolarPointer# p ) const { return Conceptcxx . . $ ConceptWDep#Concept. != p; } |
| 53 | |
| 54 | // access to elements |
| 55 | |
| 56 | /// get bp-part |
| 57 | BipolarPointercxx . . $ BipolarPointer# bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf). ( void ) const { return Conceptcxx . . $ ConceptWDep#Concept.; } |
| 58 | /// get dep-set part |
| 59 | const DepSetcxx . . $ DepSet#& getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29). ( void ) const { return depSetcxx . . $ ConceptWDep#depSet.; } |
| 60 | |
| 61 | /// create CWD with inverted body and the same dep-set |
| 62 | ConceptWDepcxx . . $ ConceptWDep# inversecxx . . $ ConceptWDep#inverse(f0b4eeb5f8322057). ( void ) const { return ConceptWDepcxx . . $ ConceptWDep# ( ::inversecxx . . $ inverse(7864480464b09eea).(Conceptcxx . . $ ConceptWDep#Concept.), getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29). () ); } |
| 63 | /// add dep-set to a CWD |
| 64 | void addDepcxx . . $ ConceptWDep#addDep(d0e32107376501c0). ( const DepSetcxx . . $ DepSet#& d ) { depSetcxx . . $ ConceptWDep#depSet..addcxx . . $ TDepSet#add(d0e32107376501c0).(d); } |
| 65 | |
| 66 | /// print concept and a dep-set |
| 67 | template <typename O> |
| 68 | friend O& operatorcxx . . $ `operator<<`(658aaef1ace96007). << ( O& o, const ConceptWDepcxx . . $ ConceptWDep#& c ) { o <<cxx . . $ `operator<<`(8df530197ee94a2e). c.Conceptcxx . . $ ConceptWDep#Concept. <<cxx . . $ `operator<<`(98dd0759a4925697). c.getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); return o; } |
| 69 | }; // ConceptWDep |
| 70 | |
| 71 | /// create an inverse of a given CWD with the same dep-set |
| 72 | inline ConceptWDepcxx . . $ ConceptWDep# inversecxx . . $ inverse(2a1413093fe85b90). ( const ConceptWDepcxx . . $ ConceptWDep#& C ) { return ConceptWDepcxx . . $ ConceptWDep# ( inversecxx . . $ inverse(7864480464b09eea).(C.bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()), C.getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).() ); } |
| 73 | |
| 74 | #endif // CONCEPTWITHDEP_H |