pike.git / lib / modules / __builtin.pmod / Range.pike

version» Context lines:

pike.git/lib/modules/__builtin.pmod/Range.pike:73:   protected int(0..1) `<(mixed that) {    return from < ([object]that)->from    || from == ([object]that)->from && till < ([object]that)->till;   }      protected int(0..1) `==(mixed that) {    return objectp(that)    && from == ([object]that)->from && till == ([object]that)->till;   }    + //! @returns + //! Calculates the value of the interval: @expr{till - from@}. + mixed interval() { +  return till - from; + } +    //! Casting a range to string delivers an SQL-compliant value.   protected mixed cast(string to) {    if (to == "string")    return from >= till ? "empty" : sprintf("%c%s,%s)",    from == -Math.inf ? '(' : '[', from == -Math.inf ? "" : (string)from,    till == Math.inf ? "" : (string)till);    return UNDEFINED;   }      protected string _sprintf(int fmt, mapping(string:mixed) params) {    switch (fmt) {    case 'O': return sprintf("this_program( %s )", (string)this);    case 's': return (string)this;    }    return sprintf(sprintf("%%*%c", fmt), params, 0);   }