2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
6 ////////////////////////////////////////////////////////////////
8 // Inline file for class VP1Interval //
10 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11 // Initial version: May 2008 //
13 ////////////////////////////////////////////////////////////////
15 inline VP1Interval::VP1Interval()
16 : m_lower(0), m_upper(0), m_openLower(true), m_openUpper(true), m_excludeInterval(false)
20 inline void VP1Interval::setOpenLower(bool openLower)
22 m_openLower = openLower;
25 inline void VP1Interval::setOpenUpper(bool openUpper)
27 m_openUpper = openUpper;
30 inline void VP1Interval::setOpen(bool openLower,bool openUpper)
32 m_openLower = openLower;
33 m_openUpper = openUpper;
36 inline void VP1Interval::setLower(const double& lower)
42 inline void VP1Interval::setUpper(const double& upper)
48 inline void VP1Interval::setExcludeInterval(bool excludeInterval)
50 m_excludeInterval = excludeInterval;
53 inline void VP1Interval::translate(const double& t)
60 inline double VP1Interval::lower() const
65 inline double VP1Interval::upper() const
70 inline double VP1Interval::openLower() const
75 inline double VP1Interval::openUpper() const
80 inline bool VP1Interval::excludeInterval() const
82 return m_excludeInterval;
85 inline bool VP1Interval::isEmpty() const
91 return m_openLower || m_openUpper;
94 inline bool VP1Interval::noLowerBound() const
96 return m_lower==-inf();
99 inline bool VP1Interval::noUpperBound() const
101 return m_upper==inf();
104 inline bool VP1Interval::isAllR() const
106 return noLowerBound() && noUpperBound();
109 inline bool VP1Interval::isSane() const
111 return m_lower==m_lower && m_upper==m_upper && m_lower<=m_upper;
114 inline bool VP1Interval::excludedByLower(const double&x) const
116 return !noLowerBound() && (m_openLower? x <= m_lower : x < m_lower );
119 inline bool VP1Interval::excludedByUpper(const double&x) const
121 return !noUpperBound() && (m_openUpper? x >= m_upper : x > m_upper );
124 inline bool VP1Interval::contains(const double& x) const
126 // FIXME: m_excludeInterval is not used now, fix me!
127 //if (m_excludeInterval) {
128 // return ! (!excludedByLower(x) && !excludedByUpper(x));
130 return !excludedByLower(x) && !excludedByUpper(x);
134 inline QString VP1Interval::toString() const
136 return (m_openLower||noLowerBound()?"]":"[")+QString::number(m_lower)+", "+QString::number(m_upper)+(m_openUpper||noUpperBound()?"[":"]");
139 inline double VP1Interval::length() const { return m_upper-m_lower; }
141 inline bool VP1Interval::operator==( const VP1Interval & other ) const
143 if (m_lower!=other.m_lower||m_upper!=other.m_upper)
145 return (m_openLower==other.m_openLower||noLowerBound()) && (m_openUpper==other.m_openUpper||noUpperBound());