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////////////////////////////////////////////////////////////////
15inline VP1Interval::VP1Interval()
16 : m_lower(0), m_upper(0), m_openLower(true), m_openUpper(true), m_excludeInterval(false)
20inline void VP1Interval::setOpenLower(bool openLower)
22 m_openLower = openLower;
25inline void VP1Interval::setOpenUpper(bool openUpper)
27 m_openUpper = openUpper;
30inline void VP1Interval::setOpen(bool openLower,bool openUpper)
32 m_openLower = openLower;
33 m_openUpper = openUpper;
36inline void VP1Interval::setLower(const double& lower)
42inline void VP1Interval::setUpper(const double& upper)
48inline void VP1Interval::setExcludeInterval(bool excludeInterval)
50 m_excludeInterval = excludeInterval;
53inline void VP1Interval::translate(const double& t)
60inline double VP1Interval::lower() const
65inline double VP1Interval::upper() const
70inline double VP1Interval::openLower() const
75inline double VP1Interval::openUpper() const
80inline bool VP1Interval::excludeInterval() const
82 return m_excludeInterval;
85inline bool VP1Interval::isEmpty() const
91 return m_openLower || m_openUpper;
94inline bool VP1Interval::noLowerBound() const
96 return m_lower==-inf();
99inline bool VP1Interval::noUpperBound() const
101 return m_upper==inf();
104inline bool VP1Interval::isAllR() const
106 return noLowerBound() && noUpperBound();
109inline bool VP1Interval::isSane() const
111 return m_lower==m_lower && m_upper==m_upper && m_lower<=m_upper;
114inline bool VP1Interval::excludedByLower(const double&x) const
116 return !noLowerBound() && (m_openLower? x <= m_lower : x < m_lower );
119inline bool VP1Interval::excludedByUpper(const double&x) const
121 return !noUpperBound() && (m_openUpper? x >= m_upper : x > m_upper );
124inline 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);
134inline QString VP1Interval::toString() const
136 return (m_openLower||noLowerBound()?"]":"[")+QString::number(m_lower)+", "+QString::number(m_upper)+(m_openUpper||noUpperBound()?"[":"]");
139inline double VP1Interval::length() const { return m_upper-m_lower; }
141inline 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());