home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / base / intset.h < prev    next >
C/C++ Source or Header  |  1995-04-08  |  2KB  |  86 lines

  1.  
  2.  
  3. #ifndef _intset_h_ /* Thu Mar 31 09:23:19 1994 */
  4. #define _intset_h_
  5.  
  6.  
  7.  
  8.  
  9.  
  10. /*
  11.  *
  12.  *          Copyright (C) 1994, M. A. Sridhar
  13.  *  
  14.  *
  15.  *     This software is Copyright M. A. Sridhar, 1994. You are free
  16.  *     to copy, modify or distribute this software  as you see fit,
  17.  *     and to use  it  for  any  purpose, provided   this copyright
  18.  *     notice and the following   disclaimer are included  with all
  19.  *     copies.
  20.  *
  21.  *                        DISCLAIMER
  22.  *
  23.  *     The author makes no warranties, either expressed or implied,
  24.  *     with respect  to  this  software, its  quality, performance,
  25.  *     merchantability, or fitness for any particular purpose. This
  26.  *     software is distributed  AS IS.  The  user of this  software
  27.  *     assumes all risks  as to its quality  and performance. In no
  28.  *     event shall the author be liable for any direct, indirect or
  29.  *     consequential damages, even if the  author has been  advised
  30.  *     as to the possibility of such damages.
  31.  *
  32.  */
  33.  
  34.  
  35.  
  36.  
  37. // This is an extension of {\tt CL_Set<long>} with an additional
  38. // methods AsString and SmallestNonMember.
  39.  
  40.  
  41. #ifdef __GNUC__
  42. #pragma interface
  43. #endif
  44.  
  45. #include "base/set.h"
  46.  
  47. class CL_EXPORT CL_BitSet;
  48.  
  49. class CL_EXPORT CL_IntegerSet: public CL_Set<long> {
  50.  
  51. public:
  52.     CL_IntegerSet () {};
  53.     // Default constructor: build an empty set.
  54.  
  55.     CL_IntegerSet (long low, long hi);
  56.     // Build an integer set with containing all the numbers in the range
  57.     // low through hi. If {\tt lo < hi}, the empty set is built.
  58.     
  59.     CL_IntegerSet (const CL_Set<long>& s) : CL_Set<long> (s) {};
  60.     // Copy constructor
  61.  
  62.     virtual long SmallestNonMember () const;
  63.     // Return the smallest non-negative element that is {\it not\/} in the
  64.     // set. Return -1 if the set is empty.
  65.  
  66.     CL_String AsString () const;
  67.     // Returns a string containing a representation of the set, in the
  68.     // form \verb|{1,3,6}|.
  69.  
  70.     //
  71.     // ------------------------- Basic methods --------------------
  72.     //
  73.     CL_Object* Clone () const
  74.         {return new CL_IntegerSet (*this);};
  75.     
  76.     const char* ClassName() const
  77.         {return "CL_IntegerSet";};
  78.     
  79. };
  80.  
  81.  
  82.  
  83. typedef CL_SetIterator<long> CL_IntegerSetIterator;
  84.  
  85. #endif /* _intset_h_ */
  86.