/* * IntegerVariable.cpp * * Created on: 12.01.2013 * Author: Christian Dehnert */ #include "IntegerVariable.h" #include #include namespace storm { namespace ir { // Initializes all members with their default constructors. IntegerVariable::IntegerVariable() : lowerBound(), upperBound() { // Nothing to do here. } // Initializes all members according to the given values. IntegerVariable::IntegerVariable(uint_fast64_t index, std::string variableName, std::shared_ptr lowerBound, std::shared_ptr upperBound, std::shared_ptr initialValue) : Variable(index, variableName, initialValue), lowerBound(lowerBound), upperBound(upperBound) { if (this->getInitialValue() == nullptr) { this->setInitialValue(lowerBound); } } IntegerVariable::IntegerVariable(const IntegerVariable& var, const std::string& newName, const std::map& renaming, const std::map& bools, const std::map& ints) : Variable(var, newName, renaming, bools, ints), lowerBound(var.lowerBound->clone(renaming, bools, ints)), upperBound(var.upperBound->clone(renaming, bools, ints)) { } // Return lower bound for variable. std::shared_ptr IntegerVariable::getLowerBound() const { return this->lowerBound; } // Return upper bound for variable. std::shared_ptr IntegerVariable::getUpperBound() const { return this->upperBound; } // Build a string representation of the variable. std::string IntegerVariable::toString() const { std::stringstream result; result << "int_" << this->getName() << ": [" << lowerBound->toString() << ".." << upperBound->toString() << "]"; if (this->getInitialValue() != nullptr) { result << " init " + this->getInitialValue()->toString(); } result << ";"; return result.str(); } } // namespace ir } // namespace storm