Helper method to get a sum of values (sum will be calculated as an
integer)

@param slaveValues
@return
769412
protected static Integer sumAsInteger(final List<?> slaveValues) {
        int sum = 0;
        for (final Object slaveValue : slaveValues) {
            final Number value = (Number) slaveValue;
            if (value != null) {
                sum += value.intValue();
            }
        }
        return sum;
    }
1148318
@InterfaceAudience.Public
    public static double totalValues(List<Object> values) {
        double total = 0;
        for (Object object : values) {
            if (object instanceof Number) {
                Number number = (Number) object;
                total += number.doubleValue();
            } else {
                Log.w(Log.TAG_VIEW, "Warning non-numeric value found in totalValues: %s", object);
            }
        }
        return total;
    }
917555
public static double sum (double[] vector) {
        // Declare and initialize the accumulator:
        double total = 0.0;

        // Iterate over the vector:
        for (int i = 0; i < vector.length; i++) {
            total += vector[i];
        }

        // Done, return:
        return total;
    }
586117
public static int sum(int[] x) {
        double sum = 0.0;

        for (int n : x) {
            sum += n;
        }

        if (sum > Integer.MAX_VALUE || sum < -Integer.MAX_VALUE) {
            throw new ArithmeticException("Sum overflow: " + sum);
        }
        
        return (int) sum;
    }
1315838
public org.tensorflow.framework.Summary.ValueOrBuilder getValueOrBuilder(
      int index) {
    return value_.get(index);
  }
270735
public static Value.Builder makeValue(Iterable<Value> values) {
    return Value.newBuilder().setArrayValue(ArrayValue.newBuilder().addAllValues(values));
  }
1077311
public double sum() {
        return buckets_.stream()
                .mapToDouble(b -> b.getRange().getMidPoint() * b.getEvents())
                .sum();
    }
341890
@Override
    public double getValue(IntDoubleVector params) {
        double sum = 0.0;
        for (int i=0; i<numParams; i++) {
            sum += Math.abs(params.get(i));
        }
        return - lambda * sum;
    }
603443
public Collection<SingularitySlave> getSlaves(Optional<MachineState> slaveState) {
    final Function<String, String> requestUri = (host) -> String.format(SLAVES_FORMAT, getApiBase(host));

    Optional<Map<String, Object>> maybeQueryParams = Optional.absent();

    String type = "slaves";

    if (slaveState.isPresent()) {
      maybeQueryParams = Optional.of(ImmutableMap.of("state", slaveState.get().toString()));

      type = String.format("%s slaves", slaveState.get().toString());
    }

    return getCollectionWithParams(requestUri, type, maybeQueryParams, SLAVES_COLLECTION);
  }
784350
public function merge($pk, array $rows, $alias, $slaveTable, $slaveColumnId)
    {
        foreach ($rows as &$row) {
            // Extra check
            if (isset($row[$pk])) {
                $value = $row[$pk];

                // Prepare slave set
                $slaveSet = $this->querySlaveTable($slaveTable, $slaveColumnId, $value);
                $slaveSet = $this->getResultSetWithoutSlaveColumnId($slaveSet, $slaveColumnId);

                $row[$alias] = $slaveSet;
            }
        }

        return $rows;
    }
173086
@VisibleForTesting
	@SuppressWarnings("unchecked")
	@Override
	public int numKeyValueStateEntries() {
		int sum = 0;
		for (StateSnapshotRestore state : registeredKVStates.values()) {
			sum += ((StateTable<?, ?, ?>) state).size();
		}
		return sum;
	}
871166
public static double sum(Collection<? extends Number> values) {
        double sum = 0d;
        for (Number n : values)
            sum += n.doubleValue();
        return sum;
    }
815068
def sum(self, values):
        
        values = sorted(values)
        try:
            return (values[-1] - values[0]).total_seconds()
        except IndexError, TypeError:
            return 0
1329534
public static BigInteger sum (BigInteger zero, Iterable<? extends BigInteger> values)
    {
        for (BigInteger value : values) {
            zero = zero.add(value);
        }
        return zero;
    }
1000541
@Override
    public <N extends Number> Expression<N> sum(Expression<N> arg0)
    {
        // TODO Auto-generated method stub
        return null;
    }
627972
public static Object sum(Object[] self, Object initialValue) {
        return sum(toList(self), initialValue, false);
    }
493330
public synchronized int getSignedValue(int from, int to) {
        try {
            // is synchronized so that values of bitSet and calculated can be
            // lazily
            // calculated and safely published (thread safe).
            SixBit.convertSixBitToBits(message, padBits, bitSet, calculated, from, to);
            return (int) SixBit.getSignedValue(from, to, bitSet);
        } catch (SixBitException e) {
            throw new AisParseException(e);
        }
    }