Debian Codegraph @

Source/Parser/Expressions/CQueryIsInstanceOfExpression.cpp

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #include "CQueryIsInstanceOfExpression.h"
22
23
24 namespace Konclude {
25
26 namespace Parser {
27
28 namespace Expression {
29
30
31 CQueryIsInstanceOfExpression::CQueryIsInstanceOfExpression(const QString& name, CIndividualTermExpression *individualExp, CClassTermExpression *classExp)
32 : CNameAssociator(name),CClassTermExpressionAssociator(classExp),CIndividualTermExpressionAssociator(individualExp) {
33 mConstructedClassExp = nullptr;
34 }
35
36
37 CQueryIsInstanceOfExpression::~CQueryIsInstanceOfExpression() {
38 }
39
40
41 CBuildExpression::ExpressionType CQueryIsInstanceOfExpression::getType() {
42 return BETISINSTANCEOF;
43 }
44
45 CClassTermExpression *CQueryIsInstanceOfExpression::getConstructedTestClassExpression() {
46 return mConstructedClassExp;
47 }
48
49 CQueryIsInstanceOfExpression *CQueryIsInstanceOfExpression::setConstructedTestClassExpression(CClassTermExpression *conBuildExp) {
50 mConstructedClassExp = conBuildExp;
51 return this;
52 }
53
54
55 cint64 CQueryIsInstanceOfExpression::getStructuralHashValue() {
56 cint64 hashValue = CExpressionHashMixer::getHashValueMixed((cint64)getType(),CClassTermExpressionAssociator::getStructuralHashValue(),CIndividualTermExpressionAssociator::getStructuralHashValue());
57 return hashValue;
58 }
59
60 bool CQueryIsInstanceOfExpression::compareStructuralEquivalence(CBuildExpression* compareExpression) {
61 CQueryIsInstanceOfExpression* compExpCast = dynamic_cast<CQueryIsInstanceOfExpression*>(compareExpression);
62 if (!compExpCast) {
63 return false;
64 }
65 return CClassTermExpressionAssociator::compareStructuralEquivalence(*compExpCast) && CIndividualTermExpressionAssociator::compareStructuralEquivalence(*compExpCast);
66 }
67
68 bool CQueryIsInstanceOfExpression::visitSubExpressions(CSubExpressionVisitor* subExpressionVisitor) {
69 if (subExpressionVisitor) {
70 CClassTermExpressionAssociator::visitSubExpressions(this,subExpressionVisitor);
71 CIndividualTermExpressionAssociator::visitSubExpressions(this,subExpressionVisitor);
72 return true;
73 }
74 return false;
75 }
76
77
78 }; // end namespace Expression
79
80 }; // end namespace Parser
81
82 }; // end namespace Konclude