util.intervals - ICE 0.1 API documentation

ICE 0.1 API documentation

# util.intervals

struct Interval(T,char L,char R) if (isNumeric!(T) && (L == '(' || L == '<') && (R == ')' || R == '>'));

  Inteval of specified number type.

  Parameters:

  T | Number type of the interval.
  L | If '(', the interval is open from the left. If '<', it is closed.
  R | If ')', the interval is open from the right. If '>', it is closed.

  T min;

    Minimum extent of the interval.

  T max;

    Maximum extent of the interval.

  this(const T min, const T max);

    Construct an interval with specified extents.

  const bool contains(const T value);

    Determine if the interval contains specified value.

struct IntervalsLinear(T,char L = '<',char R = ')');

  Foreachable range of intervals of equal size between specified min and max values.

  Example:

       // Generates intervals <128, 144), <144, 160), ... , <240, 256)
       foreach(interval; IntervalsLinear!uint(16, 128, 256))
       {
           //Do something with the interval
       }

  Parameters:

  T | Number types of the intervals.
  L | If '(', the intervals are open from the left. If '<', they are closed.
  R | If ')', the intervals are open from the right. If '>', they are closed.

  T end;

    End of the last interval.

  T step;

    Size of the intervals.

  this(const T step, const T min, const T max);

    Construct IntervalsLinear generating intervals step wide from min to max.

    Parameters:

    T step | Width of the intervals.
    T min | Beginning of the first interval.
    T max | End of the last interval. Width of the last interval might be lower than step to avoid going past this value.

  const bool empty();

    Is the interval range empty? (Done iterating).

  void popFront();

    Advance the range to the text interval.

  const Interval!(T,L,R) front();

    Get the current interval from the range.

struct IntervalsPowerOfTwo(T,char L = '<',char R = ')');

  Foreachable range of intervals between powers-of-two from 0 to specified size.

  Example:

       // Generates intervals <0, 1), <1, 2), <2, 4), ... , <128, 256)
       foreach(interval; IntervalsPowerOfTwo!uint(256))
       {
           //Do something with the interval
       }

  Parameters:

  T | Number types of the intervals.
  L | If '(', the intervals are open from the left. If '<', they are closed.
  R | If ')', the intervals are open from the right. If '>', they are closed.

  T start;

    Start of the first interval.

  T end;

    End of the last interval.

  this(const T max);

    Construct IntervalsPowerOfTwo generating intervals from 0 to max.

    Parameters:

    T max | End of the last interval. The last interval will end at this value.

  const bool empty();

    Is the interval range empty? (Done iterating).

  void popFront();

    Advance the range to the text interval.

  const Interval!(T,L,R) front();

    Get the current interval from the range.

Copyright © Ferdinand Majerech 2011. | Page generated by AutoDDoc and Ddoc.