TODO: This function is not yet implemented. It acts as a placeholder until it is
extracted and implemented in its own repository, ObjectDocument.
550110
public function loadJSON(string $jsonString):void {
		$json = json_decode($jsonString);

		foreach($json as $key => $value) {
			$node = $this->createElement($key, $value);
			$this->appendChild($node);
		}
	}
501808
function getDocsToPersist(docId, view, docIdsToChangesAndEmits) {
  var metaDocId = '_local/doc_' + docId;
  var defaultMetaDoc = {_id: metaDocId, keys: []};
  var docData = docIdsToChangesAndEmits[docId];
  var indexableKeysToKeyValues = docData.indexableKeysToKeyValues;
  var changes = docData.changes;

  function getMetaDoc() {
    if (isGenOne(changes)) {
      // generation 1, so we can safely assume initial state
      // for performance reasons (avoids unnecessary GETs)
      return Promise.resolve(defaultMetaDoc);
    }
    return view.db.get(metaDocId).catch(defaultsTo(defaultMetaDoc));
  }

  function getKeyValueDocs(metaDoc) {
    if (!metaDoc.keys.length) {
      // no keys, no need for a lookup
      return Promise.resolve({rows: []});
    }
    return view.db.allDocs({
      keys: metaDoc.keys,
      include_docs: true
    });
  }

  function processKvDocs(metaDoc, kvDocsRes) {
    var kvDocs = [];
    var oldKeysMap = {};

    for (var i = 0, len = kvDocsRes.rows.length; i < len; i++) {
      var row = kvDocsRes.rows[i];
      var doc = row.doc;
      if (!doc) { // deleted
        continue;
      }
      kvDocs.push(doc);
      oldKeysMap[doc._id] = true;
      doc._deleted = !indexableKeysToKeyValues[doc._id];
      if (!doc._deleted) {
        var keyValue = indexableKeysToKeyValues[doc._id];
        if ('value' in keyValue) {
          doc.value = keyValue.value;
        }
      }
    }

    var newKeys = Object.keys(indexableKeysToKeyValues);
    newKeys.forEach(function (key) {
      if (!oldKeysMap[key]) {
        // new doc
        var kvDoc = {
          _id: key
        };
        var keyValue = indexableKeysToKeyValues[key];
        if ('value' in keyValue) {
          kvDoc.value = keyValue.value;
        }
        kvDocs.push(kvDoc);
      }
    });
    metaDoc.keys = uniq(newKeys.concat(metaDoc.keys));
    kvDocs.push(metaDoc);

    return kvDocs;
  }

  return getMetaDoc().then(function (metaDoc) {
    return getKeyValueDocs(metaDoc).then(function (kvDocsRes) {
      return processKvDocs(metaDoc, kvDocsRes);
    });
  });
}
1317549
function _createPlaceholder(treeData, basedir, name, isFolder, options) {
        options = options || {};
        var parentPath = _filePathToObjectPath(treeData, basedir);

        if (!parentPath) {
            return;
        }

        var newObject = {
        };

        if (!options.notInCreateMode) {
            newObject.creating = true;
        }

        if (isFolder) {
            // If we're creating a folder, then we know it's empty.
            // But if we're not in create mode, (we're adding a folder based on an
            // FS event), we don't know anything about the new directory's children.
            if (options.notInCreateMode) {
                newObject.children = null;
            } else {
                newObject.children = Immutable.Map();
            }
        }

        var newFile = Immutable.Map(newObject);

        if (!options.doNotOpen) {
            treeData = _openPath(treeData, basedir);
        }
        if (parentPath.length > 0) {
            var childrenPath = _.clone(parentPath);
            childrenPath.push("children");

            treeData = treeData.updateIn(childrenPath, function (children) {
                return children.set(name, newFile);
            });
        } else {
            treeData = treeData.set(name, newFile);
        }
        return treeData;
    }
992551
@Override
    public String execute(EditXmlInputs inputs) throws Exception {
        Document doc = XmlUtils.createDocument(inputs.getXml(), inputs.getFilePath(), inputs.getParsingFeatures());
        NamespaceContext ctx = XmlUtils.getNamespaceContext(inputs.getXml(), inputs.getFilePath());
        NodeList nodeListToMove = XmlUtils.readNode(doc, inputs.getXpath1(), ctx);
        NodeList nodeListWhereToMove = XmlUtils.readNode(doc, inputs.getXpath2(), ctx);
        Node nodeToMove;
        Node nodeWhereToMove;

        if (!inputs.getXpath2().contains(inputs.getXpath1())) {
            // remove nodes
            for (int i = 0; i < nodeListToMove.getLength(); i++) {
                nodeToMove = nodeListToMove.item(i);
                if (nodeToMove != doc.getDocumentElement()) {
                    nodeToMove.getParentNode().removeChild(nodeToMove);
                }
            }
            //add nodes to designated location
            for (int i = 0; i < nodeListWhereToMove.getLength(); i++) {
                nodeWhereToMove = nodeListWhereToMove.item(i);
                for (int j = 0; j < nodeListToMove.getLength(); j++) {
                    nodeToMove = nodeListToMove.item(j);
                    nodeToMove = doc.importNode(nodeToMove, true);
                    nodeWhereToMove.appendChild(nodeToMove);
                }
            }
        }
        return DocumentUtils.documentToString(doc);
    }
1056414
function(source_object) {

		var i = 0,
			name,
			uid,
			result = this._createHelperStorage(),
			removed = this._createHelperStorage(),
			added = this._createHelperStorage();

		for (; i < this._count; i++) {

			name = this._data_names[i];
			if (name != null && (name in source_object)) {

				if (source_object[name] === this._data_values[i]) {

					result.push(this._data_uids[i], this._data_values[i], this._data_names[i]);

				} else {

					// Attention: the name has NOT changed, but it will be present in both added and removed names!
					removed.push(this._data_uids[i], this._data_values[i], name);
					uid = this._uid++;
					result.push(uid, source_object[name], name);
					added.push(uid, source_object[name], name);

				}

			} else {

				removed.push(this._data_uids[i], this._data_values[i], this._data_names[i]);

			}

		}

		for (name in source_object) {

			if (this._data_names.indexOf(name) == -1) {

				uid = this._uid++;
				result.push(uid, source_object[name], name);
				added.push(uid, source_object[name], name);

			}

		}

		this._assignStorage(result);
		this._setLength(this._data_uids.length);

		removed.uids.length && this._fire('items_removed', removed.getObject());
		added.uids.length && this._fire('items_added', added.getObject());
		this._fire('collection_changed');

	}
488898
private void doDocumentTypeDefinition(Node received, Node source,
            XmlMessageValidationContext validationContext,
            NamespaceContext namespaceContext, TestContext context) {

        Assert.isTrue(source instanceof DocumentType, "Missing document type definition in expected xml fragment");

        DocumentType receivedDTD = (DocumentType) received;
        DocumentType sourceDTD = (DocumentType) source;

        if (log.isDebugEnabled()) {
            log.debug("Validating document type definition: " +
                    receivedDTD.getPublicId() + " (" + receivedDTD.getSystemId() + ")");
        }

        if (!StringUtils.hasText(sourceDTD.getPublicId())) {
            Assert.isNull(receivedDTD.getPublicId(),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type public id not equal",
                    sourceDTD.getPublicId(), receivedDTD.getPublicId()));
        } else if (sourceDTD.getPublicId().trim().equals(Citrus.IGNORE_PLACEHOLDER)) {
            if (log.isDebugEnabled()) {
                log.debug("Document type public id: '" + receivedDTD.getPublicId() +
                        "' is ignored by placeholder '" + Citrus.IGNORE_PLACEHOLDER + "'");
            }
        } else {
            Assert.isTrue(StringUtils.hasText(receivedDTD.getPublicId()) &&
                    receivedDTD.getPublicId().equals(sourceDTD.getPublicId()),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type public id not equal",
                    sourceDTD.getPublicId(), receivedDTD.getPublicId()));
        }

        if (!StringUtils.hasText(sourceDTD.getSystemId())) {
            Assert.isNull(receivedDTD.getSystemId(),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type system id not equal",
                    sourceDTD.getSystemId(), receivedDTD.getSystemId()));
        } else if (sourceDTD.getSystemId().trim().equals(Citrus.IGNORE_PLACEHOLDER)) {
            if (log.isDebugEnabled()) {
                log.debug("Document type system id: '" + receivedDTD.getSystemId() +
                        "' is ignored by placeholder '" + Citrus.IGNORE_PLACEHOLDER + "'");
            }
        } else {
            Assert.isTrue(StringUtils.hasText(receivedDTD.getSystemId()) &&
                    receivedDTD.getSystemId().equals(sourceDTD.getSystemId()),
                    ValidationUtils.buildValueMismatchErrorMessage("Document type system id not equal",
                    sourceDTD.getSystemId(), receivedDTD.getSystemId()));
        }

        validateXmlTree(received.getNextSibling(),
                source.getNextSibling(), validationContext, namespaceContext, context);
    }
669510
function ObjectTypeProperty(node, print) {
  if (node["static"]) this.push("static ");
  print.plain(node.key);
  if (node.optional) this.push("?");
  if (!t.isFunctionTypeAnnotation(node.value)) {
    this.push(":");
    this.space();
  }
  print.plain(node.value);
}
104945
function DocAction(docStr) {
    return function (target, propertyKey, descriptor) {
        let m = exports.globalKCState.getOrInsertController(target.constructor).getOrInsertMethod(propertyKey);
        m.docString = docStr;
    };
}
457664
def _onDocstring( self, docstr, line ):
        "  "
        if self.objectsStack:
            self.objectsStack[ -1 ].docstring = \
                                 Docstring( trim_docstring( docstr ), line )
            return

        self.docstring = Docstring( trim_docstring( docstr ), line )
        return
312502
@Override
    public <V> Observable<V> mapGet(final String docId, final String key, Class<V> valueType) {
        final Func1<DocumentFragment<Lookup>, V> mapResult = new Func1<DocumentFragment<Lookup>, V>() {
            @Override
            public V call(DocumentFragment<Lookup> documentFragment) {
                ResponseStatus status = documentFragment.status(0);
                if (status == ResponseStatus.SUCCESS) {
                    return (V) documentFragment.content(0);
                } else if (status == ResponseStatus.SUBDOC_PATH_NOT_FOUND) {
                    throw new PathNotFoundException("Key not found in map");
                } else {
                    throw new CouchbaseException(status.toString());
                }
            }
        };
        return lookupIn(docId).get(key)
                .execute()
                .map(mapResult);
    }
1117668
function (element) {
            var ownerDocument = element ? element.ownerDocument : null;
            return ownerDocument ? this.isAncestor(element, ownerDocument.body) : false;
        }
319530
final void initDocument(int documentNumber)
        {
                // save masked DTM document handle
                m_docHandle = documentNumber<<DOCHANDLE_SHIFT;

                // Initialize the doc -- no parent, no next-sib
                nodes.writeSlot(0,DOCUMENT_NODE,-1,-1,0);
                // wait for the first startElement to create the doc root node
                done = false;
        }
333229
private Statement handleTranslationWithPlaceholders(
      MsgNode msg,
      ImmutableList<SoyPrintDirective> escapingDirectives,
      Expression soyMsgParts,
      Expression locale,
      MsgPartsAndIds partsAndId) {
    // We need to render placeholders into a buffer and then pack them into a map to pass to
    // Runtime.renderSoyMsgWithPlaceholders.

    Map<String, Function<Expression, Statement>> placeholderNameToPutStatement =
        new LinkedHashMap<>();
    putPlaceholdersIntoMap(msg, partsAndId.parts, placeholderNameToPutStatement);
    // sanity check
    checkState(!placeholderNameToPutStatement.isEmpty());
    ConstructorRef cstruct =
        msg.isPlrselMsg() ? ConstructorRef.PLRSEL_MSG_RENDERER : ConstructorRef.MSG_RENDERER;
    Statement initRendererStatement =
        variables
            .getCurrentRenderee()
            .putInstanceField(
                thisVar,
                cstruct.construct(
                    constant(partsAndId.id),
                    soyMsgParts,
                    locale,
                    constant(placeholderNameToPutStatement.size())));
    List<Statement> initializationStatements = new ArrayList<>();
    initializationStatements.add(initRendererStatement);
    for (Function<Expression, Statement> fn : placeholderNameToPutStatement.values()) {
      initializationStatements.add(fn.apply(variables.getCurrentRenderee().accessor(thisVar)));
    }

    Statement initMsgRenderer = Statement.concat(initializationStatements);
    Statement render;
    if (areAllPrintDirectivesStreamable(escapingDirectives)) {
      AppendableAndOptions wrappedAppendable =
          applyStreamingEscapingDirectives(
              escapingDirectives,
              appendableExpression,
              parameterLookup.getPluginContext(),
              variables);
      FieldRef currentAppendableField = variables.getCurrentAppendable();
      Statement initAppendable =
          currentAppendableField.putInstanceField(thisVar, wrappedAppendable.appendable());
      Expression appendableExpression = currentAppendableField.accessor(thisVar);
      Statement clearAppendable =
          currentAppendableField.putInstanceField(
              thisVar, constantNull(LOGGING_ADVISING_APPENDABLE_TYPE));
      if (wrappedAppendable.closeable()) {
        clearAppendable =
            Statement.concat(
                appendableExpression
                    .checkedCast(BytecodeUtils.CLOSEABLE_TYPE)
                    .invokeVoid(MethodRef.CLOSEABLE_CLOSE),
                clearAppendable);
      }
      render =
          Statement.concat(
              initAppendable,
              detachState.detachForRender(
                  variables
                      .getCurrentRenderee()
                      .accessor(thisVar)
                      .invoke(
                          MethodRef.SOY_VALUE_PROVIDER_RENDER_AND_RESOLVE,
                          appendableExpression,
                          // set the isLast field to true since we know this will only be rendered
                          // once.
                          /* isLast=*/ constant(true))),
              clearAppendable);
    } else {
      Label start = new Label();
      SoyExpression value =
          SoyExpression.forSoyValue(
              StringType.getInstance(),
              detachState
                  .createExpressionDetacher(start)
                  .resolveSoyValueProvider(variables.getCurrentRenderee().accessor(thisVar))
                  .checkedCast(SOY_STRING_TYPE));
      for (SoyPrintDirective directive : escapingDirectives) {
        value = parameterLookup.getRenderContext().applyPrintDirective(directive, value);
      }
      render =
          appendableExpression.appendString(value.unboxAsString()).toStatement().labelStart(start);
    }
    return Statement.concat(
        initMsgRenderer,
        render,
        // clear the field
        variables
            .getCurrentRenderee()
            .putInstanceField(
                thisVar,
                BytecodeUtils.constantNull(ConstructorRef.MSG_RENDERER.instanceClass().type())));
  }
71470
function bindDecorators (objectTemplate) {

    // TODO: In what situation would objectTemplate be null and why is it acceptable just to use this as a replacement?
    objectTemplate = objectTemplate || this;

    this.Amorphic = objectTemplate;
    this.amorphicStatic = objectTemplate;

    /**
     * Purpose unknown
     *
     * @param {unknown} target unknown
     * @param {unknown} props unknown
     *
     * @returns {unknown} unknown.
     */
    this.supertypeClass = function supertypeClass(target, props) {
        if (objectTemplate.supertypeClass) {
            return objectTemplate.supertypeClass(target, props, objectTemplate);
        }
        else {
            return SupertypeDefinition.supertypeClass(target, props, objectTemplate);
        }
    };

    /**
     * Purpose unknown
     *
     * @returns {unknown} unknown.
     */
    this.Supertype = function Supertype() {
        if (objectTemplate.Supertype) {
            return objectTemplate.Supertype.call(this, objectTemplate);
        }
        else {
            return SupertypeDefinition.Supertype.call(this, objectTemplate);
        }
    };
    this.Supertype.prototype = SupertypeDefinition.Supertype.prototype;

    /**
     *  Purpose unknown
     *
     * @param {unknown} props unknown
     *
     * @returns {unknown} unknown.
     */
    this.property = function property(props) {
        if (objectTemplate.property) {
            return objectTemplate.property(props, objectTemplate);
        }
        else {
            return SupertypeDefinition.property(props, objectTemplate);
        }
    };

    /**
     * Purpose unknown
     *
     * @param {unknown} defineProperty unknown
     *
     * @returns {unknown} unknown.
     */
    this.remote = function remote(defineProperty) {
        if (objectTemplate.remote) {
            return objectTemplate.remote(defineProperty, objectTemplate);
        }
        else {
            return SupertypeDefinition.remote(defineProperty, objectTemplate);
        }
    };

    /**
     * Purpose unknown
     *
     * @returns {unknown} unknown.
     */
    this.Amorphic.create = function create() {
        objectTemplate.connect = unitTestConfig.startup;

        return objectTemplate;
    };

    this.Amorphic.getInstance = function getInstance() {
        return objectTemplate;
    };
}
1002595
def _get_placeholder_arg(arg_name, placeholder):
    
    if placeholder is None:
        raise RuntimeWarning(u"placeholder object is None")
    elif isinstance(placeholder, Placeholder):
        return placeholder
    elif isinstance(placeholder, Manager):
        manager = placeholder
        try:
            parent_object = manager.instance  # read RelatedManager code
        except AttributeError:
            parent_object = None

        try:
            placeholder = manager.all()[0]
            if parent_object is not None:
                placeholder.parent = parent_object  # Fill GFK cache
            return placeholder
        except IndexError:
            raise RuntimeWarning(u"No placeholders found for query '{0}.all.0'".format(arg_name))
    else:
        raise ValueError(u"The field '{0}' does not refer to a placeholder object!".format(arg_name))
732041
public static void extractPlaceholders(ClassNode node, Map<GenericsTypeName, GenericsType> map) {
        if (node == null) return;

        if (node.isArray()) {
            extractPlaceholders(node.getComponentType(), map);
            return;
        }

        if (!node.isUsingGenerics() || !node.isRedirectNode()) return;
        GenericsType[] parameterized = node.getGenericsTypes();
        if (parameterized == null || parameterized.length == 0) return;
        GenericsType[] redirectGenericsTypes = node.redirect().getGenericsTypes();
        if (redirectGenericsTypes == null ||
                (node.isGenericsPlaceHolder() && redirectGenericsTypes.length != parameterized.length) /* GROOVY-8609 */ ) {
            redirectGenericsTypes = parameterized;
        }
        if (redirectGenericsTypes.length != parameterized.length) {
            throw new GroovyBugError("Expected earlier checking to detect generics parameter arity mismatch" +
                    "\nExpected: " + node.getName() + toGenericTypesString(redirectGenericsTypes) +
                    "\nSupplied: " + node.getName() + toGenericTypesString(parameterized));
        }

        List<GenericsType> valueList = new LinkedList<>();
        for (int i = 0; i < redirectGenericsTypes.length; i++) {
            GenericsType redirectType = redirectGenericsTypes[i];
            if (redirectType.isPlaceholder()) {
                GenericsTypeName name = new GenericsTypeName(redirectType.getName());
                if (!map.containsKey(name)) {
                    GenericsType value = parameterized[i];
                    map.put(name, value);

                    valueList.add(value);
                }
            }
        }

        for (GenericsType value : valueList) {
            if (value.isWildcard()) {
                ClassNode lowerBound = value.getLowerBound();
                if (lowerBound != null) {
                    extractPlaceholders(lowerBound, map);
                }
                ClassNode[] upperBounds = value.getUpperBounds();
                if (upperBounds != null) {
                    for (ClassNode upperBound : upperBounds) {
                        extractPlaceholders(upperBound, map);
                    }
                }
            } else if (!value.isPlaceholder()) {
                extractPlaceholders(value.getType(), map);
            }
        }
    }
1205679
public ObjectMarshallingStrategy getStrategyObject(Object object) {
        for ( int i = 0, length = this.strategiesList.length; i < length; i++ ) {
            if ( strategiesList[i].accept( object ) ) {
                return strategiesList[i];
            }
        }
        throw new RuntimeException( "Unable to find PlaceholderResolverStrategy for class : " + object.getClass() + " object : " + object );
    }