Copy context from the parent into this instance as well as
        adjusting or depth value to indicate where we exist in a command
        tree.
347183
def parent(self, parent):
        
        self._parent = parent
        if parent:
            pctx = dict((x, getattr(parent, x)) for x in parent.context_keys)
            self.inject_context(pctx)
            self.depth = parent.depth + 1
            for command in self.subcommands.values():
                command.parent = self  # bump.
        else:
            self.depth = 0
1270964
private Context translateContinue(WyilFile.Stmt.Continue stmt, Context context) {
		LoopScope enclosingLoop = context.getEnclosingLoopScope();
		enclosingLoop.addContinueContext(context);
		return null;
	}
820492
def _build_block_context(template, context):
    """"""

    # Ensure there's a BlockContext before rendering. This allows blocks in
    # ExtendsNodes to be found by sub-templates (allowing {{ block.super }} and
    # overriding sub-blocks to work).
    if BLOCK_CONTEXT_KEY not in context.render_context:
        context.render_context[BLOCK_CONTEXT_KEY] = BlockContext()
    block_context = context.render_context[BLOCK_CONTEXT_KEY]

    for node in template.nodelist:
        if isinstance(node, ExtendsNode):
            compiled_parent = node.get_parent(context)

            # Add the parent node's blocks to the context. (This ends up being
            # similar logic to ExtendsNode.render(), where we're adding the
            # parent's blocks to the context so a child can find them.)
            block_context.add_blocks(
                {n.name: n for n in compiled_parent.nodelist.get_nodes_by_type(BlockNode)})

            _build_block_context(compiled_parent, context)
            return compiled_parent

        # The ExtendsNode has to be the first non-text node.
        if not isinstance(node, TextNode):
            break
1058503
def update_context(self, ctx):
        
        assert isinstance(ctx, dict)
        ctx[str(self.context_id)] = self.value
626513
private void initialize(Map context) {
    // Guard against recursion.
    context.put(jsTypeTree, this);

    // Create temporary accumulators for the contents of the fields and variants instance
    // variables.
    List tmpFields = new ArrayList();
    List tmpVariants = new ArrayList();

    // Perform tasks assigned to the recursive 'number' subroutine (see comment there)
    number(jsTypeTree, context, false, 0, tmpFields, tmpVariants);

    // Move information from temporaries into permanent instance variables
    fields = (JSField[])tmpFields.toArray(new JSField[0]);
    variants = (JSVariant[])tmpVariants.toArray(new JSVariant[0]);

    // Compute the contents of the 'boxed' instance variable, which is deriveable from the
    // contents of those JSVariants which have found their way into 'fields.'  These are
    // all intended to be boxed variants because they were detected to be underneath
    // JSRepeated nodes during the 'number' process.
    int boxLen = 0; // accumulate total length of boxed array
    for (int i = 0; i < fields.length; i++)
      if (fields[i] instanceof JSVariant)
        // On the first pass, we box the variant and accumulate its accessor count
        boxLen += ((JSVariant)fields[i]).box(context).getAccessorCount();
    boxed = new int[boxLen][];
    int boxIndex = 0;

    // On the second pass through the boxed variants, we get their accessor count a second
    // time and use it this time to fill in the contents of the 'boxed' instance variable
    // proper.
    for (int i = 0; i < fields.length; i++)
      if (fields[i] instanceof JSVariant)
        for (int j = 0; j < ((JSVariant)fields[i]).getBoxed().getAccessorCount(); j++)
          boxed[boxIndex++] = new int[] { i, j };

    // Set the 'accessor' property of every JSField in the tree (see comment on
    // setAccessors).
    setAccessors(0, this);

    // Set the multiChoiceCount for each node in the tree.  Note this must be done
    // after boxing any variants found underneath JSRepeated nodes, since boxing changes
    // the multiChoiceCount.  setMultiChoiceCount is a recursive method that will set
    // counts starting from the leaves working back to the root.
    jsTypeTree.setMultiChoiceCount();

    // Compute the serialForm if it isn't already there due to the deserializing
    // constructor
    if (serialForm == null) {
      // Store the name in a convenient non-null form
      name = jsTypeTree.getFeatureName();
      if (name == null)
        name = "";
      try {
        byte[] utfname = name.getBytes("UTF8");
        serialForm = new byte[2 + utfname.length + 2 + jsTypeTree.encodedTypeLength()];
        ArrayUtil.writeShort(serialForm, 0, (short)utfname.length);
        System.arraycopy(utfname, 0, serialForm, 2, utfname.length);
        int limits[] = new int[] { 2 + utfname.length, serialForm.length };
        JSType.setCount(serialForm, limits, version);
        jsTypeTree.encodeType(serialForm, limits);
      } catch (UnsupportedEncodingException e) {
        FFDCFilter.processException(e, "initialize", "604");
        IllegalArgumentException ex = new IllegalArgumentException();
        ex.initCause(e);
        throw ex;
      }
    }

    // Compute the schemaID, which is a 64-bit truncated SHA-1 hash over the serialForm.
    schemaID = CryptoHash.hash(serialForm);
    schemaLongID = Long.valueOf(schemaID);
  }
4410
void setParent (Context2 parent)
    {
        this.parent = parent;
        parent.child = this;        // JJK: Doubly-linked
        declarations = null;
        prefixTable = parent.prefixTable;
        uriTable = parent.uriTable;
        elementNameTable = parent.elementNameTable;
        attributeNameTable = parent.attributeNameTable;
        defaultNS = parent.defaultNS;
        tablesDirty = false;
    }
1372898
public static void enrichContext(Context context) {
		context.setPostProperty(Context.MEMORY_TOTAL, Runtime.getRuntime().totalMemory());
		context.setPostProperty(Context.MEMORY_FREE, Runtime.getRuntime().freeMemory());
		context.setPostProperty(Context.MEMORY_USED, Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory());
	}
808714
def set_context(self, new_context):
        """"""
        self._context = new_context

        if hasattr(self, '_set_logging_context'):
            self._set_logging_context(self._context)
222947
def apply(context_scope, locals, &block)
      locals = locals.dup unless locals.nil?

      set_instance_variables!(context_scope, locals)

      reset_settings!
      reset_options!

      eval_source(locals, &block)

      instance_exec(root_object, &block) if block_given?

      self
    end
1249742
protected void insertAtPreferredLocation(Element parent, Element child, Counter counter)
   {
      int contentIndex = 0;
      int elementCounter = 0;
      Iterator it = parent.getContent().iterator();
      Text lastText = null;
      int offset = 0;
      while (it.hasNext() && (elementCounter <= counter.getCurrentIndex()))
      {
         Object next = it.next();
         offset = offset + 1;
         if (next instanceof Element)
         {
            elementCounter = elementCounter + 1;
            contentIndex = contentIndex + offset;
            offset = 0;
         }
         if ((next instanceof Text) && it.hasNext())
         {
            lastText = (Text) next;
         }
      }
      if ((lastText != null) && (lastText.getTextTrim().length() == 0))
      {
         lastText = (Text) lastText.clone();
      }
      else
      {
         StringBuilder starter = new StringBuilder(lineSeparator);
         for (int i = 0; i < counter.getDepth(); i++)
         {
            starter.append("  "); // TODO make settable?
         }
         lastText = factory.text(starter.toString());
      }
      if (parent.getContentSize() == 0)
      {
         Text finalText = (Text) lastText.clone();
         finalText.setText(finalText.getText().substring(0, finalText.getText().length() - "  ".length()));
         parent.addContent(contentIndex, finalText);
      }
      parent.addContent(contentIndex, child);
      parent.addContent(contentIndex, lastText);
   }
1311398
private void fillNodesInContext(SiteNode rootNode, List<SiteNode> nodesList) {
		@SuppressWarnings("unchecked")
		Enumeration<TreeNode> en = rootNode.children();
		while (en.hasMoreElements()) {
			SiteNode sn = (SiteNode) en.nextElement();
			if (isInContext(sn)) {
				nodesList.add(sn);
			}
			fillNodesInContext(sn, nodesList);
		}
	}
445270
def merge_context(self, src=None):
        """"""
        if src is None:
            # This condition will be true only if the server doesn't return a
            # txn context after a query or mutation.
            return

        if self._ctx.start_ts == 0:
            self._ctx.start_ts = src.start_ts
        elif self._ctx.start_ts != src.start_ts:
            # This condition should never be true.
            raise Exception('StartTs mismatch')

        self._ctx.keys.extend(src.keys)
        self._ctx.preds.extend(src.preds)
164367
function NodeContext(msg, parent, nodeContext, serverName) {
    this.msgContext = new mustache.Context(msg, parent);
    this.nodeContext = nodeContext;
    this.serverName = serverName;
}
870226
function(context, descriptor, args) {
		var data = args[0],
			parent = args[1] || context,
			path = args[2];
		descriptor.context = new Context(data, parent, path);
	}
695272
function(contexts) {

        if ( typeof(contexts) == 'undefined' ) {
            var contexts = {
                paths : {}
            }
        }

        self.contexts = contexts;

        if ( typeof(ContextHelper.initialized) != 'undefined' && ContextHelper.instance) {
            self = ContextHelper.instance;
        } else {
            ContextHelper.initialized = true;
            ContextHelper.instance = self
        }



        return self
    }
801181
private void adjustTree(IndexTreePath<E> subtree) {
    final Logging log = getLogger();
    if(log.isDebugging()) {
      log.debugFine("Adjust tree " + subtree + "\n");
    }

    // get the root of the subtree
    int nodeIndex = subtree.getIndex();
    N node = getNode(subtree.getEntry());

    // overflow in node; split the node
    if(hasOverflow(node)) {
      // do the split
      Assignments<E> assignments = settings.splitStrategy.split(this, node);
      final N newNode = node.isLeaf() ? createNewLeafNode() : createNewDirectoryNode();

      List<E> entries1 = new ArrayList<>(assignments.getFirstAssignments().size());
      List<E> entries2 = new ArrayList<>(assignments.getSecondAssignments().size());
      // Store final parent distances:
      for(DistanceEntry<E> ent : assignments.getFirstAssignments()) {
        final E e = ent.getEntry();
        e.setParentDistance(ent.getDistance());
        entries1.add(e);
      }
      for(DistanceEntry<E> ent : assignments.getSecondAssignments()) {
        final E e = ent.getEntry();
        e.setParentDistance(ent.getDistance());
        entries2.add(e);
      }
      node.splitTo(newNode, entries1, entries2);

      // write changes to file
      writeNode(node);
      writeNode(newNode);

      if(log.isDebuggingFine()) {
        log.debugFine(new StringBuilder(1000)//
            .append("Split Node ").append(node.getPageID()).append(" (").append(this.getClass()).append(')').append(FormatUtil.NEWLINE)//
            .append("      newNode ").append(newNode.getPageID()).append(FormatUtil.NEWLINE)//
            .append("      firstPromoted ").append(assignments.getFirstRoutingObject()).append(FormatUtil.NEWLINE)//
            .append("      firstAssignments(").append(node.getPageID()).append(") ").append(assignments.getFirstAssignments()).append(FormatUtil.NEWLINE)//
            .append("      firstCR ").append(assignments.computeFirstCover(node.isLeaf())).append(FormatUtil.NEWLINE)//
            .append("      secondPromoted ").append(assignments.getSecondRoutingObject()).append(FormatUtil.NEWLINE)//
            .append("      secondAssignments(").append(newNode.getPageID()).append(") ").append(assignments.getSecondAssignments()).append(FormatUtil.NEWLINE)//
            .append("      secondCR ").append(assignments.computeSecondCover(node.isLeaf())).append(FormatUtil.NEWLINE));
      }

      // if root was split: create a new root that points the two split nodes
      if(isRoot(node)) {
        // FIXME: stimmen die parentDistance der Kinder in node & splitNode?
        IndexTreePath<E> newRootPath = createNewRoot(node, newNode, assignments.getFirstRoutingObject(), assignments.getSecondRoutingObject());
        adjustTree(newRootPath);
      }
      // node is not root
      else {
        // get the parent and add the new split node
        E parentEntry = subtree.getParentPath().getEntry();
        N parent = getNode(parentEntry);
        if(log.isDebugging()) {
          log.debugFine("parent " + parent);
        }
        double parentDistance2 = distance(parentEntry.getRoutingObjectID(), assignments.getSecondRoutingObject());
        // logger.warning("parent: "+parent.toString()+" split: " +
        // splitNode.toString()+ " dist:"+parentDistance2);
        parent.addDirectoryEntry(createNewDirectoryEntry(newNode, assignments.getSecondRoutingObject(), parentDistance2));

        // adjust the entry representing the (old) node, that has been split
        double parentDistance1 = distance(parentEntry.getRoutingObjectID(), assignments.getFirstRoutingObject());
        // logger.warning("parent: "+parent.toString()+" node: " +
        // node.toString()+ " dist:"+parentDistance1);
        node.adjustEntry(parent.getEntry(nodeIndex), assignments.getFirstRoutingObject(), parentDistance1, this);

        // write changes in parent to file
        writeNode(parent);
        adjustTree(subtree.getParentPath());
      }
    }
    // no overflow, only adjust parameters of the entry representing the node
    else {
      if(!isRoot(node)) {
        E parentEntry = subtree.getParentPath().getEntry();
        N parent = getNode(parentEntry);
        E entry = parent.getEntry(subtree.getIndex());
        boolean changed = node.adjustEntry(entry, entry.getRoutingObjectID(), entry.getParentDistance(), this);
        // write changes in parent to file
        if(changed) {
          writeNode(parent);
          adjustTree(subtree.getParentPath());
        }
      }
      // root level is reached
      else {
        E rootEntry = getRootEntry();
        node.adjustEntry(rootEntry, rootEntry.getRoutingObjectID(), rootEntry.getParentDistance(), this);
      }
    }
  }
772023
def set_context_menu(self, context_menu):
        
        self.context_menu = context_menu
        self.context_menu.tree_view = self
        self.context_menu.init_actions()
        for action in self.context_menu.actions():
            self.addAction(action)