Added some handy methods.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30647 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-05-06 15:27:05 +00:00
parent 96b5480b3f
commit de7e498829

View File

@ -34,6 +34,17 @@ public:
{
}
bool IsValid() const
{
return min < max;
}
double Size() const
{
return max - min;
}
ChartDataRange& Extend(const ChartDataRange& other)
{
min = std::min(min, other.min);
@ -41,6 +52,20 @@ public:
return *this;
}
ChartDataRange& OffsetBy(double offset)
{
min += offset;
max += offset;
return *this;
}
ChartDataRange& OffsetTo(double newMin)
{
max += newMin - min;
min = newMin;
return *this;
}
ChartDataRange& operator=(const ChartDataRange& other)
{
min = other.min;