From d1ce1ce975eda12103b38ea3ac5e6366c98abbad Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 7 Apr 2009 15:22:04 +0000 Subject: [PATCH] * ./hurricane : - New: ability to shrink bounds of an Interval. --- hurricane/src/hurricane/Interval.cpp | 16 ++++++++++++++++ hurricane/src/hurricane/hurricane/Interval.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/hurricane/src/hurricane/Interval.cpp b/hurricane/src/hurricane/Interval.cpp index f7548c4d..27875143 100644 --- a/hurricane/src/hurricane/Interval.cpp +++ b/hurricane/src/hurricane/Interval.cpp @@ -140,6 +140,22 @@ Interval& Interval::makeEmpty() return *this; } +Interval& Interval::shrinkVMin(const DbU::Unit& vMin) +// ************************************************** +{ + if ( vMin > _vMin ) + _vMin = vMin; + return *this; +} + +Interval& Interval::shrinkVMax(const DbU::Unit& vMax) +// ************************************************** +{ + if ( vMax < _vMax ) + _vMax = vMax; + return *this; +} + Interval& Interval::inflate(const DbU::Unit& dv) // **************************************** { diff --git a/hurricane/src/hurricane/hurricane/Interval.h b/hurricane/src/hurricane/hurricane/Interval.h index 0f54e532..1e393f36 100644 --- a/hurricane/src/hurricane/hurricane/Interval.h +++ b/hurricane/src/hurricane/hurricane/Interval.h @@ -71,6 +71,8 @@ class Interval { // ******** public: Interval& makeEmpty(); + public: Interval& shrinkVMin(const DbU::Unit& vMin); + public: Interval& shrinkVMax(const DbU::Unit& vMax); public: Interval& inflate(const DbU::Unit& dv); public: Interval& inflate(const DbU::Unit& dvMin, const DbU::Unit& dvMax); public: Interval& merge(const DbU::Unit& v);