%module IntervalRationalT %{ #include typedef mpq_class Rational; typedef unsigned int uint; %} %import "rational.i" typedef unsigned int uint; namespace carl { %include "enums.swg" %javaconst(1); enum class BoundType { /// the given bound is compared by a strict ordering relation STRICT=0, /// the given bound is compared by a weak ordering relation WEAK=1, /// the given bound is interpreted as minus or plus infinity depending on whether it is the left or the right bound INFTY=2 }; template class Interval { public: Interval(const Number& n) : mContent(n), mLowerBoundType(BoundType::WEAK), mUpperBoundType(BoundType::WEAK) { } Interval(const Number& lower, const Number& upper) { } Interval(const Number& lower, BoundType lowerBoundType, const Number& upper, BoundType upperBoundType) { } //BEWARE: in python sth with return value policy had to be changed here, so maybe problems will arise inline const Number& lower() const; inline const Number& upper() const; inline void setLower(const Number& n); inline void setUpper(const Number& n); inline bool isInfinite() const; inline bool isUnbounded() const; inline bool isHalfBounded() const; inline bool isEmpty() const; inline bool isPointInterval() const; inline bool isOpenInterval() const; inline bool isClosedInterval() const; inline bool isZero() const; inline bool isOne() const; inline bool isPositive() const; inline bool isNegative() const; inline bool isSemiPositive() const; inline bool isSemiNegative() const; Interval integralPart() const; Number diameter() const; //NOTE: this is now set for Number not being a float... needs to be changed in Interval.h otherwise Number center() const; Number sample(bool _includingBounds = true) const; bool contains(const Number& val) const; bool contains(const Interval& rhs) const; bool meets(const Number& val) const; bool isSubset(const Interval& rhs) const; bool isProperSubset(const Interval& rhs) const; Interval div(const Interval& rhs) const; Interval inverse() const; Interval abs() const; Interval pow(uint exp) const; bool intersectsWith(const Interval& rhs) const; Interval intersect(const Interval& rhs) const; bool unite(const Interval& rhs, Interval& resultA, Interval& resultB) const; bool difference(const Interval& rhs, Interval& resultA, Interval& resultB) const; bool complement(Interval& resultA, Interval& resultB) const; bool symmetricDifference(const Interval& rhs, Interval& resultA, Interval& resultB) const; std::string toString() const; %extend { /* static Interval pow(const Interval& _in, unsigned _exponent) { return carl::pow(_in,_exponent); } */ static Interval floor(const Interval& _in) { return carl::floor(_in); } static Interval ceil(const Interval& _in) { return carl::ceil(_in); } /* static Interval abs(const Interval& _in) { return carl::abs(_in); } static Interval div(const Interval& _lhs, const Interval& _rhs) { return carl::div(_lhs,_rhs); } */ static Interval quotient(const Interval& _lhs, const Interval& _rhs) { return carl::div(_lhs,_rhs); } static bool isInteger(const Interval&) { return false; } Interval add(const Interval& rhs) { return *$self+rhs; } Interval add(const Rational& rhs) { return *$self+rhs; } Interval neg() { return -*$self; } Interval sub(const Interval& rhs) { return *$self-rhs; } Interval sub(const Rational& rhs) { return *$self-rhs; } Interval mul(const Interval& rhs) { return *$self*rhs; } Interval mul(const Rational& rhs) { return *$self*rhs; } Interval div(const Rational& rhs) { return *$self+rhs; } //The +=, -=, *= are missing now bool equals(const Interval rhs) { return *$self==rhs; } bool notEquals(const Interval rhs) { return *$self!=rhs; } bool lessEquals(const Interval rhs) { return *$self<=rhs; } bool lessEquals(const Rational rhs) { return *$self<=rhs; } bool greaterEquals(const Interval rhs) { return *$self>=rhs; } bool greaterEquals(const Rational rhs) { return *$self>=rhs; } bool less(const Interval rhs) { return *$self rhs) { return *$self>rhs; } bool greater(const Rational rhs) { return *$self>rhs; } } }; } %template(IntervalRational) carl::Interval;