Perform the addition of the two top values on the data stack in the given
DMLContext. This method will handle long, double, and string values.
Exceptions are thrown if the types of the arguments do not match or they
are another type.
7568
@Override
	public Element execute(Context context) {

		try {
			Element[] args = calculateArgs(context);
			Property a = (Property) args[0];
			Property b = (Property) args[1];
			return execute(sourceRange, a, b);
		} catch (ClassCastException cce) {
			throw new EvaluationException(MessageUtils
					.format(MSG_INVALID_ARGS_ADD), sourceRange);
		}
	}
815405
public void add( int row , int col , double value ) {
        if( col < 0 || col >= numCols || row < 0 || row >= numRows ) {
            throw new IllegalArgumentException("Specified element is out of bounds");
        }

        data[ row * numCols + col ] += value;
    }
781105
@SuppressWarnings("unchecked")
  public static <T> T add(T op1, T op2) {
    if (op1.getClass() != op2.getClass()) {
      throw new RuntimeException("Arguments of different classes: " + op1 + " " + op2);
    }

    if (Byte.class.isInstance(op1)) {
      return (T)(Byte)(byte)(((Byte) op1).byteValue() + ((Byte) op2).byteValue());
    }
    if (Short.class.isInstance(op1)) {
      return (T)(Short)(short)(((Short) op1).shortValue() + ((Short) op2).shortValue());
    }
    if (Character.class.isInstance(op1)) {
      return (T)(Character)(char)(((Character) op1).charValue() + ((Character) op2).charValue());
    }
    if (Integer.class.isInstance(op1)) {
      return (T)(Integer)(((Integer) op1).intValue() + ((Integer) op2).intValue());
    }
    if (Float.class.isInstance(op1)) {
      return (T)(Float)(((Float) op1).floatValue() + ((Float) op2).floatValue());
    }
    if (Long.class.isInstance(op1)) {
      return (T)(Long)(((Long) op1).longValue() + ((Long) op2).longValue());
    }
    if (Double.class.isInstance(op1)) {
      return (T)(Double)(((Double) op1).doubleValue() + ((Double) op2).doubleValue());
    }

    throw new UnsupportedOperationException("Invalid for arbitrary types: " + op1 + " " + op2);
  }
104924
public void addNextValue(Object val) {
    long newVal = Long.parseLong(val.toString());
    if (this.maxVal < newVal) {
      this.maxVal = newVal;
    }
  }
675058
public Datapoint addDoubleValue(long time, double value) {
        initialValues();
        checkType(TsdbConstants.TYPE_DOUBLE);

        values.add(Lists.<JsonNode> newArrayList(new LongNode(time), new DoubleNode(value)));
        return this;
    }
1283046
private void appendValue(Object value) {
        if (value instanceof Boolean) {
            closeTag();
            append(value.toString());
        } else if (value instanceof Number) {
            closeTag();
            append(value.toString());
        } else if (value instanceof String) {
            closeTag();
            escape((String) value);
        } else if (value instanceof MwsObject) {
            ((MwsObject) value).writeFragmentTo(this);
        } else if (value instanceof Node) {
            closeTag();
            append(MwsUtl.toXmlString((Node) value));
        } else if (value instanceof Enum) {
            closeTag();
            append(((Enum<?>) value).toString());
        } else if (value instanceof XMLGregorianCalendar) {
            closeTag();
            append(((XMLGregorianCalendar) value).toXMLFormat());
        } else {
            throw new IllegalArgumentException();
        }
    }
531869
public void add(double value, double weight)
    {
        writeLock.lock();
        try
        {
            average.addDeg(value, weight);
            double fast = average.averageDeg();
            stats.accept(fast);
            check();
        }
        finally
        {
            writeLock.unlock();
        }
    }
122267
@SuppressWarnings("unchecked")
  public void add(T newValue) throws IOException {
    if (value instanceof Integer && newValue instanceof Integer) {
      value = (T) Integer.valueOf(value.intValue() + newValue.intValue());
    } else if (value instanceof Long && newValue instanceof Long) {
      value = (T) Long.valueOf(value.longValue() + newValue.longValue());
    } else if (value instanceof Float && newValue instanceof Float) {
      value = (T) Float.valueOf(value.floatValue() + newValue.floatValue());
    } else if (value instanceof Double && newValue instanceof Double) {
      value = (T) Double.valueOf(value.doubleValue() + newValue.longValue());
    } else {
      throw new IOException("incompatible NumberComparators");
    }
  }
637535
@Override
    public void add(double value, double weight)
    {
        writeLock.lock();
        try
        {
            average.add(value, weight);
            double fast = average.fast();
            min.accept(fast);
            max.accept(fast);
            check();
        }
        finally
        {
            writeLock.unlock();
        }
    }
940595
@Override
    public void resolve(final ValueStack values) throws Exception
    {
        if (values.size() < 2)
            throw new Exception("missing operands for " + toString());
        try
        {
            final double multiplier = Math.pow(10, values.popDouble());
            values.push(new Double(Math.round(values.popDouble() * multiplier) / multiplier));
        } catch (final ParseException e)
        {
            e.fillInStackTrace();
            throw new Exception(toString() + "; " + e.getMessage(), e);
        }
    }
8761
public void accumulate(Object workingMemoryContext,
                           Object context,
                           Tuple leftTuple,
                           InternalFactHandle handle,
                           Declaration[] declarations,
                           Declaration[] innerDeclarations,
                           WorkingMemory workingMemory) throws Exception {
        Object value = this.unwrapHandle ? ((LeftTuple) handle.getObject()).getFactHandle().getObject() : handle.getObject();
        ((CollectContext) context).result.add( value );
    }
827148
public void addValue(long newValue) {
    // keep a "total" timer for all values
    InApplicationMonitor.getInstance().addTimerMeasurement(timerName, newValue);

    // keep track of the current maximum value
    if (newValue > currentMaxValue) {
      currentMaxValue = newValue;
    }

    // select the bin to put this value in
    long binIndex;
    if (newValue > maxLimit) {
      binIndex = maxLimit / factor;
    } else {
      binIndex = newValue / factor;
    }

    // add the new value to the appropriate bin
    String binName = getBinName(binIndex);
    InApplicationMonitor.getInstance().incrementCounter(binName);
  }
1121080
public void push(final V value) throws IndexOutOfBoundsException {
        if (top + locals >= values.length) {
            throw new IndexOutOfBoundsException(
                    "Insufficient maximum stack size.");
        }
        values[top++ + locals] = value;
    }
150920
def add(self, value):
        """"""
        self._data.append(value)
        if len(self._data) > self._max_count:
            self._data.popleft()
        return sum(self._data)/len(self._data)
187165
public void add( T value ) {
        Lock lock = this.lock.writeLock();
        try {
            lock.lock();
            doAddValue(value);
        } finally {
            lock.unlock();
        }
    }
721670
public static double sum(final Iterable<Double> values) {
    double ret = 0.0;
    for (final double d : values) {
      ret += d;
    }
    return ret;
  }
691074
private void appendValue(Object value) {
        if (value == null) {
            append("null");
        } else if (value instanceof MwsObject) {
            append("{");
            needComma = false;
            ((MwsObject) value).writeFragmentTo(this);
            append("}");
        } else if (value instanceof Boolean || value instanceof Number) {
            append(value.toString());
        } else if (value instanceof String) {
            append("\"");
            escape((String) value);
            append("\"");
        } else if (value instanceof Node) {
            appendValue(MwsUtl.toXmlString((Node) value));
        } else if (value instanceof XMLGregorianCalendar) {
            append(((XMLGregorianCalendar) value).toXMLFormat());
        } else if (value instanceof Enum) {
            append(value.toString());
        } else {
            throw new IllegalArgumentException("Unsupported type "+value.getClass().getName());
        }
        needComma = true;
    }