Used by ModificationStatement for CAS operations
439472
void processColumnFamily(ByteBuffer key, ColumnFamily cf, QueryOptions options, long now, Selection.ResultSetBuilder result)
    throws InvalidRequestException
    {
        CFMetaData cfm = cf.metadata();
        ByteBuffer[] keyComponents = null;
        if (cfm.getKeyValidator() instanceof CompositeType)
        {
            keyComponents = ((CompositeType)cfm.getKeyValidator()).split(key);
        }
        else
        {
            keyComponents = new ByteBuffer[]{ key };
        }

        Iterator<Cell> cells = cf.getSortedColumns().iterator();
        if (sliceRestriction != null)
            cells = applySliceRestriction(cells, options);

        CQL3Row.RowIterator iter = cfm.comparator.CQL3RowBuilder(cfm, now).group(cells);

        // If there is static columns but there is no non-static row, then provided the select was a full
        // partition selection (i.e. not a 2ndary index search and there was no condition on clustering columns)
        // then we want to include the static columns in the result set (and we're done).
        CQL3Row staticRow = iter.getStaticRow();
        if (staticRow != null && !iter.hasNext() && !usesSecondaryIndexing && hasNoClusteringColumnsRestriction())
        {
            result.newRow();
            for (ColumnDefinition def : selection.getColumns())
            {
                switch (def.kind)
                {
                    case PARTITION_KEY:
                        result.add(keyComponents[def.position()]);
                        break;
                    case STATIC:
                        addValue(result, def, staticRow, options);
                        break;
                    default:
                        result.add((ByteBuffer)null);
                }
            }
            return;
        }

        while (iter.hasNext())
        {
            CQL3Row cql3Row = iter.next();

            // Respect requested order
            result.newRow();
            // Respect selection order
            for (ColumnDefinition def : selection.getColumns())
            {
                switch (def.kind)
                {
                    case PARTITION_KEY:
                        result.add(keyComponents[def.position()]);
                        break;
                    case CLUSTERING_COLUMN:
                        result.add(cql3Row.getClusteringColumn(def.position()));
                        break;
                    case COMPACT_VALUE:
                        result.add(cql3Row.getColumn(null));
                        break;
                    case REGULAR:
                        addValue(result, def, cql3Row, options);
                        break;
                    case STATIC:
                        addValue(result, def, staticRow, options);
                        break;
                }
            }
        }
    }
648350
function changeDesc(object, property, newval, oldval, chgtype) {
    return {
        type : chgtype,
        object : object,
        name : property,
        newValue : newval,
        oldValue : oldval
    };
}
571773
protected boolean replaceStatementInNode(N statement, N oldN, N newN) {
		for (FieldAccess fa : fieldsOf(statement.getClass())) {
			if (replaceStatementInField(fa, statement, oldN, newN)) return true;
		}
		
		return false;
	}
1251199
public void mutableSubtract(double c, Matrix B, ExecutorService threadPool)
    {
        mutableAdd(-c, B, threadPool);
    }
847494
@Override
    public synchronized void process(CAS tcas) {

        final AnnotationComboIterator comboIterator =
                        new AnnotationComboIterator(tcas, this.sentenceType, this.tokenType);

        for (AnnotationIteratorPair annotationIteratorPair : comboIterator) {

            final List<AnnotationFS> sentenceTokenAnnotationList = new LinkedList<AnnotationFS>();

            final List<String> sentenceTokenList = new LinkedList<String>();

            for (AnnotationFS tokenAnnotation : annotationIteratorPair.getSubIterator()) {

                sentenceTokenAnnotationList.add(tokenAnnotation);

                sentenceTokenList.add(tokenAnnotation.getCoveredText());
            }

            final List<String> posTags = this.posTagger.tag(sentenceTokenList);

            double posProbabilities[] = null;

            if (this.probabilityFeature != null) {
                posProbabilities = this.posTagger.probs();
            }

            final Iterator<String> posTagIterator = posTags.iterator();
            final Iterator<AnnotationFS> sentenceTokenIterator = sentenceTokenAnnotationList.iterator();

            int index = 0;
            while (posTagIterator.hasNext() && sentenceTokenIterator.hasNext()) {
                final String posTag = posTagIterator.next();
                final AnnotationFS tokenAnnotation = sentenceTokenIterator.next();

                tokenAnnotation.setStringValue(this.posFeature, posTag);

                if (posProbabilities != null) {
                    tokenAnnotation.setDoubleValue(this.posFeature, posProbabilities[index]);
                }

                index++;
            }

            // log tokens with pos
            if (this.logger.isLoggable(Level.FINER)) {

                final StringBuilder sentenceWithPos = new StringBuilder();

                sentenceWithPos.append("\"");

                for (final Iterator<AnnotationFS> it = sentenceTokenAnnotationList.iterator(); it.hasNext();) {
                    final AnnotationFS token = it.next();
                    sentenceWithPos.append(token.getCoveredText());
                    sentenceWithPos.append('\\');
                    sentenceWithPos.append(token.getStringValue(this.posFeature));
                    sentenceWithPos.append(' ');
                }

                // delete last whitespace
                if (sentenceWithPos.length() > 1) // not 0 because it contains already the " char
                    sentenceWithPos.setLength(sentenceWithPos.length() - 1);

                sentenceWithPos.append("\"");

                this.logger.log(Level.FINER, sentenceWithPos.toString());
            }
        }
    }
585238
def _verify_cas1(ticket, service):
    

    params = {'ticket': ticket, 'service': service}
    url = (urljoin(settings.CAS_SERVER_URL, 'validate') + '?' +
           urlencode(params))
    page = urlopen(url)

    try:
        verified = page.readline().strip()
        if verified == 'yes':
            return page.readline().strip()
        else:
            return None
    finally:
        page.close()
1169998
function modify(modifier, source, index, shift) {
  if (
    !this.isEnabled() &&
    source === Emitter.sources.USER &&
    !this.allowReadOnlyEdits
  ) {
    return new Delta();
  }
  let range = index == null ? null : this.getSelection();
  const oldDelta = this.editor.delta;
  const change = modifier();
  if (range != null) {
    if (index === true) {
      index = range.index; // eslint-disable-line prefer-destructuring
    }
    if (shift == null) {
      range = shiftRange(range, change, source);
    } else if (shift !== 0) {
      range = shiftRange(range, index, shift, source);
    }
    this.setSelection(range, Emitter.sources.SILENT);
  }
  if (change.length() > 0) {
    const args = [Emitter.events.TEXT_CHANGE, change, oldDelta, source];
    this.emitter.emit(Emitter.events.EDITOR_CHANGE, ...args);
    if (source !== Emitter.sources.SILENT) {
      this.emitter.emit(...args);
    }
  }
  return change;
}
555860
function modifyState($n) {
    var state = self.state;

    function selectByStateRecursive(name) {
      if (state.recursive) {
        return $n.find(name);
      } else {
        return $n.children(name)
      }
    }

    var a;
    var b;
    if (state.mode == 'code') {
      a = selectByStateRecursive('pre:visible');
      if (a.length > 0)
//        a.hide();
        hideShowCode(a, 'hide');
      else {
        a = selectByStateRecursive('pre');
//        a.show();
        hideShowCode(a, 'show');
      }
    }
    if (state.mode == 'childs') {
      a = selectByStateRecursive('.node:visible');
      if (a.length > 0)
        hideShowNodes(a, 'hide');
//        a.hide();
      else {
        a = selectByStateRecursive('.node');
//        a.show();
        hideShowNodes(a, 'show');
      }
    }
    if (state.mode == 'code childs') {
      a = selectByStateRecursive('.node:hidden');
      b = selectByStateRecursive('pre:hidden');

      if (a.length > 0 || b.length > 0) {
        hideShowNodes(a, 'show');
        hideShowCode(b, 'show');
//        a.show();
//        b.show();
      } else {
        a = selectByStateRecursive('.node');
        b = selectByStateRecursive('pre');
        hideShowNodes(a, 'hide');
        hideShowCode(b, 'hide');
//        a.hide();
//        b.hide();
      }
    }
  }
1329644
private int calcModifiersOpValue(int t) {
        int result = 0;

        for (ModifierNode modifierNode : modifierNodeList) {
            result |= modifierNode.getOpcode();
        }

        if (!this.containsVisibilityModifier()) {
            if (1 == t) {
                result |= Opcodes.ACC_SYNTHETIC | Opcodes.ACC_PUBLIC;
            } else if (2 == t) {
                result |= Opcodes.ACC_PUBLIC;
            }
        }

        return result;
    }
1061222
function (changes, cb) {
        var okKeys = {
            sid: true,
            action: true,
            initiator: true,
            responder: true
        };

        var unknownPayload = false;
        Object.keys(changes).forEach(function (key) {
            if (!okKeys[key]) {
                unknownPayload = true;
            }
        });

        if (unknownPayload) {
            cb({
                type: 'modify',
                condition: 'feature-not-implemented',
                jingleCondition: 'unsupported-info'
            });
        } else {
            cb();
        }
    }
474712
function(oExtension, $Cell, aDefaultLabels, aDefaultDescriptions, aLabels, aDescriptions, sText, fAdapt) {
			ExtensionHelper.storeDefaultsBeforeCellModifications(oExtension, $Cell, aDefaultLabels, aDefaultDescriptions);
			var oCountChangeInfo = ExtensionHelper.updateRowColCount(oExtension);
			oExtension.getTable().$("cellacc").text(sText || " "); //set the custom text to the prepared hidden element

			if (fAdapt) { //Allow to adapt the labels / descriptions based on the changed row / column count
				fAdapt(aLabels, aDescriptions, oCountChangeInfo.rowChange, oCountChangeInfo.colChange, oCountChangeInfo.initial);
			}

			var sLabel = "";
			if (oCountChangeInfo.initial) {
				var oTable = oExtension.getTable();
				sLabel = oTable.getAriaLabelledBy().join(" ") + " " + oTable.getId() + "-ariacount";
				if (oTable.getSelectionMode() !== SelectionMode.None) {
					sLabel = sLabel + " " + oTable.getId() + "-ariaselection";
				}
			}

			if (aLabels && aLabels.length) {
				sLabel = sLabel + " " + aLabels.join(" ");
			}

			$Cell.attr({
				"aria-labelledby": sLabel ? sLabel : null,
				"aria-describedby": aDescriptions && aDescriptions.length ? aDescriptions.join(" ") : null
			});
		}
17199
public void setCasId(String v) {
    if (ProcessingStep_Type.featOkTst && ((ProcessingStep_Type)jcasType).casFeat_casId == null)
      jcasType.jcas.throwFeatMissing("casId", "edu.cmu.lti.oaqa.framework.types.ProcessingStep");
    jcasType.ll_cas.ll_setStringValue(addr, ((ProcessingStep_Type)jcasType).casFeatCode_casId, v);}
200576
function modify(query, res) {
	// jshint ignore:line
	//	console.log(arguments);

	/* If source is a primitive value then return it */
	if (
		typeof res === 'undefined' ||
		typeof res === 'number' ||
		typeof res === 'string' ||
		typeof res === 'boolean'
	) {
		return res;
	}

	var modifier = query.modifier || alasql.options.modifier;
	var columns = query.columns;
	if (typeof columns === 'undefined' || columns.length == 0) {
		// Try to create columns
		if (res.length > 0) {
			var allcol = {};
			for (var i = Math.min(res.length, alasql.options.columnlookup || 10) - 1; 0 <= i; i--) {
				for (var key in res[i]) {
					allcol[key] = true;
				}
			}

			columns = Object.keys(allcol).map(function(columnid) {
				return {columnid: columnid};
			});
		} else {
			// Cannot recognize columns
			columns = [];
		}
	}

	//	console.log(columns);

	if (modifier === 'VALUE') {
		//		console.log(222,res);
		if (res.length > 0) {
			var key;
			if (columns && columns.length > 0) {
				key = columns[0].columnid;
			} else {
				key = Object.keys(res[0])[0];
			}
			res = res[0][key];
		} else {
			res = undefined;
		}
	} else if (modifier === 'ROW') {
		if (res.length > 0) {
			var key;
			var a = [];
			for (var key in res[0]) {
				a.push(res[0][key]);
			}
			res = a;
		} else {
			res = undefined;
		}
	} else if (modifier === 'COLUMN') {
		var ar = [];
		if (res.length > 0) {
			var key;
			if (columns && columns.length > 0) {
				key = columns[0].columnid;
			} else {
				key = Object.keys(res[0])[0];
			}

			for (var i = 0, ilen = res.length; i < ilen; i++) {
				ar.push(res[i][key]);
			}
		}
		res = ar;
	} else if (modifier === 'MATRIX') {
		// Returns square matrix of rows
		var ar = [];
		for (var i = 0; i < res.length; i++) {
			var a = [];
			var r = res[i];
			for (var j = 0; j < columns.length; j++) {
				a.push(r[columns[j].columnid]);
			}
			ar.push(a);
		}
		res = ar;
	} else if (modifier === 'INDEX') {
		var ar = {};
		var key, val;
		if (columns && columns.length > 0) {
			key = columns[0].columnid;
			val = columns[1].columnid;
		} else {
			var okeys = Object.keys(res[0]);
			key = okeys[0];
			val = okeys[1];
		}
		for (var i = 0, ilen = res.length; i < ilen; i++) {
			ar[res[i][key]] = res[i][val];
		}
		res = ar;
		//		res = arrayOfArrays(res);
	} else if (modifier === 'RECORDSET') {
		res = new alasql.Recordset({columns: columns, data: res});
		//		res = arrayOfArrays(res);
	} else if (modifier === 'TEXTSTRING') {
		var key;
		if (columns && columns.length > 0) {
			key = columns[0].columnid;
		} else {
			key = Object.keys(res[0])[0];
		}

		for (var i = 0, ilen = res.length; i < ilen; i++) {
			res[i] = res[i][key];
		}
		res = res.join('\n');
		//		res = arrayOfArrays(res);
	}
	return res;
}
326750
public final <T> boolean cas(String key, final int exp, final CASOperation<T> operation,
      final Transcoder<T> transcoder)
      throws TimeoutException, InterruptedException, MemcachedException {
    key = this.preProcessKey(key);
    byte[] keyBytes = ByteUtils.getBytes(key);
    ByteUtils.checkKey(keyBytes);
    GetsResponse<T> result = this.gets0(key, keyBytes, transcoder);
    return this.cas0(key, exp, result, operation, transcoder, keyBytes, false);
  }
1153451
def modifie_options(self, field_option, value):
        """"""
        options = dict(self["options"] or {}, **{field_option: value})
        self.modifications["options"] = options
439749
def _get_operations(self, context):
        """"""
        #Most of the time, the real-time update is going to fire with
        #incomplete statements that don't result in any changes being made
        #to the module instances. The SequenceMatches caches hashes for the
        #second argument. Logically, we want to turn the cached version into
        #the buffer version; however, the buffer is the string that keeps 
        #changing.

        #in order to optimize the real-time update, we *switch* the two strings
        #when we set the sequence and then fix the references on the operations
        #after the fact.
        if context.module.changed or self.unset:
            self.matcher.set_seq2(context.cachedstr)
            self.unset = False
            #Set the changed flag back to false now that the sequencer has
            #reloaded it.
            context.module.changed = False
        self.matcher.set_seq1(context.bufferstr)

        opcodes = self.matcher.get_opcodes()
        result = []

        #Index i keeps track of how many operations were actually added because
        #they constituted a change we need to take care of.
        i = 0
        for code in opcodes:
            if code[0] != "equal":
                #Replacements don't have a mode change. All of the operations
                #switch the order of the line indices for the two strings.
                if code[0] == "insert":
                    newcode = ("delete", code[3], code[4], code[1], code[2])
                elif code[0] == "delete":
                    newcode = ("insert", code[3], code[4], code[1], code[2])
                else:
                    newcode = ("replace", code[3], code[4], code[1], code[2])

                op = Operation(context, self.parser, newcode, i)
                result.append(op)
                i += 1

        return result
884916
private ImmutableList<CQIE> convertAssertions(Iterable<ClassAssertion> cas,
                                                  Iterable<ObjectPropertyAssertion> pas,
                                                  Iterable<DataPropertyAssertion> das,
                                                  Iterable<AnnotationAssertion> aas,
                                                  UriTemplateMatcher uriTemplateMatcher) {

        List<CQIE> mutableMapping = new ArrayList<>();

        int count = 0;
        for (ClassAssertion ca : cas) {
            // no blank nodes are supported here
            IRIConstant c = (IRIConstant) ca.getIndividual();
            IRI classIRI = ca.getConcept().getIRI();
            Function head = atomFactory.getMutableTripleHeadAtom(
                    immutabilityTools.convertToMutableFunction(
                            uriTemplateMatcher.generateURIFunction(c.getIRI().getIRIString())), classIRI);
            CQIE rule = datalogFactory.getCQIE(head, Collections.emptyList());

            mutableMapping.add(rule);
            count++;
        }
        LOGGER.debug("Appended {} class assertions from ontology as fact rules", count);

        count = 0;
        for (ObjectPropertyAssertion pa : pas) {
            // no blank nodes are supported here
            IRIConstant s = (IRIConstant) pa.getSubject();
            IRIConstant o = (IRIConstant) pa.getObject();
            IRI propertyIRI = pa.getProperty().getIRI();
            Function head = atomFactory.getMutableTripleHeadAtom(
                    immutabilityTools.convertToMutableTerm(uriTemplateMatcher.generateURIFunction(s.getIRI().getIRIString())),
                    propertyIRI,
                    immutabilityTools.convertToMutableTerm(uriTemplateMatcher.generateURIFunction(o.getIRI().getIRIString())));
            CQIE rule = datalogFactory.getCQIE(head, Collections.emptyList());

            mutableMapping.add(rule);
            count++;
        }
        LOGGER.debug("Appended {} object property assertions as fact rules", count);


        count = 0;
        for (DataPropertyAssertion da : das) {
            // no blank nodes are supported here
            IRIConstant s = (IRIConstant) da.getSubject();
            ValueConstant o = da.getValue();
            IRI propertyIRI = da.getProperty().getIRI();


            Function head = o.getType().getLanguageTag()
                    .map(lang -> atomFactory.getMutableTripleHeadAtom(termFactory.getUriTemplate(
                            termFactory.getConstantLiteral(s.getIRI().getIRIString())),
                            propertyIRI,
                            termFactory.getTypedTerm(termFactory.getConstantLiteral(o.getValue()), lang.getFullString())))
                    .orElseGet(() -> atomFactory.getMutableTripleHeadAtom(termFactory.getUriTemplate(
                            termFactory.getConstantLiteral(s.getIRI().getIRIString())),
                            propertyIRI,
                            termFactory.getTypedTerm(o, o.getType())));
            CQIE rule = datalogFactory.getCQIE(head, Collections.emptyList());

            mutableMapping.add(rule);
            count++;
        }

        LOGGER.debug("Appended {} data property assertions as fact rules", count);

        count = 0;
        for (AnnotationAssertion aa : aas) {
            // no blank nodes are supported here

            IRIConstant s = (IRIConstant) aa.getSubject();
            IRI propertyIRI = aa.getProperty().getIRI();

            Function head;
            if (aa.getValue() instanceof ValueConstant) {

                ValueConstant o = (ValueConstant) aa.getValue();

                head = o.getType().getLanguageTag()
                        .map(lang -> atomFactory.getMutableTripleHeadAtom(termFactory.getUriTemplate(
                                    termFactory.getConstantLiteral(s.getIRI().getIRIString())),
                                    propertyIRI,
                                    termFactory.getTypedTerm(termFactory.getConstantLiteral(o.getValue()), lang.getFullString())))
                        .orElseGet(() -> atomFactory.getMutableTripleHeadAtom(termFactory.getUriTemplate(
                                termFactory.getConstantLiteral(s.getIRI().getIRIString())),
                                propertyIRI,
                                termFactory.getTypedTerm(o, o.getType())));
            } else {

                IRIConstant o = (IRIConstant) aa.getValue();
                head = atomFactory.getMutableTripleHeadAtom(
                        termFactory.getUriTemplate(termFactory.getConstantLiteral(s.getIRI().getIRIString())),
                        propertyIRI,
                        termFactory.getUriTemplate(termFactory.getConstantLiteral(o.getIRI().getIRIString())));


            }
            CQIE rule = datalogFactory.getCQIE(head, Collections.emptyList());

            mutableMapping.add(rule);
            count++;
        }

        LOGGER.debug("Appended {} annotation assertions as fact rules", count);
        return ImmutableList.copyOf(mutableMapping);
    }