Used by hashUpdate()
775203
private final void resizeClean() {
    //must resize, but are we at tgt size?
    final int lgTgtLongs = lgNomLongs_ + 1;
    if (lgTgtLongs > lgArrLongs_) {
      //not yet at tgt size
      final ResizeFactor rf = getResizeFactor();
      final int lgDeltaLongs = lgTgtLongs - lgArrLongs_; //must be > 0
      final int lgResizeFactor = max(min(rf.lg(), lgDeltaLongs), 1); //rf_.lg() could be 0
      forceResizeCleanCache(lgResizeFactor);
    }
    else {
      //at tgt size or larger, no dirty values, must take drastic measures, very rare.
      forceResizeCleanCache(1);
    }
  }
608861
def update(self, byts):
        '''
        
        '''
        self.size += len(byts)
        [h[1].update(byts) for h in self.hashes]
1292417
public void update(final int[] data) {
    if ((data == null) || (data.length == 0)) { return; }
    final long[] arr = hash(data, seed);
    hashUpdate(arr[0], arr[1]);
  }
882193
function useHash(hashString) {
    window.location.hash = hashString;
    readHash();
    setSliders();
    updateDisplay();
    distorter.run();
  }
28804
@Override
    public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents) {
        final String methodName = "batchUpdate()";
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called");
        }
    }
1206469
static void mergeUpdate(HashMappedList rowSet, Row row, Object[] newData,
                            int[] cols) {

        Object[] data = (Object[]) rowSet.get(row);

        if (data != null) {
            for (int j = 0; j < cols.length; j++) {
                data[cols[j]] = newData[cols[j]];
            }
        } else {
            rowSet.add(row, newData);
        }
    }
474017
public boolean hasHandled() {
    for(int i = 0; i < getNumEntries(); i++) {
      boolean handled = getEntry(i).hasHandled();
      if(handled) {
        return true;
      }
    }
    return false;
  }
401614
function () {
            var callbacks = this._hashChangeCallbacks, cb;
            if (callbacks == null) {
                return;
            }
            this._currentHashString = this.getHashString();
            var currentHashObject = this._extractHashObject(this._currentHashString);
            for (var i = 0, size = callbacks.length; size > i; i++) {
                cb = callbacks[i];
                cb = this.$normCallback(cb);
                this.$callback(cb, currentHashObject);
            }
        }
30799
private void rehash()
                    throws IOException,
                    EOFException,
                    FileManagerException,
                    ClassNotFoundException,
                    HashtableOnDiskException {
        int size = (header.tablesize() * 2) + 1;
        if (this.tempTableSize > size) {
            doRehash(this.tempTableSize);
            this.tempTableSize = 0;
        } else {
            doRehash(size);
        }
    }
244510
int walkHash(HashtableAction action, int retrieveMode, int index, int length)
                    throws IOException,
                    EOFException,
                    FileManagerException,
                    ClassNotFoundException,
                    HashtableOnDiskException {
        iterationLock.p();

        int tindex = -1;

        int tableSize = header.tablesize();
        //System.out.println("*** table size= " + tableSize + " index=" + index  + " length=" + length);

        try {
            for (int i = index, j = 0; i < tableSize; i++) {
                //
                // We want to drop the lock between each iteration so that other
                // threads can continue to work
                //
                boolean result = true;
                synchronized (this) {
                    long location = getHtindex(i, header.currentTableId());
                    long previous = 0;
                    long next = 0;
                    int hash = 0;
                    initReadBuffer(location);
                    next = headerin.readLong();
                    hash = headerin.readInt();

                    while (location != 0) {
                        HashtableEntry e = readEntry2(location, next, hash, previous, retrieveMode, !CHECK_EXPIRED, header.currentTableId(), null, null);
                        if (e != null) {
                            j++;
                            try {
                                Object id = e.getKey();
                                result = action.execute(e);
                                // if result is false, do not continue
                                if (result == false) { // LI4337-17
                                    traceDebug("walkHash()", "cacheName=" + this.htoddc.cacheName + " id=" + id + " action.execute() returns false.");
                                    break;
                                }
                            } catch (Exception xcp) {
                                throw new HashtableOnDiskException("HashtableAction: " + xcp.toString());
                            }
                            previous = location;
                            location = next;
                            if (location != 0) {
                                initReadBuffer(location);
                                next = headerin.readLong();
                                hash = headerin.readInt();
                            }
                        }
                    }
                    // if result is false, do not continue
                    if (result == false) { // LI4337-17
                        break;
                    }
                    if (j >= length) {
                        tindex = i + 1;
                        break;
                    }
                }
            }
        } finally {
            iterationLock.v();
        }
        if (tindex == -1) {
            tindex = tableSize;
        }
        //System.out.println("*** HTOD return index=" + tindex + " tableSize=" + tableSize);
        return tindex;
    }
1004536
function update(instance, array, tx, callback) {
    var
        model = instance.__model,
        beforeUpdate = model.__beforeUpdate,
        updates,
        params,
        sql;
    if (beforeUpdate) {
        beforeUpdate(instance);
    }
    if (!array) {
        array = model.__updateAttributesArray;
    }
    updates = _.map(array, function (attr) {
        return '`' + attr + '`=?';
    });
    params = _.map(array, function (attr) {
        return instance[attr];
    });
    params.push(instance[model.__primaryKey]);
    sql = utils.format('update `%s` set %s where `%s`=?', model.__table, updates.join(', '), model.__primaryKey);
    smartRunSQL(model.__pool, sql, params, tx, function (err, result) {
        if (err) {
            return callback(err);
        }
        callback(null, instance);
    });
}
1134063
synchronized long userUpdate(long value) {

        if (value == currValue) {
            currValue += increment;

            return value;
        }

        if (increment > 0) {
            if (value > currValue) {
                currValue += ((value - currValue + increment) / increment)
                             * increment;
            }
        } else {
            if (value < currValue) {
                currValue += ((value - currValue + increment) / increment)
                             * increment;
            }
        }

        return value;
    }
1122013
function _update(s, w, bytes) {
  // consume 512 bit (64 byte) chunks
  var t, a, b, c, d, f, r, i;
  var len = bytes.length();
  while(len >= 64) {
    // initialize hash value for this chunk
    a = s.h0;
    b = s.h1;
    c = s.h2;
    d = s.h3;

    // round 1
    for(i = 0; i < 16; ++i) {
      w[i] = bytes.getInt32Le();
      f = d ^ (b & (c ^ d));
      t = (a + f + _k[i] + w[i]);
      r = _r[i];
      a = d;
      d = c;
      c = b;
      b += (t << r) | (t >>> (32 - r));
    }
    // round 2
    for(; i < 32; ++i) {
      f = c ^ (d & (b ^ c));
      t = (a + f + _k[i] + w[_g[i]]);
      r = _r[i];
      a = d;
      d = c;
      c = b;
      b += (t << r) | (t >>> (32 - r));
    }
    // round 3
    for(; i < 48; ++i) {
      f = b ^ c ^ d;
      t = (a + f + _k[i] + w[_g[i]]);
      r = _r[i];
      a = d;
      d = c;
      c = b;
      b += (t << r) | (t >>> (32 - r));
    }
    // round 4
    for(; i < 64; ++i) {
      f = c ^ (b | ~d);
      t = (a + f + _k[i] + w[_g[i]]);
      r = _r[i];
      a = d;
      d = c;
      c = b;
      b += (t << r) | (t >>> (32 - r));
    }

    // update hash state
    s.h0 = (s.h0 + a) | 0;
    s.h1 = (s.h1 + b) | 0;
    s.h2 = (s.h2 + c) | 0;
    s.h3 = (s.h3 + d) | 0;

    len -= 64;
  }
}
394038
@Override
    public void applyUpdate(StepFunction function, INDArray params, INDArray updates, double alpha) {
        try {
            // nullify given updates first
            Nd4j.getMemoryManager().memset(updates);
            //updates.assign(0.0);

            int cnt = 0;
            while (!messages.get(index.get()).isEmpty()) {
                INDArray compressed = messages.get(index.get()).poll();

                int encoding = compressed.data().getInt(3);
                if (encoding == ThresholdCompression.FLEXIBLE_ENCODING)
                    Nd4j.getExecutioner().thresholdDecode(compressed, updates);
                else if (encoding == ThresholdCompression.BITMAP_ENCODING)
                    Nd4j.getExecutioner().bitmapDecode(compressed, updates);
                else
                    throw new DL4JInvalidConfigException("Unknown compression header received: " + encoding);

                cnt++;
            }

            if (cnt > 0 && isDebug)
                log.info("Local updates to be applied: {}", cnt);

            if (externalSource != null) {
                int ent = 0;
                if (externalSource.hasAnything()) {
                    externalSource.drainTo(updates);

                    cnt++;
                    ent++;
                }

                if (ent > 0 && isDebug)
                    log.info("External updates to be applied: {}", ent);
            }

            synchronize(currentConsumers.get(), true);

            // TODO: average updates? might have sense

            if (cnt > 0)
                function.step(params, updates, alpha);
        } catch (Exception e) {
            throwable.setIfFirst(e);
            throw new RuntimeException(e);
        }
    }
121078
protected void updated()
    {
        if (remaining < 0 && remaining > capacity)
        {
            throw new IllegalArgumentException(remaining+" illegal remaining at %s"+toString());
        }
        if (marked < 0 && marked > capacity)
        {
            throw new IllegalArgumentException(marked+" illegal marked at %s"+toString());
        }
    }
128025
@Override
	public int doUpdate(final SqlContext sqlContext, final PreparedStatement preparedStatement, final int result) {
		LOG.debug("SQL:{} executed. Count:{} items.", sqlContext.getSqlName(), result);
		return result;
	}
1079664
def update(hash)
      shash = {}
      hash.each do |key, value|
        shash[@serializer.key_for(key)] = value
      end
      @journal << shash
      @table.update(shash)
      self
    end