| 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 "CFilteringComparisonDataLiteralExpression.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Parser { |
| 27 |
|
| 28 |
namespace Expression { |
| 29 |
|
| 30 |
|
| 31 |
CFilteringComparisonDataLiteralExpression::CFilteringComparisonDataLiteralExpression(CDataLiteralExpression* dataLiteralExp, CDataLiteralVariableExpression* dataLiteralVariableExp, CFilteringComparisonDataLiteralExpression::COMPARING_TYPE comparingType) : CDataLiteralExpressionAssociator(dataLiteralExp), CDataLiteralVariableExpressionAssociator(dataLiteralVariableExp) { |
| 32 |
mComparingType = comparingType; |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
CFilteringComparisonDataLiteralExpression::~CFilteringComparisonDataLiteralExpression() { |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
CBuildExpression::ExpressionType CFilteringComparisonDataLiteralExpression::getType() { |
| 41 |
return BETFILTERINGCOMPARISONDATALITERAL; |
| 42 |
} |
| 43 |
|
| 44 |
CDataLiteralVariableExpression *CFilteringComparisonDataLiteralExpression::getComparingDataLiteralVariable() { |
| 45 |
return CDataLiteralVariableExpressionAssociator::getDataLiteralVariableExpression(); |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
CDataLiteralExpression *CFilteringComparisonDataLiteralExpression::getComparingDataLiteral() { |
| 50 |
return CDataLiteralExpressionAssociator::getDataLiteralExpression(); |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
cint64 CFilteringComparisonDataLiteralExpression::getStructuralHashValue() { |
| 56 |
cint64 hashValue = CExpressionHashMixer::getHashValueMixed((cint64)getType(), CDataLiteralExpressionAssociator::getStructuralHashValue(), CDataLiteralVariableExpressionAssociator::getStructuralHashValue(), mComparingType); |
| 57 |
return hashValue; |
| 58 |
} |
| 59 |
|
| 60 |
bool CFilteringComparisonDataLiteralExpression::compareStructuralEquivalence(CBuildExpression* compareExpression) { |
| 61 |
CFilteringComparisonDataLiteralExpression* compExpCast = dynamic_cast<CFilteringComparisonDataLiteralExpression*>(compareExpression); |
| 62 |
if (!compExpCast) { |
| 63 |
return false; |
| 64 |
} |
| 65 |
if (mComparingType != compExpCast->mComparingType) { |
| 66 |
return false; |
| 67 |
} |
| 68 |
return CDataLiteralExpressionAssociator::compareStructuralEquivalence(*compExpCast) && CDataLiteralVariableExpressionAssociator::compareStructuralEquivalence(*compExpCast); |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
bool CFilteringComparisonDataLiteralExpression::visitSubExpressions(CSubExpressionVisitor* subExpressionVisitor) { |
| 73 |
if (subExpressionVisitor) { |
| 74 |
subExpressionVisitor->visitEntity(this, CVariableAssociator::getEntity(), subExpressionVisitor); |
| 75 |
CDataLiteralExpressionAssociator::visitSubExpressions(this, subExpressionVisitor); |
| 76 |
return true; |
| 77 |
} |
| 78 |
return false; |
| 79 |
} |
| 80 |
|
| 81 |
CFilteringComparisonDataLiteralExpression::COMPARING_TYPE CFilteringComparisonDataLiteralExpression::getComparingType() { |
| 82 |
return mComparingType; |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
}; // end namespace Expression |
| 87 |
|
| 88 |
}; // end namespace Parser |
| 89 |
|
| 90 |
}; // end namespace Konclude |