home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / libg++-2.5.3-bin.lha / info / libg++.info-3 (.txt) < prev    next >
GNU Info File  |  1994-02-27  |  50KB  |  1,048 lines

  1. This is Info file libg++.info, produced by Makeinfo-1.55 from the input
  2. file ./libg++.texi.
  3. START-INFO-DIR-ENTRY
  4. * Libg++::                      The g++ class library.
  5. END-INFO-DIR-ENTRY
  6.    This file documents the features and implementation of The GNU C++
  7. library
  8.    Copyright (C) 1988, 1991, 1992 Free Software Foundation, Inc.
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided also
  14. that the section entitled "GNU Library General Public License" is
  15. included exactly as in the original, and provided that the entire
  16. resulting derived work is distributed under the terms of a permission
  17. notice identical to this one.
  18.    Permission is granted to copy and distribute translations of this
  19. manual into another language, under the above conditions for modified
  20. versions, except that the section entitled "GNU Library General Public
  21. License" and this permission notice may be included in translations
  22. approved by the Free Software Foundation instead of in the original
  23. English.
  24. File: libg++.info,  Node: String,  Next: Integer,  Prev: AllocRing,  Up: Top
  25. The String class
  26. ****************
  27.    The `String' class is designed to extend GNU C++ to support string
  28. processing capabilities similar to those in languages like Awk.  The
  29. class provides facilities that ought to be convenient and efficient
  30. enough to be useful replacements for `char*' based processing via the C
  31. string library (i.e., `strcpy, strcmp,' etc.) in many applications.
  32. Many details about String representations are described in the
  33. Representation section.
  34.    A separate `SubString' class supports substring extraction and
  35. modification operations. This is implemented in a way that user
  36. programs never directly construct or represent substrings, which are
  37. only used indirectly via String operations.
  38.    Another separate class, `Regex' is also used indirectly via String
  39. operations in support of regular expression searching, matching, and the
  40. like.  The Regex class is based entirely on the GNU Emacs regex
  41. functions.  *Note Syntax of Regular Expressions: (emacs.info)Regexps,
  42. for a full explanation of regular expression syntax.  (For
  43. implementation details, see the internal documentation in files
  44. `regex.h' and `regex.c'.)
  45. Constructors
  46. ============
  47.    Strings are initialized and assigned as in the following examples:
  48. `String x;  String y = 0; String z = "";'
  49.      Set x, y, and z to the nil string. Note that either 0 or "" may
  50.      always be used to refer to the nil string.
  51. `String x = "Hello"; String y("Hello");'
  52.      Set x and y to a copy of the string "Hello".
  53. `String x = 'A'; String y('A');'
  54.      Set x and y to the string value "A"
  55. `String u = x; String v(x);'
  56.      Set u and v to the same string as String x
  57. `String u = x.at(1,4); String v(x.at(1,4));'
  58.      Set u and v to the length 4 substring of x starting at position 1
  59.      (counting indexes from 0).
  60. `String x("abc", 2);'
  61.      Sets x to "ab", i.e., the first 2 characters of "abc".
  62. `String x = dec(20);'
  63.      Sets x to "20". As here, Strings may be initialized or assigned
  64.      the results of any `char*' function.
  65.    There are no directly accessible forms for declaring SubString
  66. variables.
  67.    The declaration `Regex r("[a-zA-Z_][a-zA-Z0-9_]*");' creates a
  68. compiled regular expression suitable for use in String operations
  69. described below. (In this case, one that matches any C++ identifier).
  70. The first argument may also be a String.  Be careful in distinguishing
  71. the role of backslashes in quoted GNU C++ char* constants versus those
  72. in Regexes. For example, a Regex that matches either one or more tabs
  73. or all strings beginning with "ba" and ending with any number of
  74. occurrences of "na" could be declared as `Regex r =
  75. "\\(\t+\\)\\|\\(ba\\(na\\)*\\)"' Note that only one backslash is needed
  76. to signify the tab, but two are needed for the parenthesization and
  77. virgule, since the GNU C++ lexical analyzer decodes and strips
  78. backslashes before they are seen by Regex.
  79.    There are three additional optional arguments to the Regex
  80. constructor that are less commonly useful:
  81. `fast (default 0)'
  82.      `fast' may be set to true (1) if the Regex should be
  83.      "fast-compiled". This causes an additional compilation step that
  84.      is generally worthwhile if the Regex will be used many times.
  85. `bufsize (default max(40, length of the string))'
  86.      This is an estimate of the size of the internal compiled
  87.      expression. Set it to a larger value if you know that the
  88.      expression will require a lot of space. If you do not know, do not
  89.      worry: realloc is used if necessary.
  90. `transtable (default none == 0)'
  91.      The address of a byte translation table (a char[256]) that
  92.      translates each character before matching.
  93.    As a convenience, several Regexes are predefined and usable in any
  94. program. Here are their declarations from `String.h'.
  95.      extern Regex RXwhite;      // = "[ \n\t]+"
  96.      extern Regex RXint;        // = "-?[0-9]+"
  97.      extern Regex RXdouble;     // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
  98.                                 //    \\([0-9]+\\)\\|
  99.                                 //    \\(\\.[0-9]+\\)\\)
  100.                                 //    \\([eE][---+]?[0-9]+\\)?"
  101.      extern Regex RXalpha;      // = "[A-Za-z]+"
  102.      extern Regex RXlowercase;  // = "[a-z]+"
  103.      extern Regex RXuppercase;  // = "[A-Z]+"
  104.      extern Regex RXalphanum;   // = "[0-9A-Za-z]+"
  105.      extern Regex RXidentifier; // = "[A-Za-z_][A-Za-z0-9_]*"
  106. Examples
  107. ========
  108.    Most `String' class capabilities are best shown via example.  The
  109. examples below use the following declarations.
  110.          String x = "Hello";
  111.          String y = "world";
  112.          String n = "123";
  113.          String z;
  114.          char*  s = ",";
  115.          String lft, mid, rgt;
  116.          Regex  r = "e[a-z]*o";
  117.          Regex  r2("/[a-z]*/");
  118.          char   c;
  119.          int    i, pos, len;
  120.          double f;
  121.          String words[10];
  122.          words[0] = "a";
  123.          words[1] = "b";
  124.          words[2] = "c";
  125. Comparing, Searching and Matching
  126. =================================
  127.    The usual lexicographic relational operators (`==, !=, <, <=, >, >=')
  128. are defined. A functional form `compare(String, String)' is also
  129. provided, as is `fcompare(String, String)', which compares Strings
  130. without regard for upper vs. lower case.
  131.    All other matching and searching operations are based on some form
  132. of the (non-public) `match' and `search' functions.  `match' and
  133. `search' differ in that `match' attempts to match only at the given
  134. starting position, while `search' starts at the position, and then
  135. proceeds left or right looking for a match.  As seen in the following
  136. examples, the second optional `startpos' argument to functions using
  137. `match' and `search' specifies the starting position of the search: If
  138. non-negative, it results in a left-to-right search starting at position
  139. `startpos', and if negative, a right-to-left search starting at
  140. position `x.length() + startpos'. In all cases, the index returned is
  141. that of the beginning of the match, or -1 if there is no match.
  142.    Three String functions serve as front ends to `search' and `match'.
  143. `index' performs a search, returning the index, `matches' performs a
  144. match, returning nonzero (actually, the length of the match) on success,
  145. and `contains' is a boolean function performing either a search or
  146. match, depending on whether an index argument is provided:
  147. `x.index("lo")'
  148.      returns the zero-based index of the leftmost occurrence of
  149.      substring "lo" (3, in this case).  The argument may be a String,
  150.      SubString, char, char*, or Regex.
  151. `x.index("l", 2)'
  152.      returns the index of the first of the leftmost occurrence of "l"
  153.      found starting the search at position x[2], or 2 in this case.
  154. `x.index("l", -1)'
  155.      returns the index of the rightmost occurrence of "l", or 3 here.
  156. `x.index("l", -3)'
  157.      returns the index of the rightmost occurrence of "l" found by
  158.      starting the search at the 3rd to the last position of x,
  159.      returning 2 in this case.
  160. `pos = r.search("leo", 3, len, 0)'
  161.      returns the index of r in the `char*' string of length 3, starting
  162.      at position 0, also placing the  length of the match in reference
  163.      parameter len.
  164. `x.contains("He")'
  165.      returns nonzero if the String x contains the substring "He". The
  166.      argument may be a String, SubString, char, char*, or Regex.
  167. `x.contains("el", 1)'
  168.      returns nonzero if x contains the substring "el" at position 1.
  169.      As in this example, the second argument to `contains', if present,
  170.      means to match the substring only at that position, and not to
  171.      search elsewhere in the string.
  172. `x.contains(RXwhite);'
  173.      returns nonzero if x contains any whitespace (space, tab, or
  174.      newline). Recall that `RXwhite' is a global whitespace Regex.
  175. `x.matches("lo", 3)'
  176.      returns nonzero if x starting at position 3 exactly matches "lo",
  177.      with no trailing characters (as it does in this example).
  178. `x.matches(r)'
  179.      returns nonzero if String x as a whole matches Regex r.
  180. `int f = x.freq("l")'
  181.      returns the number of distinct, nonoverlapping matches to the
  182.      argument (2 in this case).
  183. Substring extraction
  184. ====================
  185.    Substrings may be extracted via the `at', `before', `through',
  186. `from', and `after' functions.  These behave as either lvalues or
  187. rvalues.
  188. `z = x.at(2, 3)'
  189.      sets String z to be equal to the length 3 substring of String x
  190.      starting at zero-based position 2, setting z to "llo" in this
  191.      case. A nil String is returned if the arguments don't make sense.
  192. `x.at(2, 2) = "r"'
  193.      Sets what was in positions 2 to 3 of x to "r", setting x to "Hero"
  194.      in this case. As indicated here, SubString assignments may be of
  195.      different lengths.
  196. `x.at("He") = "je";'
  197.      x("He") is the substring of x that matches the first occurrence of
  198.      it's argument. The substitution sets x to "jello". If "He" did not
  199.      occur, the substring would be nil, and the assignment would have
  200.      no effect.
  201. `x.at("l", -1) = "i";'
  202.      replaces the rightmost occurrence of "l" with "i", setting x to
  203.      "Helio".
  204. `z = x.at(r)'
  205.      sets String z to the first match in x of Regex r, or "ello" in this
  206.      case. A nil String is returned if there is no match.
  207. `z = x.before("o")'
  208.      sets z to the part of x to the left of the first occurrence of
  209.      "o", or "Hell" in this case. The argument may also be a String,
  210.      SubString, or Regex.  (If there is no match, z is set to "".)
  211. `x.before("ll") = "Bri";'
  212.      sets the part of x to the left of "ll" to "Bri", setting x to
  213.      "Brillo".
  214. `z = x.before(2)'
  215.      sets z to the part of x to the left of x[2], or "He" in this case.
  216. `z = x.after("Hel")'
  217.      sets z to the part of x to the right of "Hel", or "lo" in this
  218.      case.
  219. `z = x.through("el")'
  220.      sets z to the part of x up and including "el", or "Hel" in this
  221.      case.
  222. `z = x.from("el")'
  223.      sets z to the part of x from "el" to the end, or "ello" in this
  224.      case.
  225. `x.after("Hel") = "p";'
  226.      sets x to "Help";
  227. `z = x.after(3)'
  228.      sets z to the part of x to the right of x[3] or "o" in this case.
  229. `z = "  ab c"; z = z.after(RXwhite)'
  230.      sets z to the part of its old string to the right of the first
  231.      group of whitespace, setting z to "ab c"; Use gsub(below) to strip
  232.      out multiple occurrences of whitespace or any pattern.
  233. `x[0] = 'J';'
  234.      sets the first element of x to 'J'. x[i] returns a reference to
  235.      the ith element of x, or triggers an error if i is out of range.
  236. `common_prefix(x, "Help")'
  237.      returns the String containing the common prefix of the two Strings
  238.      or "Hel" in this case.
  239. `common_suffix(x, "to")'
  240.      returns the String containing the common suffix of the two Strings
  241.      or "o" in this case.
  242. Concatenation
  243. =============
  244. `z = x + s + ' ' + y.at("w") + y.after("w") + ".";'
  245.      sets z to "Hello, world."
  246. `x += y;'
  247.      sets x to "Helloworld"
  248. `cat(x, y, z)'
  249.      A faster way to say z = x + y.
  250. `cat(z, y, x, x)'
  251.      Double concatenation; A faster way to say x = z + y + x.
  252. `y.prepend(x);'
  253.      A faster way to say y = x + y.
  254. `z = replicate(x, 3);'
  255.      sets z to "HelloHelloHello".
  256. `z = join(words, 3, "/")'
  257.      sets z to the concatenation of the first 3 Strings in String array
  258.      words, each separated by "/", setting z to "a/b/c" in this case.
  259.      The last argument may be "" or 0, indicating no separation.
  260. Other manipulations
  261. ===================
  262. `z = "this string has five words"; i = split(z, words, 10, RXwhite);'
  263.      sets up to 10 elements of String array words to the parts of z
  264.      separated by whitespace, and returns the number of parts actually
  265.      encountered (5 in this case). Here, words[0] = "this", words[1] =
  266.      "string", etc.  The last argument may be any of the usual.  If
  267.      there is no match, all of z ends up in words[0]. The words array
  268.      is *not* dynamically created by split.
  269. `int nmatches x.gsub("l","ll")'
  270.      substitutes all original occurrences of "l" with "ll", setting x
  271.      to "Hellllo". The first argument may be any of the usual,
  272.      including Regex.  If the second argument is "" or 0, all
  273.      occurrences are deleted. gsub returns the number of matches that
  274.      were replaced.
  275. `z = x + y;  z.del("loworl");'
  276.      deletes the leftmost occurrence of "loworl" in z, setting z to
  277.      "Held".
  278. `z = reverse(x)'
  279.      sets z to the reverse of x, or "olleH".
  280. `z = upcase(x)'
  281.      sets z to x, with all letters set to uppercase, setting z to
  282.      "HELLO"
  283. `z = downcase(x)'
  284.      sets z to x, with all letters set to lowercase, setting z to
  285.      "hello"
  286. `z = capitalize(x)'
  287.      sets z to x, with the first letter of each word set to uppercase,
  288.      and all others to lowercase, setting z to "Hello"
  289. `x.reverse(), x.upcase(), x.downcase(), x.capitalize()'
  290.      in-place, self-modifying versions of the above.
  291. Reading, Writing and Conversion
  292. ===============================
  293. `cout << x'
  294.      writes out x.
  295. `cout << x.at(2, 3)'
  296.      writes out the substring "llo".
  297. `cin >> x'
  298.      reads a whitespace-bounded string into x.
  299. `x.length()'
  300.      returns the length of String x (5, in this case).
  301. `s = (const char*)x'
  302.      can be used to extract the `char*' char array. This coercion is
  303.      useful for sending a String as an argument to any function
  304.      expecting a `const char*' argument (like `atoi', and
  305.      `File::open'). This operator must be used with care, since the
  306.      conversion returns a pointer to `String' internals without copying
  307.      the characters: The resulting `(char*)' is only valid until the
  308.      next String operation,  and you must not modify it.  (The
  309.      conversion is defined to return a const value so that GNU C++ will
  310.      produce warning and/or error messages if changes are attempted.)
  311. File: libg++.info,  Node: Integer,  Next: Rational,  Prev: String,  Up: Top
  312. The Integer class.
  313. ******************
  314.    The `Integer' class provides multiple precision integer arithmetic
  315. facilities. Some representation details are discussed in the
  316. Representation section.
  317.    `Integers' may be up to `b * ((1 << b) - 1)' bits long, where `b' is
  318. the number of bits per short (typically 1048560 bits when `b = 16').
  319. The implementation assumes that a `long' is at least twice as long as a
  320. `short'. This assumption hides beneath almost all primitive operations,
  321. and would be very difficult to change. It also relies on correct
  322. behavior of *unsigned* arithmetic operations.
  323.    Some of the arithmetic algorithms are very loosely based on those
  324. provided in the MIT Scheme `bignum.c' release, which is Copyright (c)
  325. 1987 Massachusetts Institute of Technology. Their use here falls within
  326. the provisions described in the Scheme release.
  327.    Integers may be constructed in the following ways:
  328. `Integer x;'
  329.      Declares an uninitialized Integer.
  330. `Integer x = 2; Integer y(2);'
  331.      Set x and y to the Integer value 2;
  332. `Integer u(x); Integer v = x;'
  333.      Set u and v to the same value as x.
  334.  - Method: long Integer::as_long() const
  335.      Used to coerce an `Integer' back into longs via the `long'
  336.      coercion operator. If the Integer cannot fit into a long, this
  337.      returns MINLONG or MAXLONG (depending on the sign) where MINLONG
  338.      is the most negative, and MAXLONG is the most positive
  339.      representable long.
  340.  - Method: int Integer::fits_in_long() const
  341.      Returns true iff the `Integer' is `< MAXLONG' and `> MINLONG'.
  342.  - Method: double Integer::as_double() const
  343.      Coerce the `Integer' to a `double', with potential loss of
  344.      precision.  `+/-HUGE' is returned if the Integer cannot fit into a
  345.      double.
  346.  - Method: int Integer::fits_in_double() const
  347.      Returns true iff the `Integer' can fit into a double.
  348.    All of the usual arithmetic operators are provided (`+, -, *, /, %,
  349. +=, ++, -=, --, *=, /=, %=, ==, !=, <, <=, >, >=').  All operators
  350. support special versions for mixed arguments of Integers and regular
  351. C++ longs in order to avoid useless coercions, as well as to allow
  352. automatic promotion of shorts and ints to longs, so that they may be
  353. applied without additional Integer coercion operators.  The only
  354. operators that behave differently than the corresponding int or long
  355. operators are `++' and `--'.  Because C++ does not distinguish prefix
  356. from postfix application, these are declared as `void' operators, so
  357. that no confusion can result from applying them as postfix.  Thus, for
  358. Integers x and y, ` ++x; y = x; ' is correct, but ` y = ++x; ' and ` y
  359. = x++; ' are not.
  360.    Bitwise operators (`~', `&', `|', `^', `<<', `>>', `&=', `|=', `^=',
  361. `<<=', `>>=') are also provided.  However, these operate on
  362. sign-magnitude, rather than two's complement representations. The sign
  363. of the result is arbitrarily taken as the sign of the first argument.
  364. For example, `Integer(-3) & Integer(5)' returns `Integer(-1)', not -3,
  365. as it would using two's complement. Also, `~', the complement operator,
  366. complements only those bits needed for the representation.  Bit
  367. operators are also provided in the BitSet and BitString classes. One of
  368. these classes should be used instead of Integers when the results of
  369. bit manipulations are not interpreted numerically.
  370.    The following utility functions are also provided. (All arguments
  371. are Integers unless otherwise noted).
  372.  - Function: void divide(const Integer& X, const Integer& Y, Integer&
  373.           Q, Integer& R)
  374.      Sets Q to the quotient and R to the remainder of X and Y.  (Q and
  375.      R are returned by reference).
  376.  - Function: Integer pow(const Integer& X, const Integer& P)
  377.      Returns X raised to the power P.
  378.  - Function: Integer Ipow(long X, long P)
  379.      Returns X raised to the power P.
  380.  - Function: Integer gcd(const Integer& X, const Integer& P)
  381.      Returns the greatest common divisor of X and Y.
  382.  - Function: Integer lcm(const Integer& X, const Integer& P)
  383.      Returns the least common multiple of X and Y.
  384.  - Function: Integer abs(const Integer& X
  385.      Returns the absolute value of X.
  386.  - Method: void Integer::negate()
  387.      Negates `this' in place.
  388. `Integer sqr(x)'
  389.      returns x * x;
  390. `Integer sqrt(x)'
  391.      returns the floor of the  square root of x.
  392. `long lg(x);'
  393.      returns the floor of the base 2 logarithm of abs(x)
  394. `int sign(x)'
  395.      returns -1 if x is negative, 0 if zero, else +1.  Using `if
  396.      (sign(x) == 0)' is a generally faster method of testing for zero
  397.      than using relational operators.
  398. `int even(x)'
  399.      returns true if x is an even number
  400. `int odd(x)'
  401.      returns true if x is an odd number.
  402. `void setbit(Integer& x, long b)'
  403.      sets the b'th bit (counting right-to-left from zero) of x to 1.
  404. `void clearbit(Integer& x, long b)'
  405.      sets the b'th bit of x to 0.
  406. `int testbit(Integer x, long b)'
  407.      returns true if the b'th bit of x is 1.
  408. `Integer atoI(char* asciinumber, int base = 10);'
  409.      converts the base base char* string into its Integer form.
  410. `void Integer::printon(ostream& s, int base = 10, int width = 0);'
  411.      prints the ascii string value of `(*this)' as a base `base'
  412.      number, in field width at least `width'.
  413. `ostream << x;'
  414.      prints x in base ten format.
  415. `istream >> x;'
  416.      reads x as a base ten number.
  417. `int compare(Integer x, Integer y)'
  418.      returns a negative number if x<y, zero if x==y, or positive if x>y.
  419. `int ucompare(Integer x, Integer y)'
  420.      like compare, but performs unsigned comparison.
  421. `add(x, y, z)'
  422.      A faster way to say z = x + y.
  423. `sub(x, y, z)'
  424.      A faster way to say z = x - y.
  425. `mul(x, y, z)'
  426.      A faster way to say z = x * y.
  427. `div(x, y, z)'
  428.      A faster way to say z = x / y.
  429. `mod(x, y, z)'
  430.      A faster way to say z = x % y.
  431. `and(x, y, z)'
  432.      A faster way to say z = x & y.
  433. `or(x, y, z)'
  434.      A faster way to say z = x | y.
  435. `xor(x, y, z)'
  436.      A faster way to say z = x ^ y.
  437. `lshift(x, y, z)'
  438.      A faster way to say z = x << y.
  439. `rshift(x, y, z)'
  440.      A faster way to say z = x >> y.
  441. `pow(x, y, z)'
  442.      A faster way to say z = pow(x, y).
  443. `complement(x, z)'
  444.      A faster way to say z = ~x.
  445. `negate(x, z)'
  446.      A faster way to say z = -x.
  447. File: libg++.info,  Node: Rational,  Next: Complex,  Prev: Integer,  Up: Top
  448. The Rational Class
  449. ******************
  450.    Class `Rational' provides multiple precision rational number
  451. arithmetic. All rationals are maintained in simplest form (i.e., with
  452. the numerator and denominator relatively prime, and with the
  453. denominator strictly positive).  Rational arithmetic and relational
  454. operators are provided (`+, -, *, /, +=, -=, *=, /=, ==, !=, <, <=, >,
  455. >=').  Operations resulting in a rational number with zero denominator
  456. trigger an exception.
  457.    Rationals may be constructed and used in the following ways:
  458. `Rational x;'
  459.      Declares an uninitialized Rational.
  460. `Rational x = 2; Rational y(2);'
  461.      Set x and y to the Rational value 2/1;
  462. `Rational x(2, 3);'
  463.      Sets x to the Rational value 2/3;
  464. `Rational x = 1.2;'
  465.      Sets x to a Rational value close to 1.2. Any double precision value
  466.      may be used to construct a Rational. The Rational will possess
  467.      exactly as much precision as the double. Double values that do not
  468.      have precise floating point equivalents (like 1.2) produce
  469.      similarly imprecise rational values.
  470. `Rational x(Integer(123), Integer(4567));'
  471.      Sets x to the Rational value 123/4567.
  472. `Rational u(x); Rational v = x;'
  473.      Set u and v to the same value as x.
  474. `double(Rational x)'
  475.      A Rational may be coerced to a double with potential loss of
  476.      precision. +/-HUGE is returned if it will not fit.
  477. `Rational abs(x)'
  478.      returns the absolute value of x.
  479. `void x.negate()'
  480.      negates x.
  481. `void x.invert()'
  482.      sets x to 1/x.
  483. `int sign(x)'
  484.      returns 0 if x is zero, 1 if positive, and -1 if negative.
  485. `Rational sqr(x)'
  486.      returns x * x.
  487. `Rational pow(x, Integer y)'
  488.      returns x to the y power.
  489. `Integer x.numerator()'
  490.      returns the numerator.
  491. `Integer x.denominator()'
  492.      returns the denominator.
  493. `Integer floor(x)'
  494.      returns the greatest Integer less than x.
  495. `Integer ceil(x)'
  496.      returns the least Integer greater than x.
  497. `Integer trunc(x)'
  498.      returns the Integer part of x.
  499. `Integer round(x)'
  500.      returns the nearest Integer to x.
  501. `int compare(x, y)'
  502.      returns a negative, zero, or positive number signifying whether x
  503.      is less than, equal to, or greater than y.
  504. `ostream << x;'
  505.      prints x in the form num/den, or just num if the denominator is
  506.      one.
  507. `istream >> x;'
  508.      reads x in the form num/den, or just num in which case the
  509.      denominator is set to one.
  510. `add(x, y, z)'
  511.      A faster way to say z = x + y.
  512. `sub(x, y, z)'
  513.      A faster way to say z = x - y.
  514. `mul(x, y, z)'
  515.      A faster way to say z = x * y.
  516. `div(x, y, z)'
  517.      A faster way to say z = x / y.
  518. `pow(x, y, z)'
  519.      A faster way to say z = pow(x, y).
  520. `negate(x, z)'
  521.      A faster way to say z = -x.
  522. File: libg++.info,  Node: Complex,  Next: Fix,  Prev: Rational,  Up: Top
  523. The Complex class.
  524. ******************
  525.    Class `Complex' is implemented in a way similar to that described by
  526. Stroustrup. In keeping with libg++ conventions, the class is named
  527. `Complex', not `complex'.  Complex arithmetic and relational operators
  528. are provided (`+, -, *, /, +=, -=, *=, /=, ==, !=').  Attempted
  529. division by (0, 0) triggers an exception.
  530.    Complex numbers may be constructed and used in the following ways:
  531. `Complex x;'
  532.      Declares an uninitialized Complex.
  533. `Complex x = 2; Complex y(2.0);'
  534.      Set x and y to the Complex value (2.0, 0.0);
  535. `Complex x(2, 3);'
  536.      Sets x to the Complex value (2, 3);
  537. `Complex u(x); Complex v = x;'
  538.      Set u and v to the same value as x.
  539. `double real(Complex& x);'
  540.      returns the real part of x.
  541. `double imag(Complex& x);'
  542.      returns the imaginary part of x.
  543. `double abs(Complex& x);'
  544.      returns the magnitude of x.
  545. `double norm(Complex& x);'
  546.      returns the square of the magnitude of x.
  547. `double arg(Complex& x);'
  548.      returns the argument (amplitude) of x.
  549. `Complex polar(double r, double t = 0.0);'
  550.      returns a Complex with abs of r and arg of t.
  551. `Complex conj(Complex& x);'
  552.      returns the complex conjugate of x.
  553. `Complex cos(Complex& x);'
  554.      returns the complex cosine of x.
  555. `Complex sin(Complex& x);'
  556.      returns the complex sine of x.
  557. `Complex cosh(Complex& x);'
  558.      returns the complex hyperbolic cosine of x.
  559. `Complex sinh(Complex& x);'
  560.      returns the complex hyperbolic sine of x.
  561. `Complex exp(Complex& x);'
  562.      returns the exponential of x.
  563. `Complex log(Complex& x);'
  564.      returns the natural log of x.
  565. `Complex pow(Complex& x, long p);'
  566.      returns x raised to the p power.
  567. `Complex pow(Complex& x, Complex& p);'
  568.      returns x raised to the p power.
  569. `Complex sqrt(Complex& x);'
  570.      returns the square root of x.
  571. `ostream << x;'
  572.      prints x in the form (re, im).
  573. `istream >> x;'
  574.      reads x in the form (re, im), or just (re) or re in which case the
  575.      imaginary part is set to zero.
  576. File: libg++.info,  Node: Fix,  Next: Bit,  Prev: Complex,  Up: Top
  577. Fixed precision numbers
  578. ***********************
  579.    Classes `Fix16', `Fix24', `Fix32', and `Fix48' support operations on
  580. 16, 24, 32, or 48 bit quantities that are considered as real numbers in
  581. the range [-1, +1).  Such numbers are often encountered in digital
  582. signal processing applications. The classes may be be used in isolation
  583. or together.  Class `Fix32' operations are entirely self-contained.
  584. Class `Fix16' operations are self-contained except that the
  585. multiplication operation `Fix16 * Fix16' returns a `Fix32'. `Fix24' and
  586. `Fix48' are similarly related.
  587.    The standard arithmetic and relational operations are supported
  588. (`=', `+', `-', `*', `/', `<<', `>>', `+=', `-=', `*=', `/=', `<<=',
  589. `>>=', `==', `!=', `<', `<=', `>', `>=').  All operations include
  590. provisions for special handling in cases where the result exceeds +/-
  591. 1.0. There are two cases that may be handled separately: "overflow"
  592. where the results of addition and subtraction operations go out of
  593. range, and all other "range errors" in which resulting values go
  594. off-scale (as with division operations, and assignment or
  595. initialization with off-scale values). In signal processing
  596. applications, it is often useful to handle these two cases differently.
  597. Handlers take one argument, a reference to the integer mantissa of the
  598. offending value, which may then be manipulated.  In cases of overflow,
  599. this value is the result of the (integer) arithmetic computation on the
  600. mantissa; in others it is a fully saturated (i.e., most positive or
  601. most negative) value. Handling may be reset to any of several provided
  602. functions or any other user-defined function via `set_overflow_handler'
  603. and `set_range_error_handler'. The provided functions for `Fix16' are
  604. as follows (corresponding functions are also supported for the others).
  605. `Fix16_overflow_saturate'
  606.      The default overflow handler. Results are "saturated": positive
  607.      results are set to the largest representable value (binary
  608.      0.111111...), and negative values to -1.0.
  609. `Fix16_ignore'
  610.      Performs no action. For overflow, this will allow addition and
  611.      subtraction operations to "wrap around" in the same manner as
  612.      integer arithmetic, and for saturation, will leave values
  613.      saturated.
  614. `Fix16_overflow_warning_saturate'
  615.      Prints a warning message on standard error, then saturates the
  616.      results.
  617. `Fix16_warning'
  618.      The default range_error handler. Prints a warning message on
  619.      standard error; otherwise leaving the argument unmodified.
  620. `Fix16_abort'
  621.      prints an error message on standard error, then aborts execution.
  622.    In addition to arithmetic operations, the following are provided:
  623. `Fix16 a = 0.5;'
  624.      Constructs fixed precision objects from double precision values.
  625.      Attempting to initialize to a value outside the range invokes the
  626.      range_error handler, except, as a convenience, initialization to
  627.      1.0 sets the variable to the most positive representable value
  628.      (binary 0.1111111...) without invoking the handler.
  629. `short& mantissa(a); long& mantissa(b);'
  630.      return a * pow(2, 15) or b * pow(2, 31) as an integer. These are
  631.      returned by reference, to enable "manual" data manipulation.
  632. `double value(a); double value(b);'
  633.      return a or b as floating point numbers.
  634. File: libg++.info,  Node: Bit,  Next: Random,  Prev: Fix,  Up: Top
  635. Classes for Bit manipulation
  636. ****************************
  637.    libg++ provides several different classes supporting the use and
  638. manipulation of collections of bits in different ways.
  639.    * Class `Integer' provides "integer" semantics. It supports
  640.      manipulation of bits in ways that are often useful when treating
  641.      bit arrays as numerical (integer) quantities.  This class is
  642.      described elsewhere.
  643.    * Class `BitSet' provides "set" semantics. It supports operations
  644.      useful when treating collections of bits as representing
  645.      potentially infinite sets of integers.
  646.    * Class `BitSet32' supports fixed-length BitSets holding exactly 32
  647.      bits.
  648.    * Class `BitSet256' supports fixed-length BitSets holding exactly
  649.      256 bits.
  650.    * Class `BitString' provides "string" (or "vector") semantics.  It
  651.      supports operations useful when treating collections of bits as
  652.      strings of zeros and ones.
  653.    These classes also differ in the following ways:
  654.    * BitSets are logically infinite. Their space is dynamically altered
  655.      to adjust to the smallest number of consecutive bits actually
  656.      required to represent the sets. Integers also have this property.
  657.      BitStrings are logically finite, but their sizes are internally
  658.      dynamically managed to maintain proper length. This means that,
  659.      for example, BitStrings are concatenatable while BitSets and
  660.      Integers are not.
  661.    * BitSet32 and BitSet256 have precisely the same properties as
  662.      BitSets, except that they use constant fixed length bit vectors.
  663.    * While all classes support basic unary and binary operations `~, &,
  664.      |, ^, -', the semantics differ. BitSets perform bit operations that
  665.      precisely mirror those for infinite sets. For example,
  666.      complementing an empty BitSet returns one representing an infinite
  667.      number of set bits.  Operations on BitStrings and Integers operate
  668.      only on those bits actually present in the representation.  For
  669.      BitStrings and Integers, the the `&' operation returns a BitString
  670.      with a length equal to the minimum length of the operands, and `|,
  671.      ^' return one with length of the maximum.
  672.    * Only BitStrings support substring extraction and bit pattern
  673.      matching.
  674. BitSet
  675. ======
  676.    BitSets are objects that contain logically infinite sets of
  677. nonnegative integers.  Representational details are discussed in the
  678. Representation chapter. Because they are logically infinite, all
  679. BitSets possess a trailing, infinitely replicated 0 or 1 bit, called
  680. the "virtual bit", and indicated via 0* or 1*.
  681.    BitSet32 and BitSet256 have they same properties, except they are of
  682. fixed length, and thus have no virtual bit.
  683.    BitSets may be constructed as follows:
  684. `BitSet a;'
  685.      declares an empty BitSet.
  686. `BitSet a = atoBitSet("001000");'
  687.      sets a to the BitSet 0010*, reading left-to-right. The "0*"
  688.      indicates that the set ends with an infinite number of zero
  689.      (clear) bits.
  690. `BitSet a = atoBitSet("00101*");'
  691.      sets a to the BitSet 00101*, where "1*" means that the set ends
  692.      with an infinite number of one (set) bits.
  693. `BitSet a = longtoBitSet((long)23);'
  694.      sets a to the BitSet 111010*, the binary representation of decimal
  695.      23.
  696. `BitSet a = utoBitSet((unsigned)23);'
  697.      sets a to the BitSet 111010*, the binary representation of decimal
  698.      23.
  699.    The following functions and operators are provided (Assume the
  700. declaration of BitSets a = 0011010*, b = 101101*, throughout, as
  701. examples).
  702.      returns the complement of a, or 1100101* in this case.
  703. `a.complement()'
  704.      sets a to ~a.
  705. `a & b; a &= b;'
  706.      returns a intersected with b, or 0011010*.
  707. `a | b; a |= b;'
  708.      returns a unioned with b, or 1011111*.
  709. `a - b; a -= b;'
  710.      returns the set difference of a and b, or 000010*.
  711. `a ^ b; a ^= b;'
  712.      returns the symmetric difference of a and b, or 1000101*.
  713. `a.empty()'
  714.      returns true if a is an empty set.
  715. `a == b;'
  716.      returns true if a and b contain the same set.
  717. `a <= b;'
  718.      returns true if a is a subset of b.
  719. `a < b;'
  720.      returns true if a is a proper subset of b;
  721. `a != b; a >= b; a > b;'
  722.      are the converses of the above.
  723. `a.set(7)'
  724.      sets the 7th (counting from 0) bit of a, setting a to 001111010*
  725. `a.clear(2)'
  726.      clears the 2nd bit bit of a, setting a to 00011110*
  727. `a.clear()'
  728.      clears all bits of a;
  729. `a.set()'
  730.      sets all bits of a;
  731. `a.invert(0)'
  732.      complements the 0th bit of a, setting a to 10011110*
  733. `a.set(0,1)'
  734.      sets the 0th through 1st bits of a, setting a to 110111110* The
  735.      two-argument versions of clear and invert are similar.
  736. `a.test(3)'
  737.      returns true if the 3rd bit of a is set.
  738. `a.test(3, 5)'
  739.      returns true if any of bits 3 through 5 are set.
  740. `int i = a[3]; a[3] = 0;'
  741.      The subscript operator allows bits to be inspected and changed via
  742.      standard subscript semantics, using a friend class BitSetBit.  The
  743.      use of the subscript operator a[i] rather than a.test(i) requires
  744.      somewhat greater overhead.
  745. `a.first(1) or a.first()'
  746.      returns the index of the first set bit of a (2 in this case), or
  747.      -1 if no bits are set.
  748. `a.first(0)'
  749.      returns the index of the first clear bit of a (0 in this case), or
  750.      -1 if no bits are clear.
  751. `a.next(2, 1) or a.next(2)'
  752.      returns the index of the next bit after position 2 that is set (3
  753.      in this case) or -1. `first' and `next' may be used as iterators,
  754.      as in `for (int i = a.first(); i >= 0; i = a.next(i))...'.
  755. `a.last(1)'
  756.      returns the index of the rightmost set bit, or -1 if there or no
  757.      set bits or all set bits.
  758. `a.prev(3, 0)'
  759.      returns the index of the previous clear bit before position 3.
  760. `a.count(1)'
  761.      returns the number of set bits in a, or -1 if there are an
  762.      infinite number.
  763. `a.virtual_bit()'
  764.      returns the trailing (infinitely replicated) bit of a.
  765. `a = atoBitSet("ababX", 'a', 'b', 'X');'
  766.      converts the char* string into a bitset, with 'a' denoting false,
  767.      'b' denoting true, and 'X' denoting infinite replication.
  768. `a.printon(cout, '-', '.', 0)'
  769.      prints `a' to `cout' represented with `'-'' for falses, `'.'' for
  770.      trues, and no replication marker.
  771. `cout << a'
  772.      prints `a' to `cout' (representing lases by `'f'', trues by `'t'',
  773.      and using `'*'' as the replication marker).
  774. `diff(x, y, z)'
  775.      A faster way to say z = x - y.
  776. `and(x, y, z)'
  777.      A faster way to say z = x & y.
  778. `or(x, y, z)'
  779.      A faster way to say z = x | y.
  780. `xor(x, y, z)'
  781.      A faster way to say z = x ^ y.
  782. `complement(x, z)'
  783.      A faster way to say z = ~x.
  784. BitString
  785. =========
  786.    BitStrings are objects that contain arbitrary-length strings of
  787. zeroes and ones. BitStrings possess some features that make them behave
  788. like sets, and others that behave as strings. They are useful in
  789. applications (such as signature-based algorithms) where both
  790. capabilities are needed.  Representational details are discussed in the
  791. Representation chapter.  Most capabilities are exact analogs of those
  792. supported in the BitSet and String classes.  A BitSubString is used
  793. with substring operations along the same lines as the String SubString
  794. class.  A BitPattern class is used for masked bit pattern searching.
  795.    Only a default constructor is supported.  The declaration `BitString
  796. a;' initializes a to be an empty BitString.  BitStrings may often be
  797. initialized via `atoBitString' and `longtoBitString'.
  798.    Set operations (` ~, complement, &, &=, |, |=, -, ^, ^=') behave
  799. just as the BitSet versions, except that there is no "virtual bit":
  800. complementing complements only those bits in the BitString, and all
  801. binary operations across unequal length BitStrings assume a virtual bit
  802. of zero. The `&' operation returns a BitString with a length equal to
  803. the minimum length of the operands, and `|, ^' return one with length
  804. of the maximum.
  805.    Set-based relational operations (`==, !=, <=, <, >=, >') follow the
  806. same rules. A string-like lexicographic comparison function,
  807. `lcompare', tests the lexicographic relation between two BitStrings.
  808. For example, lcompare(1100, 0101) returns 1, since the first BitString
  809. starts with 1 and the second with 0.
  810.    Individual bit setting, testing, and iterator operations (`set,
  811. clear, invert, test, first, next, last, prev') are also like those for
  812. BitSets. BitStrings are automatically expanded when setting bits at
  813. positions greater than their current length.
  814.    The string-based capabilities are just as those for class String.
  815. BitStrings may be concatenated (`+, +='), searched (`index, contains,
  816. matches'), and extracted into BitSubStrings (`before, at, after') which
  817. may be assigned and otherwise manipulated. Other string-based utility
  818. functions (`reverse, common_prefix, common_suffix') are also provided.
  819. These have the same capabilities and descriptions as those for Strings.
  820.    String-oriented operations can also be performed with a mask via
  821. class BitPattern. BitPatterns consist of two BitStrings, a pattern and
  822. a mask. On searching and matching, bits in the pattern that correspond
  823. to 0 bits in the mask are ignored. (The mask may be shorter than the
  824. pattern, in which case trailing mask bits are assumed to be 0). The
  825. pattern and mask are both public variables, and may be individually
  826. subjected to other bit operations.
  827.    Converting to char* and printing (`(atoBitString, atoBitPattern,
  828. printon, ostream <<)') are also as in BitSets, except that no virtual
  829. bit is used, and an 'X' in a BitPattern means that the pattern bit is
  830. masked out.
  831.    The following features are unique to BitStrings.
  832.    Assume declarations of BitString a = atoBitString("01010110") and b =
  833. atoBitSTring("1101").
  834. `a = b + c;'
  835.      Sets a to the concatenation of b and c;
  836. `a = b + 0; a = b + 1;'
  837.      sets a to b, appended with a zero (one).
  838. `a += b;'
  839.      appends b to a;
  840. `a += 0; a += 1;'
  841.      appends a zero (one) to a.
  842. `a << 2; a <<= 2'
  843.      return a with 2 zeros prepended, setting a to 0001010110. (Note
  844.      the necessary confusion of << and >> operators. For consistency
  845.      with the integer versions, << shifts low bits to high, even though
  846.      they are printed low bits first.)
  847. `a >> 3; a >>= 3'
  848.      return a with the first 3 bits deleted, setting a to 10110.
  849. `a.left_trim(0)'
  850.      deletes all 0 bits on the left of a, setting a to 1010110.
  851. `a.right_trim(0)'
  852.      deletes all trailing 0 bits of a, setting a to 0101011.
  853. `cat(x, y, z)'
  854.      A faster way to say z = x + y.
  855. `diff(x, y, z)'
  856.      A faster way to say z = x - y.
  857. `and(x, y, z)'
  858.      A faster way to say z = x & y.
  859. `or(x, y, z)'
  860.      A faster way to say z = x | y.
  861. `xor(x, y, z)'
  862.      A faster way to say z = x ^ y.
  863. `lshift(x, y, z)'
  864.      A faster way to say z = x << y.
  865. `rshift(x, y, z)'
  866.      A faster way to say z = x >> y.
  867. `complement(x, z)'
  868.      A faster way to say z = ~x.
  869. File: libg++.info,  Node: Random,  Next: Data,  Prev: Bit,  Up: Top
  870. Random Number Generators and related classes
  871. ********************************************
  872.    The two classes `RNG' and `Random' are used together to generate a
  873. variety of random number distributions.  A distinction must be made
  874. between *random number generators*, implemented by class `RNG', and
  875. *random number distributions*.  A random number generator produces a
  876. series of randomly ordered bits.  These bits can be used directly, or
  877. cast to other representations, such as a floating point value.  A
  878. random number generator should produce a *uniform* distribution.  A
  879. random number distribution, on the other hand, uses the randomly
  880. generated bits of a generator to produce numbers from a distribution
  881. with specific properties.  Each instance of `Random' uses an instance
  882. of class `RNG' to provide the raw, uniform distribution used to produce
  883. the specific distribution.  Several instances of `Random' classes can
  884. share the same instance of `RNG', or each instance can use its own copy.
  885.    Random distributions are constructed from members of class `RNG',
  886. the actual random number generators.  The `RNG' class contains no data;
  887. it only serves to define the interface to random number generators.
  888. The `RNG::asLong' member returns an unsigned long (typically 32 bits)
  889. of random bits.  Applications that require a number of random bits can
  890. use this directly.  More often, these random bits are transformed to a
  891. uniform random number:
  892.          //
  893.          // Return random bits converted to either a float or a double
  894.          //
  895.          float asFloat();
  896.          double asDouble();
  897.      };
  898. using either `asFloat' or `asDouble'.  It is intended that `asFloat'
  899. and `asDouble' return differing precisions; typically, `asDouble' will
  900. draw two random longwords and transform them into a legal `double',
  901. while `asFloat' will draw a single longword and transform it into a
  902. legal `float'.  These members are used by subclasses of the `Random'
  903. class to implement a variety of random number distributions.
  904.    Class `ACG' is a variant of a Linear Congruential Generator
  905. (Algorithm M) described in Knuth, *Art of Computer Programming, Vol
  906. III*.  This result is permuted with a Fibonacci Additive Congruential
  907. Generator to get good independence between samples.  This is a very high
  908. quality random number generator, although it requires a fair amount of
  909. memory for each instance of the generator.
  910.    The `ACG::ACG' constructor takes two parameters: the seed and the
  911. size.  The seed is any number to be used as an initial seed. The
  912. performance of the generator depends on having a distribution of bits
  913. through the seed.  If you choose a number in the range of 0 to 31, a
  914. seed with more bits is chosen. Other values are deterministically
  915. modified to give a better distribution of bits.  This provides a good
  916. random number generator while still allowing a sequence to be repeated
  917. given the same initial seed.
  918.    The `size' parameter determines the size of two tables used in the
  919. generator. The first table is used in the Additive Generator; see the
  920. algorithm in Knuth for more information. In general, this table is
  921. `size' longwords long. The default value, used in the algorithm in
  922. Knuth, gives a table of 220 bytes. The table size affects the period of
  923. the generators; smaller values give shorter periods and larger tables
  924. give longer periods. The smallest table size is 7 longwords, and the
  925. longest is 98 longwords. The `size' parameter also determines the size
  926. of the table used for the Linear Congruential Generator. This value is
  927. chosen implicitly based on the size of the Additive Congruential
  928. Generator table. It is two powers of two larger than the power of two
  929. that is larger than `size'.  For example, if `size' is 7, the ACG table
  930. is 7 longwords and the LCG table is 128 longwords. Thus, the default
  931. size (55) requires 55 + 256 longwords, or 1244 bytes. The largest table
  932. requires 2440 bytes and the smallest table requires 100 bytes.
  933. Applications that require a large number of generators or applications
  934. that aren't so fussy about the quality of the generator may elect to
  935. use the `MLCG' generator.
  936.    The `MLCG' class implements a *Multiplicative Linear Congruential
  937. Generator*. In particular, it is an implementation of the double MLCG
  938. described in *"Efficient and Portable Combined Random Number
  939. Generators"* by Pierre L'Ecuyer, appearing in *Communications of the
  940. ACM, Vol. 31. No. 6*. This generator has a fairly long period, and has
  941. been statistically analyzed to show that it gives good inter-sample
  942. independence.
  943.    The `MLCG::MLCG' constructor has two parameters, both of which are
  944. seeds for the generator. As in the `MLCG' generator, both seeds are
  945. modified to give a "better" distribution of seed digits. Thus, you can
  946. safely use values such as `0' or `1' for the seeds. The `MLCG'
  947. generator used much less state than the `ACG' generator; only two
  948. longwords (8 bytes) are needed for each generator.
  949. Random
  950. ======
  951.    A random number generator may be declared by first declaring a `RNG'
  952. and then a `Random'. For example, `ACG gen(10, 20); NegativeExpntl rnd
  953. (1.0, &gen);' declares an additive congruential generator with seed 10
  954. and table size 20, that is used to generate exponentially distributed
  955. values with mean of 1.0.
  956.    The virtual member `Random::operator()' is the common way of
  957. extracting a random number from a particular distribution.  The base
  958. class, `Random' does not implement `operator()'. This is performed by
  959. each of the subclasses. Thus, given the above declaration of `rnd', new
  960. random values may be obtained via, for example, `double next_exp_rand =
  961. rnd();' Currently, the following subclasses are provided.
  962. Binomial
  963. ========
  964.    The binomial distribution models successfully drawing items from a
  965. pool.  The first parameter to the constructor, `n', is the number of
  966. items in the pool, and the second parameter, `u', is the probability of
  967. each item being successfully drawn.  The member `asDouble' returns the
  968. number of samples drawn from the pool.  Although it is not checked, it
  969. is assumed that `n>0' and `0 <= u <= 1'.  The remaining members allow
  970. you to read and set the parameters.
  971. Erlang
  972. ======
  973.    The `Erlang' class implements an Erlang distribution with mean
  974. `mean' and variance `variance'.
  975. Geometric
  976. =========
  977.    The `Geometric' class implements a discrete geometric distribution.
  978. The first parameter to the constructor, `mean', is the mean of the
  979. distribution.  Although it is not checked, it is assumed that `0 <=
  980. mean <= 1'.  `Geometric()' returns the number of uniform random samples
  981. that were drawn before the sample was larger than `mean'.  This
  982. quantity is always greater than zero.
  983. HyperGeometric
  984. ==============
  985.    The `HyperGeometric' class implements the hypergeometric
  986. distribution.  The first parameter to the constructor, `mean', is the
  987. mean and the second, `variance', is the variance.  The remaining
  988. members allow you to inspect and change the mean and variance.
  989. NegativeExpntl
  990. ==============
  991.    The `NegativeExpntl' class implements the negative exponential
  992. distribution.  The first parameter to the constructor is the mean.  The
  993. remaining members allow you to inspect and change the mean.
  994. Normal
  995. ======
  996.    The `Normal'class implements the normal distribution.  The first
  997. parameter to the constructor, `mean', is the mean and the second,
  998. `variance', is the variance.  The remaining members allow you to
  999. inspect and change the mean and variance.  The `LogNormal' class is a
  1000. subclass of `Normal'.
  1001. LogNormal
  1002. =========
  1003.    The `LogNormal'class implements the logarithmic normal distribution.
  1004. The first parameter to the constructor, `mean', is the mean and the
  1005. second, `variance', is the variance.  The remaining members allow you
  1006. to inspect and change the mean and variance.  The `LogNormal' class is
  1007. a subclass of `Normal'.
  1008. Poisson
  1009. =======
  1010.    The `Poisson' class implements the poisson distribution.  The first
  1011. parameter to the constructor is the mean.  The remaining members allow
  1012. you to inspect and change the mean.
  1013. DiscreteUniform
  1014. ===============
  1015.    The `DiscreteUniform' class implements a uniform random variable over
  1016. the closed interval ranging from `[low..high]'.  The first parameter to
  1017. the constructor is `low', and the second is `high', although the order
  1018. of these may be reversed.  The remaining members allow you to inspect
  1019. and change `low' and `high'.
  1020. Uniform
  1021. =======
  1022.    The `Uniform' class implements a uniform random variable over the
  1023. open interval ranging from `[low..high)'.  The first parameter to the
  1024. constructor is `low', and the second is `high', although the order of
  1025. these may be reversed.  The remaining members allow you to inspect and
  1026. change `low' and `high'.
  1027. Weibull
  1028. =======
  1029.    The `Weibull' class implements a weibull distribution with
  1030. parameters `alpha' and `beta'.  The first parameter to the class
  1031. constructor is `alpha', and the second parameter is `beta'.  The
  1032. remaining members allow you to inspect and change `alpha' and `beta'.
  1033. RandomInteger
  1034. =============
  1035.    The `RandomInteger' class is *not* a subclass of Random, but a
  1036. stand-alone integer-oriented class that is dependent on the RNG
  1037. classes. RandomInteger returns random integers uniformly from the
  1038. closed interval `[low..high]'.  The first parameter to the constructor
  1039. is `low', and the second is `high', although both are optional.  The
  1040. last argument is always a generator.  Additional members allow you to
  1041. inspect and change `low' and `high'.  Random integers are generated
  1042. using `asInt()' or `asLong()'.  Operator syntax (`()') is also
  1043. available as a shorthand for `asLong()'.  Because `RandomInteger' is
  1044. often used in simulations for which uniform random integers are desired
  1045. over a variety of ranges, `asLong()' and `asInt' have `high' as an
  1046. optional argument.  Using this optional argument produces a single
  1047. value from the new range, but does not change the default range.
  1048.