@ -2,8 +2,8 @@
# include <unordered_map>
# include "src/storage/expressions/Expression.h"
# include "src/storage/expressions/ExpressionManager.h"
# include "src/storage/expressions/SubstitutionVisitor.h"
# include "src/storage/expressions/IdentifierSubstitutionVisitor.h"
# include "src/storage/expressions/LinearityCheckVisitor.h"
# include "src/storage/expressions/Expressions.h"
# include "src/exceptions/InvalidTypeException.h"
@ -15,24 +15,16 @@ namespace storm {
// Intentionally left empty.
}
Expression : : Expression ( Variable const & variable ) : expressionPtr ( new VariableExpression ( variable ) ) {
Expression : : Expression ( Variable const & variable ) : expressionPtr ( std : : shared_ptr < BaseExpression > ( new VariableExpression ( variable ) ) ) {
// Intentionally left empty.
}
Expression Expression : : substitute ( std : : map < std : : string , Expression > const & identifierToExpressionMap ) const {
return SubstitutionVisitor < std : : map < std : : string , Expression > > ( identifierToExpressionMap ) . substitute ( * this ) ;
Expression Expression : : substitute ( std : : map < Variable , Expression > const & identifierToExpressionMap ) const {
return SubstitutionVisitor < std : : map < Variable , Expression > > ( identifierToExpressionMap ) . substitute ( * this ) ;
}
Expression Expression : : substitute ( std : : unordered_map < std : : string , Expression > const & identifierToExpressionMap ) const {
return SubstitutionVisitor < std : : unordered_map < std : : string , Expression > > ( identifierToExpressionMap ) . substitute ( * this ) ;
}
Expression Expression : : substitute ( std : : map < std : : string , std : : string > const & identifierToIdentifierMap ) const {
return IdentifierSubstitutionVisitor < std : : map < std : : string , std : : string > > ( identifierToIdentifierMap ) . substitute ( * this ) ;
}
Expression Expression : : substitute ( std : : unordered_map < std : : string , std : : string > const & identifierToIdentifierMap ) const {
return IdentifierSubstitutionVisitor < std : : unordered_map < std : : string , std : : string > > ( identifierToIdentifierMap ) . substitute ( * this ) ;
Expression Expression : : substitute ( std : : unordered_map < Variable , Expression > const & identifierToExpressionMap ) const {
return SubstitutionVisitor < std : : unordered_map < Variable , Expression > > ( identifierToExpressionMap ) . substitute ( * this ) ;
}
bool Expression : : evaluateAsBool ( Valuation const * valuation ) const {
@ -117,7 +109,7 @@ namespace storm {
return this - > expressionPtr ;
}
Type Expression : : getType ( ) const {
Type const & Expression : : getType ( ) const {
return this - > getBaseExpression ( ) . getType ( ) ;
}
@ -140,130 +132,110 @@ namespace storm {
Expression Expression : : operator - ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) & & other . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '-' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getReturnType ( ) = = ExpressionReturnType : : Int & & other . getReturnType ( ) = = ExpressionReturnType : : Int ? ExpressionReturnType : : Int : ExpressionReturnType : : Double , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Minus ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . plusMinusTimes ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Minus ) ) ) ;
}
Expression Expression : : operator - ( ) const {
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '-' requires numerical operand. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new UnaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getReturnType ( ) , this - > getBaseExpressionPointer ( ) , UnaryNumericalFunctionExpression : : OperatorType : : Minus ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new UnaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) , this - > getBaseExpressionPointer ( ) , UnaryNumericalFunctionExpression : : OperatorType : : Minus ) ) ) ;
}
Expression Expression : : operator * ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) & & other . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '*' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getReturnType ( ) = = ExpressionReturnType : : Int & & other . getReturnType ( ) = = ExpressionReturnType : : Int ? ExpressionReturnType : : Int : ExpressionReturnType : : Double , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Times ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . plusMinusTimes ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Times ) ) ) ;
}
Expression Expression : : operator / ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) & & other . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '/' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getReturnType ( ) = = ExpressionReturnType : : Int & & other . getReturnType ( ) = = ExpressionReturnType : : Int ? ExpressionReturnType : : Int : ExpressionReturnType : : Double , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Divide ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . divide ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Divide ) ) ) ;
}
Expression Expression : : operator ^ ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) & & other . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '^' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getReturnType ( ) = = ExpressionReturnType : : Int & & other . getReturnType ( ) = = ExpressionReturnType : : Int ? ExpressionReturnType : : Int : ExpressionReturnType : : Double , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Power ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . power ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Power ) ) ) ;
}
Expression Expression : : operator & & ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasBooleanReturnType ( ) & & other . hasBooleanReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '&&' requires boolean operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryBooleanFunctionExpression : : OperatorType : : And ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . logicalConnective ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryBooleanFunctionExpression : : OperatorType : : And ) ) ) ;
}
Expression Expression : : operator | | ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasBooleanReturnType ( ) & & other . hasBooleanReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '||' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryBooleanFunctionExpression : : OperatorType : : Or ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . logicalConnective ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryBooleanFunctionExpression : : OperatorType : : Or ) ) ) ;
}
Expression Expression : : operator ! ( ) const {
STORM_LOG_THROW ( this - > hasBooleanReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '!' requires boolean operand. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new UnaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , UnaryBooleanFunctionExpression : : OperatorType : : Not ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new UnaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . logicalConnective ( ) , this - > getBaseExpressionPointer ( ) , UnaryBooleanFunctionExpression : : OperatorType : : Not ) ) ) ;
}
Expression Expression : : operator = = ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) & & other . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '==' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : Equal ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . numericalComparison ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : Equal ) ) ) ;
}
Expression Expression : : operator ! = ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( ( this - > hasNumericalReturnType ( ) & & other . hasNumericalReturnType ( ) ) | | ( this - > hasBooleanReturnType ( ) & & other . hasBooleanReturnType ( ) ) , storm : : exceptions : : InvalidTypeException , " Operator '!=' requires operands of equal type. " ) ;
if ( this - > hasNumericalReturnType ( ) & & other . hasNumericalReturnType ( ) ) {
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : NotEqual ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . numericalComparison ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : NotEqual ) ) ) ;
} else {
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryBooleanFunctionExpression : : OperatorType : : Xor ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . logicalConnective ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryBooleanFunctionExpression : : OperatorType : : Xor ) ) ) ;
}
}
Expression Expression : : operator > ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) & & other . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '>' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : Greater ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . numericalComparison ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : Greater ) ) ) ;
}
Expression Expression : : operator > = ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) & & other . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '>=' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : GreaterOrEqual ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . numericalComparison ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : GreaterOrEqual ) ) ) ;
}
Expression Expression : : operator < ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) & & other . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '<' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : Less ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . numericalComparison ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : Less ) ) ) ;
}
Expression Expression : : operator < = ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) & & other . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '<=' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : LessOrEqual ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryRelationExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . numericalComparison ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryRelationExpression : : RelationType : : LessOrEqual ) ) ) ;
}
Expression Expression : : minimum ( Expression const & lhs , Expression const & rhs ) {
assertSameManager ( lhs . getBaseExpression ( ) , rhs . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( lhs . hasNumericalReturnType ( ) & & rhs . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator 'min' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( lhs . getBaseExpression ( ) . getManager ( ) , lhs . getReturnType ( ) = = ExpressionReturnType : : Int & & rhs . getReturnType ( ) = = ExpressionReturnType : : Int ? ExpressionReturnType : : Int : ExpressionReturnType : : Double , lhs . getBaseExpressionPointer ( ) , rhs . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Min ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( lhs . getBaseExpression ( ) . getManager ( ) , lhs . getType ( ) . minimumMaximum ( rhs . getType ( ) ) , lhs . getBaseExpressionPointer ( ) , rhs . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Min ) ) ) ;
}
Expression Expression : : maximum ( Expression const & lhs , Expression const & rhs ) {
assertSameManager ( lhs . getBaseExpression ( ) , rhs . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( lhs . hasNumericalReturnType ( ) & & rhs . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator 'max' requires numerical operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( lhs . getBaseExpression ( ) . getManager ( ) , lhs . getReturnType ( ) = = ExpressionReturnType : : Int & & rhs . getReturnType ( ) = = ExpressionReturnType : : Int ? ExpressionReturnType : : Int : ExpressionReturnType : : Double , lhs . getBaseExpressionPointer ( ) , rhs . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Max ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryNumericalFunctionExpression ( lhs . getBaseExpression ( ) . getManager ( ) , lhs . getType ( ) . minimumMaximum ( rhs . getType ( ) ) , lhs . getBaseExpressionPointer ( ) , rhs . getBaseExpressionPointer ( ) , BinaryNumericalFunctionExpression : : OperatorType : : Max ) ) ) ;
}
Expression Expression : : ite ( Expression const & thenExpression , Expression const & elseExpression ) {
assertSameManager ( this - > getBaseExpression ( ) , thenExpression . getBaseExpression ( ) ) ;
assertSameManager ( thenExpression . getBaseExpression ( ) , elseExpression . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasBooleanReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Condition of if-then-else operator must be of boolean type. " ) ;
STORM_LOG_THROW ( thenExpression . hasBooleanReturnType ( ) & & elseExpression . hasBooleanReturnType ( ) | | thenExpression . hasNumericalReturnType ( ) & & elseExpression . hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " 'then' and 'else' expression of if-then-else operator must have equal return type. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new IfThenElseExpression ( this - > getBaseExpression ( ) . getManager ( ) , thenExpression . hasBooleanReturnType ( ) & & elseExpression . hasBooleanReturnType ( ) ? ExpressionReturnType : : Bool : ( thenExpression . getReturnType ( ) = = ExpressionReturnType : : Int & & elseExpression . getReturnType ( ) = = ExpressionReturnType : : Int ? ExpressionReturnType : : Int : ExpressionReturnType : : Double ) , this - > getBaseExpressionPointer ( ) , thenExpression . getBaseExpressionPointer ( ) , elseExpression . getBaseExpressionPointer ( ) ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new IfThenElseExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . ite ( thenExpression . getType ( ) , elseExpression . getType ( ) ) , this - > getBaseExpressionPointer ( ) , thenExpression . getBaseExpressionPointer ( ) , elseExpression . getBaseExpressionPointer ( ) ) ) ) ;
}
Expression Expression : : implies ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasBooleanReturnType ( ) & & other . hasBooleanReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '&&' requires boolean operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryBooleanFunctionExpression : : OperatorType : : Implies ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . logicalConnective ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryBooleanFunctionExpression : : OperatorType : : Implies ) ) ) ;
}
Expression Expression : : iff ( Expression const & other ) const {
assertSameManager ( this - > getBaseExpression ( ) , other . getBaseExpression ( ) ) ;
STORM_LOG_THROW ( this - > hasBooleanReturnType ( ) & & other . hasBooleanReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator '&&' requires boolean operands. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Bool , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryBooleanFunctionExpression : : OperatorType : : Iff ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new BinaryBooleanFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . logicalConnective ( other . getType ( ) ) , this - > getBaseExpressionPointer ( ) , other . getBaseExpressionPointer ( ) , BinaryBooleanFunctionExpression : : OperatorType : : Iff ) ) ) ;
}
Expression Expression : : floor ( ) const {
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator 'floor' requires numerical operand. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new UnaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Int , this - > getBaseExpressionPointer ( ) , UnaryNumericalFunctionExpression : : OperatorType : : Floor ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new UnaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . floorCeil ( ) , this - > getBaseExpressionPointer ( ) , UnaryNumericalFunctionExpression : : OperatorType : : Floor ) ) ) ;
}
Expression Expression : : ceil ( ) const {
STORM_LOG_THROW ( this - > hasNumericalReturnType ( ) , storm : : exceptions : : InvalidTypeException , " Operator 'ceil' requires numerical operand. " ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new UnaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , ExpressionReturnType : : Int , this - > getBaseExpressionPointer ( ) , UnaryNumericalFunctionExpression : : OperatorType : : Ceil ) ) ) ;
return Expression ( std : : shared_ptr < BaseExpression > ( new UnaryNumericalFunctionExpression ( this - > getBaseExpression ( ) . getManager ( ) , this - > getType ( ) . floorCeil ( ) , this - > getBaseExpressionPointer ( ) , UnaryNumericalFunctionExpression : : OperatorType : : Ceil ) ) ) ;
}
boost : : any Expression : : accept ( ExpressionVisitor & visitor ) const {