X-Git-Url: http://git.tdb.fi/?p=poefilter.git;a=blobdiff_plain;f=source%2Frangecondition.h;fp=source%2Frangecondition.h;h=811a1aa48ffba85371d04249ef0ce0eef0f4cb36;hp=a72fec2d1475db075baffbeb1ed46aa3979480e0;hb=7d7eaf754af04f81bb1e7a8872272ea15e01d0c4;hpb=8dcb2ed5219429c1c7d543c422a7471c18917f55 diff --git a/source/rangecondition.h b/source/rangecondition.h index a72fec2..811a1aa 100644 --- a/source/rangecondition.h +++ b/source/rangecondition.h @@ -20,6 +20,7 @@ public: RangeCondition(Type, Type); virtual RangeCondition *clone() const; + virtual bool equals(const Condition &) const; virtual bool can_merge(const Condition &, const CompoundCondition &) const; virtual RangeCondition *merge(const std::vector &, const CompoundCondition &) const; virtual bool is_viable() const { return min<=max; } @@ -133,6 +134,16 @@ RangeCondition *RangeCondition::clone() const return new RangeCondition(min, max); } +template +bool RangeCondition::equals(const Condition &other) const +{ + const RangeCondition *other_range = dynamic_cast *>(&other); + if(!other_range) + return false; + + return (min==other_range->min && max==other_range->max); +} + template bool RangeCondition::can_merge(const Condition &other, const CompoundCondition &parent) const {