NAME

OTC_Range - Class to represent a range of integers.

SYNOPSIS


#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;
};

CLASS TYPE

Concrete

DESCRIPTION

This class is for representing a range of integers. That set of integers is any integer 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().

CONSTRUCTION

inline OTC_Range(u_int theLength=0);
inline OTC_Range(int theLower, u_int theLength);
inline OTC_Range(OTC_Range const& theRange);

ASSIGNMENT

inline OTC_Range& operator=(OTC_Range const& theRange);

COMPARISON

inline OTC_Boolean operator==(OTC_Range const& theRange) const;
inline OTC_Boolean operator!=(OTC_Range const& theRange) const;

QUERY

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;

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1992 1993 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED