private method to account for
495464
def range_correct_index( at )
      index = at
#      index = self.length + at if at < 0
      raise "index not integer #{at.class}" unless at.is_a?(::Integer)
      raise "index must be positive , not #{at}" if (index < 0)
      raise "index too large #{at} > #{self.length}" if (index >= self.length )
      return index + 11
    end
584893
public void accumulate(AverageData data,
                           Object value) {
        if (value != null) {
            data.count++;
            data.total += ( (Number) value ).doubleValue();
        }
    }
680321
@Override
  public final void sample()
  {
    synchronized (_lock) {
      long count = _count.get();
      long lastCount = _lastAvgCount;
      _lastAvgCount = count;

      long sum = _sum.get();
      double lastSum = _lastAvgSum;
      _lastAvgSum = sum;

      if (count == lastCount)
        _value = 0;
      else
        _value = _scale * (sum - lastSum) / (double) (count - lastCount);
    }
  }
1054472
def increment(self, attr, amount=1):
        
        return self.set(attr, operation.Increment(amount))
531448
def accumulate(self, buf):
        ''''''
        accum = self.crc
        for b in buf:
            tmp = b ^ (accum & 0xff)
            tmp = (tmp ^ (tmp<<4)) & 0xFF
            accum = (accum>>8) ^ (tmp<<8) ^ (tmp<<3) ^ (tmp>>4)
        self.crc = accum
898769
function incrby(key, amount, req) {
  var val = utils.strtoint(this.getKey(key, req));
  amount = utils.strtoint(amount);
  val += amount;
  this.setKey(key, val, undefined, undefined, undefined, req);
  return val;
}
250808
function wrapCountingMethod(method) {
  DruidNode.prototype[method] = function() {
    var self = this
      , args = utils.args(arguments, 0)
      , callback = args.pop()

    self.active++

    debug('Active calls to Druid node ' + this.data.id + ': ' + this.active)

    function wrapper() {
      self.active--

      callback.apply(null, arguments)
    }

    args.push(wrapper)

    Client.prototype[method].apply(this, args)
  }
}
721965
function (plus, minus) {
    var out = {}, i;

    for (i in plus) {
      if (plus.hasOwnProperty(i) && plus[i] !== minus[i]) {
        out[i] = plus[i];
      }
    }

    return out;
  }
950275
def constant(name, value = name)
      value = value.freeze rescue value
      define_method(name) { value }
    end
965551
@Ensures({
    "contextLocal >= 0",
    "checkInvariantsLocal >= 0"
  })
  protected void enterContractedMethod() {
    contextLocal = newLocal(CONTRACT_CONTEXT_TYPE);
    checkInvariantsLocal = newLocal(Type.BOOLEAN_TYPE);
    invokeStatic(CONTRACT_RUNTIME_TYPE, GET_CONTEXT_METHOD);
    dup();
    storeLocal(contextLocal);
    if (statik) {
      loadThisClass();
    } else {
      loadThis();
    }
    invokeVirtual(CONTRACT_CONTEXT_TYPE, TRY_ENTER_METHOD);
    storeLocal(checkInvariantsLocal);
  }
63382
def reserved(self, value):
        """"""
        self.bytearray[self._get_slicers(2)] = bytearray(c_uint16(value or 0))
5491
def _call(self, x):
        """"""
        return sum(fi(xi) for xi, fi in zip(x, self.functionals))
1200402
def constant(self, name, value):
        """"""
        assert is_iterable_typed(name, basestring)
        assert is_iterable_typed(value, basestring)
        self.registry.current().add_constant(name[0], value)
340214
public static void normalize2Prop(float[] c) {
		float sum = sum(c);
		
		if (sum == 0)
			return;
		for (int i = 0; i < c.length; i++) {
			c[i] = c[i] / sum;
		}
	}
369109
private void accumulateFunctionBinding( AccumulateDescrBuilder< ? > accumulate ) throws RecognitionException {
        String label = null;
        boolean unif = false;
        if (input.LA(2) == DRL6Lexer.COLON) {
            label = label(DroolsEditorType.IDENTIFIER_VARIABLE);
        } else if (input.LA(2) == DRL6Lexer.UNIFY) {
            label = unif(DroolsEditorType.IDENTIFIER_VARIABLE);
            unif = true;
        }
        accumulateFunction( accumulate,
                            unif,
                            label );
    }
61212
public void accumulate(Object workingMemoryContext,
                           Object context,
                           Tuple tuple,
                           InternalFactHandle handle,
                           Declaration[] declarations,
                           Declaration[] innerDeclarations,
                           WorkingMemory workingMemory) throws Exception {
        Object[]  localVars = ((MVELAccumulatorContext) context).getVariables();
        MVELAccumulatorFactoryContext factoryContext = (MVELAccumulatorFactoryContext)workingMemoryContext;
        VariableResolverFactory factory = factoryContext.getActionFactory();
        actionUnit.updateFactory( handle, tuple, localVars, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver(), factory );

        DroolsVarFactory df = ( DroolsVarFactory ) factory.getNextFactory();
        
        if ( reverse != null ) {
            Object[] shadow = new Object [df.getOtherVarsPos()];
            for ( int i = 0; i < df.getOtherVarsPos(); i++ ) {
                shadow[i] = factory.getIndexedVariableResolver( i ).getValue();
                
                
            }
            // SNAPSHOT variable values
            ((MVELAccumulatorContext) context).getShadow().put( handle.getId(), shadow);
        }
        MVELSafeHelper.getEvaluator().executeExpression( this.action,
                                null,
                                factory );
        
        
        if ( localVars.length > 0 ) {
            for ( int i = 0; i < df.getOtherVarsLength(); i++ ) {
                localVars[i] = factory.getIndexedVariableResolver( df.getOtherVarsPos() + i ).getValue();
            }
        }
        
        ((MVELAccumulatorContext) context).setVariables( localVars );        
    }
822751
def main(self, x):
        
        self.acc[0] = x * self.TAPS[-1]
        for i in range(1, len(self.acc)):
            self.acc[i] = self.acc[i - 1] + x * self.TAPS[len(self.TAPS) - 1 - i]

        self.out = self.acc[-1]
        return self.out