Atomically adds the given value to the current value of the field of
the given object managed by this updater.

@param obj An object whose field to get and set
@param delta the value to add
@return the previous value
503950
public long getAndAdd(T obj, long delta) {
        long prev, next;
        do {
            prev = get(obj);
            next = prev + delta;
        } while (!compareAndSet(obj, prev, next));
        return prev;
    }
357190
public static Object getFieldValue(Field field, Object obj) {
    try {
      return field.get(obj);
    } catch (IllegalAccessException e) {
      throw new IllegalArgumentException(e);
    }
  }
907537
def get_and_add(self, delta):
        '''
        
        '''
        with self._reference.get_lock():
            oldval = self._reference.value
            self._reference.value += delta
            return oldval
16271
static Map<String, Object> sumOfDelta(Map<String, Object> state, Map<String, Object> delta) {
        InstanceKey instanceId = (InstanceKey) delta.get("InstanceKey");
        if (instanceId == null) {
            throw new RuntimeException("InstanceKey can not be null");
        }
        for (String key : delta.keySet()) {
            Object existing = state.get(key);
            Object current = delta.get(key);
            if (current instanceof Number) {
                if (existing == null) {
                    existing = 0;
                }
                Number v = (Number) existing;
                Number d = (Number) delta.get(key);
                state.put(key, v.longValue() + d.longValue());
            } else if (current instanceof NumberList) {
                if (existing == null) {
                    state.put(key, current);
                } else {
                    state.put(key, ((NumberList) existing).sum((NumberList) current));
                }
            } else {
                Object o = delta.get(key);
                if (o instanceof String[]) {
                    String[] vs = (String[]) o;
                    if (vs.length == 1) {
                        Object previousAggregateString = state.get(key);
                        if (previousAggregateString instanceof AggregateString) {
                            state.put(key, ((AggregateString) previousAggregateString).update(null, vs[0], instanceId));
                        } else {
                            state.put(key, AggregateString.create(vs[0], instanceId));
                        }
                    } else {
                        // it should always be AggregateString here since that's all we add above
                        AggregateString pas = (AggregateString) state.get(key);
                        state.put(key, pas.update(vs[0], vs[1], instanceId));
                    }
                } else {
                    state.put(key, String.valueOf(o));
                }

            }
        }
        return state;
    }
663173
public static final void setValue(Object obj, String fieldName, 
            Object value) {
        try {
            getField(obj.getClass(), fieldName).set(obj, value);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
1213973
public boolean add(T obj) {
        if(obj == null) return false;
        while(size() >= max_capacity && size() > 0) {
            poll();
        }
        return super.add(obj);
    }
694118
@SuppressWarnings("unchecked")
    public static NumberList delta(Map<String, Object> currentMap, NumberList previousMap) {
        return delta(currentMap, (Map)previousMap.numbers);
    }
90874
public EKBCommit addUpdate(Object update) {
        if (update != null) {
            checkIfModel(update);
            updates.add((OpenEngSBModel) update);
        }
        return this;
    }
832057
public int lookupIndex(float value, float delta) {
        for (int i=0; i<size; i++) {
            if (Primitives.equals(elements[i + start], value, delta)) {
                return i;
            }
        }
        return -1;
    }
672423
public static void setFieldValue(Field field, Object obj, Object value) {
    if (Modifier.isFinal(field.getModifiers())) {
      Object finalValue = getFieldValue(field, obj);
      if (value == null ? finalValue != null : !value.equals(finalValue)) {
        throw new IllegalArgumentException(
            "expected final value <"
                + finalValue
                + "> but was <"
                + value
                + "> on "
                + field.getName()
                + " field in "
                + obj.getClass().getName());
      }
    } else {
      try {
        field.set(obj, value);
      } catch (SecurityException e) {
        throw new IllegalArgumentException(e);
      } catch (IllegalAccessException e) {
        throw new IllegalArgumentException(e);
      }
    }
  }
1355088
public void update(int delta) {
		emitter.updateParticle(this, delta);
		life -= delta;
		
		if (life > 0) {
			x += delta * velx;
			y += delta * vely;
		} else {
			engine.release(this);
		}
	}
1349766
@MainThread
    public void change(T obj) {
        if (!isLockEnabled) {
            throw new RuntimeException("changing of values only cen be performed in locked state");
        }

        modifiedValue = obj;
        notifyInMainThread(modifiedValue);
    }
514878
@Override
    public boolean updateValuesForField(String currentValue) {
        boolean bUpdated = false;
        FieldDefinition fieldDef = m_tableDef.getFieldDef(m_fieldName);
        if (fieldDef == null || !fieldDef.isCollection()) {
            bUpdated = updateSVScalar(currentValue);
        } else {
            bUpdated = updateMVScalar(currentValue);
        }
        return bUpdated;
    }
1148769
def delta(self, fromdate, todate):
        '''
        
        '''
#CONSIDER: raise an exception if a date is not in self
        return self.index(todate) - self.index(fromdate)
166586
@Override
  public void update(Object obj) {
    lock.writeLock().lock();
    try {
      populated = true;
      this.queueActionLocked(DeltaType.Updated, obj);
    } finally {
      lock.writeLock().unlock();
    }
  }
1344657
def get_and_add(self, delta):
        '''
        
        '''
        with self._lock.exclusive:
            oldval = self._value
            self._value += delta
            return oldval
1280292
public int addAndGetLo(int delta) {
        while (true) {
            long encoded = get();
            int lo = getLo(encoded) + delta;
            long update = encodeLo(encoded, lo);
            if (compareAndSet(encoded, update))
                return lo;
        }
    }