// $Revision: 1.4 $ // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_GRAPHRANGE #include "GraphRange.h" #endif #ifndef Taligent_GLOBALSTREAMING #include #endif //============================================================================== // TGraphRange TGraphRange::TGraphRange() : fMin(0.0), fMax(0.0) { } TGraphRange::TGraphRange(GraphValue min, GraphValue max) : fMin(min), fMax(max) { if (min > max) { GraphValue temp = fMax; fMax = fMin; fMin = temp; } } TGraphRange::TGraphRange(const TGraphRange& source) : fMin(source.fMin), fMax(source.fMax) { } TGraphRange::~TGraphRange() { } TGraphRange& TGraphRange::operator=(const TGraphRange& source) { if (&source != this) { fMin = source.fMin; fMax = source.fMax; } return *this; } TStream& TGraphRange::operator>>=(TStream& toStream) const { ::WriteVersion(toStream, kOriginalVersion); fMin >>= toStream; fMax >>= toStream; return toStream; } TStream& TGraphRange::operator<<=(TStream& fromStream) { ::ReadVersion(fromStream, kOriginalVersion, kOriginalVersion); fMin <<= fromStream; fMax <<= fromStream; return fromStream; } bool TGraphRange::operator==(const TGraphRange& other) const { return fMin == other.fMin && fMax == other.fMax; } GraphValue TGraphRange::GetMin() const { return fMin; } GraphValue TGraphRange::GetMax() const { return fMax; } void TGraphRange::SetMinAndMax(GraphValue min, GraphValue max) { if (min > max) { GraphValue temp = max; max = min; min = temp; } fMin = min; fMax = max; } GraphValue TGraphRange::GetLength() const { return GetMax() - GetMin(); } bool TGraphRange::Contains(GraphValue value) const { return value <= GetMax() && value >= GetMin(); } bool TGraphRange::IsEmpty() const { return (GetMax() - GetMin()) <= 0.0; }