Clip values to specified range

 @param [Range] range Allowed range of values.

 @return [Node] Array with clipped values.
185329
def clip( range = 0 .. 0xFF )
      if range.exclude_end?
        raise "Clipping does not support ranges with end value " +
              "excluded (such as #{range})"
      end
      collect { |x| x.major( range.begin ).minor range.end }
    end
1166337
def in_range?( val )
      val = val.to_i
      (@above.nil? or val > @above) and
        (@below.nil? or val < @below) and
        (@valid_range.nil? or @valid_range.include?(val))
    end
277476
function rangeToLines(range) {
    range = (range || '').split(':');
    if (range.length != 2) {
        return null;
    }

    return {
        start: Number(range[0]) - 1,
        end: Number(range[1]) - 1
    }
}
1349033
@SuppressWarnings("unchecked")
    public static List<Float> getAt(float[] array, Range range) {
        return primitiveArrayGet(array, range);
    }
230404
def range( initial = nil )
      min( initial ? initial.min : nil ) .. max( initial ? initial.max : nil )
    end
524214
def array_to_ranges(ar)
      prev = ar[0]

      ranges = ar.slice_before do |e|
        prev2 = prev
        prev = e
        prev2 + 1 != e
      end.map { |a| a[0]..a[-1] }

      ranges
    end
655595
public Range[] minus(Range that){
        Range split[] = split(that);
        if(split[0]==null && split[2]==null)
            return new Range[0];
        if(split[0]!=null && split[2]!=null)
            return new Range[]{ split[0], split[2] };

        return new Range[]{ split[0]!=null ? split[0] : split[2] };
    }
840335
function range(begin, end) {
  var interval = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];

  var a = [];

  for (var i = begin; i < begin + end; i += interval) {
    a.push(i);
  }

  return a;
}
1122218
def get_range_data(row_start, col_start, row_end, col_end) # :nodoc:
      # TODO. Check for worksheet limits.

      # Iterate through the table data.
      data = []
      (row_start .. row_end).each do |row_num|
        # Store nil if row doesn't exist.
        if !@cell_data_table[row_num]
          data << nil
          next
        end

        (col_start .. col_end).each do |col_num|
          if cell = @cell_data_table[row_num][col_num]
            data << cell.data
          else
            # Store nil if col doesn't exist.
            data << nil
          end
        end
      end

      return data
    end
1245184
@SuppressWarnings("unchecked")
    public static List<Boolean> getAt(boolean[] array, ObjectRange range) {
        return primitiveArrayGet(array, range);
    }
540540
def restrict(value, range)
      [[value, range.first].max, range.last].min
    end
1251320
def _parse_ranges(ranges):
    
    for txt in ranges:
        if '-' in txt:
            low, high = txt.split('-')
        else:
            low, high = txt, txt
        yield int(low), int(high)
116034
@Override
  public Collection<Range<T>> rangesOverlapping(final Range<T> queryRange) {
    final ImmutableSet.Builder<Range<T>> ret = ImmutableSet.builder();
    for (final Range<T> range : ranges) {
      if (range.isConnected(queryRange) && !range.intersection(queryRange).isEmpty()) {
        ret.add(range);
      }
    }
    return ret.build();
  }
548295
private function extractRange($range)
    {
        if (\preg_match('/^\d+$/', $range)) {
            return [$range, $range + 1];
        }

        $matches = [];
        if ($range !== '..' && \preg_match('/^(\d*)\.\.(\d*)$/', $range, $matches)) {
            $start = $matches[1] ? \intval($matches[1]) : 0;
            $end   = $matches[2] ? \intval($matches[2]) + 1 : PHP_INT_MAX;

            return [$start, $end];
        }

        throw new \InvalidArgumentException('Unexpected range: ' . $range);
    }
1023180
def intersection(self, range):
        
        if self.worksheet != range.worksheet:
            # Different worksheet
            return None
        start = (max(self._start[0], range._start[0]),
                 max(self._start[1], range._start[1]))
        end = (min(self._end[0], range._end[0]),
               min(self._end[1], range._end[1]))
        if end[0] < start[0] or end[1] < start[1]:
            return None
        return Range(start, end, self.worksheet, validate=False)
384556
def convert_clip(node, **kwargs):
    
    name, input_nodes, attrs = get_inputs(node, kwargs)

    a_min = np.float(attrs.get('a_min', -np.inf))
    a_max = np.float(attrs.get('a_max', np.inf))

    clip_node = onnx.helper.make_node(
        "Clip",
        input_nodes,
        [name],
        name=name,
        min=a_min,
        max=a_max
    )
    return [clip_node]
136479
def pop_range(self, start, stop, callback=None, withscores=True):
        ''''''
        s1 = self.pickler.dumps(start)
        s2 = self.pickler.dumps(stop)
        backend = self.backend
        res = backend.structure(self).pop_range(s1, s2, withscores=withscores)
        if not callback:
            callback = self.load_data if withscores else self.load_values
        return backend.execute(res, callback)