Swaps content of two fields
332139
void swapField(int element1, int element2, int field) {
		int ar1[] = m_buffer[element1 >> m_blockPower];
		int ar2[] = m_buffer[element2 >> m_blockPower];
		int ind1 = (element1 & m_blockMask) + field;
		int ind2 = (element2 & m_blockMask) + field;
		int tmp = ar1[ind1];
		ar1[ind1] = ar2[ind2];
		ar2[ind2] = tmp;
	}
250346
public void swap( Element<T> a , Element<T> b ) {
		if (a.next == b) {
			if( a.previous != null ) {
				a.previous.next = b;
			}
			if( b.next != null ) {
				b.next.previous = a;
			}
			Element<T> tmp = a.previous;
			a.previous = b;
			a.next = b.next;
			b.previous = tmp;
			b.next = a;
			if( first == a )
				first = b;
			if( last == b )
				last = a;
		} else if (a.previous == b) {
			if( a.next != null ) {
				a.next.previous = b;
			}
			if( b.previous != null ) {
				b.previous.next = a;
			}
			Element<T> tmp = a.next;
			a.next = b;
			a.previous = b.previous;
			b.previous = a;
			b.next = tmp;

			if( first == b )
				first = a;
			if( last == a )
				last = b;
		} else {
			if (a.next != null) {
				a.next.previous = b;
			}
			if (a.previous != null) {
				a.previous.next = b;
			}
			if (b.next != null) {
				b.next.previous = a;
			}
			if (b.previous != null) {
				b.previous.next = a;
			}
			Element<T> tempNext = b.next;
			Element<T> tempPrev = b.previous;
			b.next = a.next;
			b.previous = a.previous;
			a.next = tempNext;
			a.previous = tempPrev;

			if (a.next == null)
				last = a;
			else if (b.next == null)
				last = b;
			if (a.previous == null)
				first = a;
			else if (b.previous == null)
				first = b;
		}
	}
318685
public static void swapPivot(double[][] source, int diag, double[][] s, double[][] t) {
		// get swap row and col
		int swapRow = diag;
		int swapCol = diag;
		double maxValue = Math.abs(source[diag][diag]);
		int rows = source.length;
		int cols = source[0].length;
		double abs = 0;
		double[] r = null;
		for (int row = diag; row < rows; row++) {
			r = source[row];
			for (int col = diag; col < cols; col++) {
				abs = Math.abs(r[col]);
				if (abs > maxValue) {
					maxValue = abs;
					swapRow = row;
					swapCol = col;
				}
			}
		}

		// swap rows and columns
		if (swapRow != diag) {
			swapRows(source, swapRow, diag);
			swapRows(t, swapRow, diag);
		}
		if (swapCol != diag) {
			swapCols(source, swapCol, diag);
			swapCols(s, swapCol, diag);
		}
	}
515128
def swap(self, i, j):
		
		i = self._fix_neg_index(i)
		j = self._fix_neg_index(j)
		self._list[i], self._list[j] = self._list[j], self._list[i]
		self._dict[self._list[i]] = i
		self._dict[self._list[j]] = j
261639
def fieldset(title, items, options=None):
    """"""
    result = {
        'title': title,
        'type': 'fieldset',
        'items': items
    }
    if options is not None:
        result.update(options)

    return result
983900
function fieldAssign(elem, field, val) {
        try {
            $(exports).triggerHandler('fieldAssign', [elem, field, val]);
        } catch (err) {
            console.error(err);
        }
        var isCustomField = (elem[field] && elem[field].__read);
        var oldVal;
        if (isCustomField) {
            oldVal = elem[field].__write();
        } else {
            oldVal = elem[field];
        }
        _currentOperation.ops.push({
            op: OP_FIELD_ASSIGN,
            arg: {
                _id: elem._id,
                f: field,
                n: val,
                o: oldVal
            }
        });
    }
423346
function ( e, item ) {
            var res = { 
                id:    this._conf().fieldID,
                meta:  this._meta(),
                value: {}
            };
            var oldValue = getOrDefault( this, 'props.config.value', [] );
            res.value[ res.id ] = _.contains(oldValue, item.id ) 
                ? _.without( oldValue, item.id ) : oldValue.concat([ item.id ]);

            this.handleEvent( 'change')( e );
            this._conf().onChange( res );
        }
792925
function flipShadow(value) {
  var elements = value.split(/\s+/);

  if (!elements) { return value; }

  var inset = (elements[0] == 'inset') ? elements.shift() + ' ' : '';
  var property = elements[0].match(/^([-+]?\d+)(\w*)$/);

  if (!property) { return value; }

  return inset + [(-1 * +property[1]) + property[2]]
      .concat(elements.splice(1)).join(' ');
}
266356
private void changeEntityContentValues(
        CmsEntity newContent,
        String entityId,
        String attributeName,
        int valueIndex,
        ChangeType type) {

        switch (type) {
            case value:
                CmsAttributeHandler handler = m_rootHandler.getHandlerById(entityId, attributeName);
                CmsEntity entity = newContent.getEntityById(entityId);
                if ((entity != null) && (entity.getAttribute(attributeName) != null)) {
                    String value = entity.getAttribute(attributeName).getSimpleValues().get(valueIndex);
                    if ((handler != null) && handler.hasValueView(valueIndex) && (value != null)) {
                        handler.changeValue(value, valueIndex);
                        break;
                    }
                }
                //$FALL-THROUGH$
            default:
                m_editor.rerenderForm(newContent);
        }
    }
506211
public function diffedData()
    {
        if ($this->fromRecord) {
            $diffed = clone $this->fromRecord;
            $fields = array_keys($diffed->toMap() + $this->toRecord->toMap());
        } else {
            $diffed = clone $this->toRecord;
            $fields = array_keys($this->toRecord->toMap());
        }

        $hasOnes = array_merge($this->fromRecord->hasOne(), $this->toRecord->hasOne());

        // Loop through properties
        foreach ($fields as $field) {
            if (in_array($field, $this->ignoredFields)) {
                continue;
            }
            if (in_array($field, array_keys($hasOnes))) {
                continue;
            }

            // Check if a field from-value is comparable
            $toField = $this->toRecord->obj($field);
            if (!($toField instanceof DBField)) {
                continue;
            }
            $toValue = $toField->forTemplate();

            // Show only to value
            if (!$this->fromRecord) {
                $diffed->setField($field, DBField::create_field('HTMLFragment', "<ins>{$toValue}</ins>"));
                continue;
            }

            // Check if a field to-value is comparable
            $fromField = $this->fromRecord->obj($field);
            if (!($fromField instanceof DBField)) {
                continue;
            }
            $fromValue = $fromField->forTemplate();

            // Show changes between the two, if any exist
            if ($fromValue != $toValue) {
                $diffed->setField($field, DBField::create_field('HTMLFragment', Diff::compareHTML($fromValue, $toValue)));
            }
        }

        // Loop through has_one
        foreach ($hasOnes as $relName => $relSpec) {
            if (in_array($relName, $this->ignoredFields)) {
                continue;
            }

            // Create the actual column name
            $relField = "{$relName}ID";
            // Using relation name instead of database column name, because of FileField etc.
            $setField = is_a($relSpec, Image::class, true) ? $relName : $relField;
            $toTitle = '';
            /** @var DataObject $relObjTo */
            $relObjTo = null;
            if ($this->toRecord->hasMethod($relName)) {
                $relObjTo = $this->toRecord->$relName();
                $toTitle = $this->getObjectDisplay($relObjTo);
            }

            if (!$this->fromRecord) {
                $diffed->setField(
                    $setField,
                    DBField::create_field('HTMLFragment', "<ins>{$toTitle}</ins>")
                );
            } elseif ($this->fromRecord->$relField != $this->toRecord->$relField) {
                $fromTitle = '';
                $relObjFrom = null;
                if ($this->fromRecord->hasMethod($relName)) {
                    $relObjFrom = $this->fromRecord->$relName();
                    $fromTitle = $this->getObjectDisplay($relObjFrom);
                }

                // Set the field.
                $diffed->setField(
                    $setField,
                    DBField::create_field('HTMLFragment', Diff::compareHTML($fromTitle, $toTitle))
                );
            }
        }

        return $diffed;
    }
844955
function swaptitle(title){
	
		if(a.length===0){
			a = [document.title];
		}

		a.push(title);

		if(!iv){
			iv = setInterval(function(){

				// has document.title changed externally?
				if(a.indexOf(document.title) === -1 ){
					// update the default title
					a[0] = document.title;
				}
				
				document.title = a[++i%a.length];
			}, 1000);
		}
	}
526743
function updatebin(){
  var bin = bininputfield;
  if(bininputvalue != bin){
    updateall(bininputtobin(bin));
    clearallinputs();
    bininputfield = bin;
    bininputvalue = bin;
  }
}
272383
def fix_additional_fields(data):
        """"""
        result = dict()
        for key, value in data.items():
            if isinstance(value, dict):
                result.update(KserSpan.to_flat_dict(key, value))
            else:
                result[key] = value
        return result
1226851
def setField(self, new_value):
        
        self.B = self.B._replace(val=new_value)
525086
function mergeField(memo, key){
  var result = {},
    match;

  if(_.isPlainObject(key)){
    result = key;
  }else if(_.isString(key) && (match = key.match(re.RENAME))){
    result[match[2]] = match[1];
  }else{
    result[key] = null;
  }

  return _.merge(memo, result);
}
885899
function compareNumericField(field, a, b) {
    var nodeA = (a[1]);
    var nodeB = (b[1]);
    return nodeA[field] - nodeB[field];
  }
823620
def swapped(self):
        
        args = [getattr(self, attr) for attr in BlastLine.__slots__[:12]]
        args[0:2] = [self.subject, self.query]
        args[6:10] = [self.sstart, self.sstop, self.qstart, self.qstop]
        if self.orientation == '-':
            args[8], args[9] = args[9], args[8]
        b = "\t".join(str(x) for x in args)
        return BlastLine(b)