Recalculate the object id
542321
private function updateOID() {
    $pkValues = [];
    // collect the values of the primary keys and compose the oid from them
    $pkNames = $this->getMapper()->getPkNames();
    foreach ($pkNames as $pkName) {
      $pkValues[] = self::getValue($pkName);
    }
    $this->oid = new ObjectId($this->getType(), $pkValues);
  }
959178
def update(self, obj, size):
        '''
        '''
        self.number += 1
        self.total  += size
        if self.high < size:  # largest
           self.high = size
           try:  # prefer using weak ref
               self.objref, self.weak = Weakref.ref(obj), True
           except TypeError:
               self.objref, self.weak = obj, False
1181503
def delete_object(self, id):
        """"""
        return self.request(
            "{0}/{1}".format(self.version, id), method="DELETE"
        )
1050614
def _reload(self, object, description, data):
        ''''''
        self._object = object
        self._description = description
        self._data = data
753377
def _ensure_object_id(cls, id):
        """"""
        if isinstance(id, ObjectId):
            return id

        if isinstance(id, basestring) and OBJECTIDEXPR.match(id):
            return ObjectId(id)

        return id
1266683
public int incrementAndGet(T obj) {
        int prev, next;
        do {
            prev = get(obj);
            next = prev + 1;
        } while (!compareAndSet(obj, prev, next));
        return next;
    }
1206732
def obj_id_expanded(obj=None, size=99):
    
    return "{}|{}|{}{}".format(os.uname()[1], os.getppid(), os.getpid(), "" if obj is None else "|" + str(id(obj))[-size:])
1051359
def get(cls, id):
        '''  '''

        if not id:
            return None

        redis = cls.get_redis()
        key = '{}:{}:obj'.format(cls.cls_key(), id)

        if not redis.exists(key):
            return None

        obj = cls(id=id)
        obj._persisted = True

        data = debyte_hash(redis.hgetall(key))

        for fieldname, field in obj.proxy:
            value = field.recover(data, redis)

            setattr(
                obj,
                fieldname,
                value
            )

        return obj
1069479
function updateObjectImpl(obj, update, isSelected) {
  if (isSelected(obj)) {
    return update(obj);
  }
  var result = obj;
  var changed = false;
  _lodash2.default.forOwn(obj, function (val, key) {
    var newval = updateValue(val, update, isSelected);
    if (newval === val) {
      return;
    }
    if (!changed) {
      result = _extends({}, obj);
      changed = true;
    }
    result[key] = newval;
  });
  return result;
}
61355
function at(o, pos) {
  // number recalculation (don't bother converting to SVG.Number for performance reasons)
  return typeof o.from == 'number' ?
    o.from + (o.to - o.from) * pos :

  // instance recalculation
  o instanceof SVG.Color || o instanceof SVG.Number || o instanceof SVG.Matrix ? o.at(pos) :

  // for all other values wait until pos has reached 1 to return the final value
  pos < 1 ? o.from : o.to
}
133796
function ___GEN_OBJECT_ID(initTime=null) {
	const time	= initTime || Math.floor(Date.now()/1000);
	const pid	= PID;
	const inc	= (SEQ_NUMBER=(SEQ_NUMBER+1) % 0xffffff);



	const buffer = new DataView(new ArrayBuffer(12));
	
	// NOTE: Fill in the id information
	// NOTE: Following statements' order should not be modified!
	buffer.setUint32(8, inc, false);		// [9-11] seq
	buffer.setUint16(7, pid, false);		// [7-8] pid
	buffer.setUint32(3, MACHINE_ID, false);	// [4-6] machine id
	buffer.setUint32(0, time, false);		// [0-3] epoch time
	
	return buffer.buffer;
}
374218
function update (obj1, obj2) {
  Object.keys(obj2).forEach(function (prop) {
    obj1[prop] = obj2[prop];
  });
  return obj1;
}
1161312
function(obj) {
      if (obj == null) return void 0;
      return this._byId[obj.id != null ? obj.id : obj] || this._byCid[obj.cid || obj];
    }
851663
def restore_ids(cls, obj, ids):
        
        ids = iter(ids)
        obj.traverse(lambda o: setattr(o, 'id', next(ids)))
394711
def recalculate(self):
        
        # recalculate the scene geometry
        scene = self.scene()
        w = self.calculateSceneWidth()
        scene.setSceneRect(0, 0, w, self.height())
        
        # recalculate the item layout
        spacing = self.spacing()
        x = self.width() / 4.0
        y = self.height() / 2.0
        for item in self.items():
            pmap = item.pixmap()
            item.setPos(x, y - pmap.height() / 1.5)
            x += pmap.size().width() + spacing
780684
def increment_counter(self, id, counter_name, increment=1,
                          id_name='id', **kwargs):
        
        response = self._new_response()
        if self._check_supported_op('increment_counter', response):
            params = {
                'Key': {id_name: id},
                'UpdateExpression': 'set #ctr = #ctr + :val',
                'ExpressionAttributeNames': {"#ctr": counter_name},
                'ExpressionAttributeValues': {
                    ':val': decimal.Decimal(increment)},
                'ReturnValues': 'UPDATED_NEW'
            }
            self._call_ddb_method(self.table.update_item, params, response)
            if response.status == 'success':
                if 'Attributes' in response.raw_response:
                    self._replace_decimals(response.raw_response)
                    attr = response.raw_response['Attributes'][counter_name]
                    response.data = attr
        response.prepare()
        return response
634215
private void reorder()
    {
        if(getTransaction().isOrdering() && needsCommit && mhtObjectEnvelopes.size() > 1)
        {
            ObjectEnvelopeOrdering ordering = new ObjectEnvelopeOrdering(mvOrderOfIds, mhtObjectEnvelopes);
            ordering.reorder();
            Identity[] newOrder = ordering.getOrdering();

            mvOrderOfIds.clear();
            for(int i = 0; i < newOrder.length; i++)
            {
                mvOrderOfIds.add(newOrder[i]);
            }
        }
    }