Update position of all records based on the position of
    the closest GPS record.

    .. note:: Use this function when call and text records are missing a
              location, but you have access to accurate GPS traces.
556006
def fix_location(records, max_elapsed_seconds=300):
    
    groups = itertools.groupby(records, lambda r: r.direction)
    groups = [(interaction, list(g)) for interaction, g in groups]

    def tdist(t1, t2):
            return abs((t1 - t2).total_seconds())

    for i, (interaction, g) in enumerate(groups):
        if interaction == 'in':
            continue

        prev_gps = groups[i-1][1][-1]
        next_gps = groups[i+1][1][0]

        for r in g:
            if tdist(r.datetime, prev_gps.datetime) <= max_elapsed_seconds:
                r.position = prev_gps.position
            elif tdist(r.datetime, next_gps.datetime) <= max_elapsed_seconds:
                r.position = next_gps.position
3196
private void setCurrentLocationToNextValidPosition(Point aLocation)    {
        // set latest location to next valid position
        int i, j;
        i = aLocation.x;
        j = aLocation.y;
        do {
            if ( (j + 1)  == columns ) {    // goto next row
                i++;
                j = 0;
            }
            else {
                j++;
            }
        }
        while (
        (i < rows.size()) && (j < columns) && (((Row) rows.get(i)).isReserved(j))
        );
        curPosition = new Point(i, j);
    }
961795
def insert_tracking_record(self):
        
        if self._insert_tracking_record is None:
            self._insert_tracking_record = self._prepare_insert(
                tmpl=self._insert_values_tmpl,
                placeholder_for_id=True,
                record_class=self.tracking_record_class,
                field_names=self.tracking_record_field_names,
            )
        return self._insert_tracking_record
889011
def setLocation(self, location):
        
        if not location or not isinstance(location, Location):
            raise ValueError("setLocation expected a Location object")
        self.x = location.x
        self.y = location.y
        return self
149946
public void updateLocation(int x, int y, int gravity){
		if(getParent() != null)
			updateParams(x, y, gravity, getLayoutParams());
        else
            Log.v(FloatingActionButton.class.getSimpleName(), "updateLocation() is called without parent");
	}
621418
def update_record(self, now, rec):
        """"""
        for listener in self.listeners:
            listener.update_record(self, now, rec)
        self.notify_all()
1110700
def update_offset(self, new_offset):
        
        self.offset = new_offset
        self.data_points = self._data_points[self.offset:]
        self.timestamps = self._timestamps[self.offset:]
837667
def setpos(self, location, text):
        """"""
        self.location = location
        self.text = text
1372904
def set_record(self, record, **kw):
        

        if isstring(record):
            card = FITSCard(record)
            self.update(card)

            self.verify()

        else:

            if isinstance(record, FITSRecord):
                self.update(record)
            elif isinstance(record, dict):
                if 'name' in record and 'value' in record:
                    self.update(record)

                elif 'card_string' in record:
                    self.set_record(record['card_string'])

                else:
                    raise ValueError('record must have name,value fields '
                                     'or a card_string field')
            else:
                raise ValueError("record must be a string card or "
                                 "dictionary or FITSRecord")
753630
def update(self,records,**kw):
        """"""
        # ignore unknown fields
        kw = dict([(k,v) for (k,v) in kw.iteritems() if k in self.fields])
        if isinstance(records,dict):
            records = [ records ]
        # update indices
        for indx in set(self.indices.keys()) & set (kw.keys()):
            for record in records:
                if record[indx] == kw[indx]:
                    continue
                _id = record["__id__"]
                # remove id for the old value
                old_pos = bisect.bisect(self.indices[indx][record[indx]],_id)-1
                del self.indices[indx][record[indx]][old_pos]
                if not self.indices[indx][record[indx]]:
                    del self.indices[indx][record[indx]]
                # insert new value
                bisect.insort(self.indices[indx].setdefault(kw[indx],[]),_id)
        for record in records:
            # update record values
            record.update(kw)
            # increment version number
            record["__version__"] += 1
871623
function (position) {
			this.writeDebug('autoGeocodeQuery',arguments);
			var _this = this,
				distance = null,
				$distanceInput = $('#' + this.settings.maxDistanceID),
				originAddress;

			// Query string parameters
			if (this.settings.querystringParams === true) {
				// Check for distance query string parameters
				if (this.getQueryString(this.settings.maxDistanceID)){
					distance = this.getQueryString(this.settings.maxDistanceID);

					if ($distanceInput.val() !== '') {
						distance = $distanceInput.val();
					}
				}
				else{
					// Get the distance if set
					if (this.settings.maxDistance === true) {
						distance = $distanceInput.val() || '';
					}
				}
			}
			else {
				// Get the distance if set
				if (this.settings.maxDistance === true) {
					distance = $distanceInput.val() || '';
				}
			}

			// The address needs to be determined for the directions link
			var r = new this.reverseGoogleGeocode(this);
			var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
			r.geocode({'latLng': latlng}, function (data) {
				if (data !== null) {
					originAddress = addressInput = data.address;
					olat = mappingObj.lat = position.coords.latitude;
					olng = mappingObj.lng = position.coords.longitude;
					mappingObj.origin = originAddress;
					mappingObj.distance = distance;
					_this.mapping(mappingObj);

					// Fill in the search box.
					if (typeof originAddress !== 'undefined') {
						$('#' + _this.settings.addressID).val(originAddress);
					}
				} else {
					// Unable to geocode
					_this.notify(_this.settings.addressErrorAlert);
				}
			});
		}
1219621
private void update() {
                if (!uptodate) {
                        summary.clear();
                        distinctTraces.clear();
                        traces.clear();
                        addTraces(allTraces, false);
                        uptodate = true;
                }
        }
1348946
def _update(self):
        
        aps = []
        for k, v in self.records.items():
            recall, prec = self._recall_prec(v, self.counts[k])
            ap = self._average_precision(recall, prec)
            aps.append(ap)
            if self.num is not None and k < (self.num - 1):
                self.sum_metric[k] = ap
                self.num_inst[k] = 1
        if self.num is None:
            self.num_inst = 1
            self.sum_metric = np.mean(aps)
        else:
            self.num_inst[-1] = 1
            self.sum_metric[-1] = np.mean(aps)
1113580
def update(self):
        '''
        
        '''
        if self.hasproxy():
            laserD = LaserData()
            values = []
            data = self.proxy.getLaserData()

            #laserD.values = laser.distanceData
            for i in range (data.numLaser):
                values.append(data.distanceData[i] / 1000.0) 

            laserD.maxAngle = data.maxAngle
            laserD.minAngle = data.minAngle
            laserD.maxRange = data.maxRange
            laserD.minRange = data.minRange
            laserD.values = values


            self.lock.acquire()
            self.laser = laserD
            self.lock.release()
926373
def set_locations(self, locations, values):
        

        indexes = [self._index[x] for x in locations]
        self.set(indexes, values)
436912
def update(self, data=None, priority=None, ttl=None, comment=None):
        
        return self.manager.update_record(self.domain_id, self, data=data,
            priority=priority, ttl=ttl, comment=comment)
876999
function PositionObj (data) {
    this.msg    = parseInt (data.cmd);
    this.lat    = parseFloat(data.lat);
    this.lon    = parseFloat(data.lon);
    this.sog    = parseFloat(data.sog)   || 0;
    this.cog    = parseFloat(data.cog)   || 0;
    this.alt    = parseFloat(data.alt)   || 0;
    this.moved  = parseInt(data.moved)   || -1;
    this.elapsed= parseInt(data.elapsed) || -1;
    this.valid  = parseInt(+data.valid);
    this.acquired_at  = data.acquired_at;
    this.gpsdate= data.date;
}