#include "src/storage/expressions/BinaryExpression.h" #include "src/exceptions/ExceptionMacros.h" #include "src/exceptions/InvalidAccessException.h" namespace storm { namespace expressions { BinaryExpression::BinaryExpression(ExpressionReturnType returnType, std::shared_ptr const& firstOperand, std::shared_ptr const& secondOperand) : BaseExpression(returnType), firstOperand(firstOperand), secondOperand(secondOperand) { // Intentionally left empty. } bool BinaryExpression::containsVariables() const { return this->getFirstOperand()->containsVariables() || this->getSecondOperand()->containsVariables(); } std::set BinaryExpression::getVariables() const { std::set firstVariableSet = this->getFirstOperand()->getVariables(); std::set secondVariableSet = this->getSecondOperand()->getVariables(); firstVariableSet.insert(secondVariableSet.begin(), secondVariableSet.end()); return firstVariableSet; } std::shared_ptr const& BinaryExpression::getFirstOperand() const { return this->firstOperand; } std::shared_ptr const& BinaryExpression::getSecondOperand() const { return this->secondOperand; } uint_fast64_t BinaryExpression::getArity() const { return 2; } std::shared_ptr BinaryExpression::getOperand(uint_fast64_t operandIndex) const { LOG_THROW(operandIndex < 2, storm::exceptions::InvalidAccessException, "Unable to access operand " << operandIndex << " in expression of arity 2."); if (operandIndex == 1) { return this->getFirstOperand(); } else { return this->getSecondOperand(); } } } }