Range

From CometPublic

Jump to: navigation, search

This is the class that supports the range objects of comet that are created with statements like

    range D = 1..10;

Such a statement creates D as an instance of type range and the object complies to the API shown below.

   class range {
       int getSize();
       int getLow();
       int getUp();
       int atRank(int);
       int getRank(int);
       int contains(int);
   }

Ranks start at 0, so

   int first = D.atRank(0);

initializes first to 1.

For instance, a call like

   int sz = D.getSize();

will initialize sz to 10 (10 - 1 + 1).