#include <OTC/collctn/range.hh> class OTC_Range {
public:
static os_typespec* get_os_typespec();
inline OTC_Range(u_int theLength=0);
inline OTC_Range(int theLower, u_int theLength);
inline OTC_Range(OTC_Range const& theRange);
inline OTC_Range& operator=(OTC_Range const& theRange);
inline OTC_Boolean operator==(OTC_Range const& theRange) const;
inline OTC_Boolean operator!=(OTC_Range const& theRange) const;
inline int lower() const;
inline int upper() const;
inline u_int length() const;
inline OTC_Boolean contains(int theValue) const;
inline OTC_Boolean isNullRange() const;
OTC_Boolean isSubRange(OTC_Range const& theRange) const;
OTC_Iterator<int> indices( OTC_Direction theDirection=OTCLIB_FORWARD ) const;
};
i
such that the condition lower() <=
i < upper()
is satisfied. If lower()
is equal to upper()
then it is a null range. In defining the range, the lower bound
and a length is expected. The property which relates the bounds
and the length is upper() == lower() + length()
.
inline OTC_Range(u_int theLength=0);
theLength
and
lower bound of 0
.
inline OTC_Range(int theLower, u_int theLength);
theLower
and
length theLength
.
inline OTC_Range(OTC_Range const& theRange);
theRange
.
inline OTC_Range& operator=(OTC_Range const& theRange);
theRange
.
inline OTC_Boolean operator==(OTC_Range const& theRange) const;
OTCLIB_FALSE
if this range
isn't equivalent to theRange
.
inline OTC_Boolean operator!=(OTC_Range const& theRange) const;
OTCLIB_FALSE
if this range
is equivalent to theRange
.
inline int lower() const;
inline int upper() const;
inline u_int length() const;
inline OTC_Boolean contains(int theValue) const;
OTCLIB_FALSE
if theValue
is
not contained in this range.
inline OTC_Boolean isNullRange() const;
OTCLIB_FALSE
if this is not a
null range.
OTC_Boolean isSubRange(OTC_Range const& theRange) const;
OTCLIB_FALSE
if this range is not
contained within theRange
. If this
range is a null range then OTCLIB_TRUE
will always be returned.
OTC_Iterator<int> indices(
OTC_Direction theDirection=OTCLIB_FORWARD
) const;
theDirection
indicates the
direction of traversal, namely, if
theDirection
is OTCLIB_FORWARD
,
traversal will be in the direction of
lower to upper. For OTCLIB_BACKWARD
it
will be the reverse.