Replaces stack contents with just one fragment.
188685
public void replace(Fragment fragment) {
        manager.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
        manager.beginTransaction()
            .replace(containerId, fragment, indexToTag(0))
            .commit();
        manager.executePendingTransactions();
    }
1004411
function(fragment, reg, value) {
            if (typeof fragment == 'string') {
                if (fragment.match(reg)) {
                    fragment = fragment.replace(reg, value);
                }
                return fragment;
            }
            else if (typeof fragment == "function") {
                return fragment;
            }
            // watch out for infinite loops.  We make all changes to the array after iteration.

            var keysToRename = {};
            for (var key in fragment) {
                // recurse
                if (typeof fragment[key] == 'object') {
                    Splunk.util.replaceTokens(fragment[key], reg, value);
                }
                // we have hit a string value.
                else if (typeof fragment[key] == 'string' && fragment[key].match(reg)) {
                    fragment[key] = fragment[key].replace(reg, value);
                }
                // now that the value is changed we check the key itself
                if (key.match(reg)) {
                    // mark this to be changed after we're out of the iterator
                    keysToRename[key] = key.replace(reg, value);
                }
            }
            for (oldKey in keysToRename) {
                var newKey = keysToRename[oldKey];
                fragment[newKey] = fragment[oldKey];
                delete(fragment[oldKey]);
            }
            return fragment;
        }
253925
function replaceElementPseudoMentions (element, selector) {
  const processor = selectorParser((selectors) => {
    let nodesToReplace = []

    /**
     * looping breaks if we replace dynamically
     * so instead collect an array of nodes to swap and do it at the end
     */
    selectors.each((selector) => {
      let onElementTag = false

      selector.each((node) => {
        if (node.type === 'tag' && node.value === element.tag) {
          onElementTag = true
        } else if (node.type === 'combinator') {
          onElementTag = false
        } else if (node.type === 'pseudo' && onElementTag) {
          const matchedPseudos = Object.entries(element.pseudos).filter(([ pseudo ]) => {
            return node.value.replace(/::?/, '') === pseudo
          })

          if (matchedPseudos.length > 0) {
            const [, value] = matchedPseudos[0]
            nodesToReplace.push({ node, value })
          }
        }
      })
    })

    nodesToReplace.forEach(({ node, value }) => node.replaceWith(` ${value}`))
  })

  return processor.process(selector).result
}
1081927
def replace(self, child, replacement):
        """"""
        for i in range(len(self.chunks)):
            if self.chunks[i] == child:
                self.chunks[i] = replacement
526312
def pop(self):
        
        if self.next is None:
            raise SimEmptyCallStackError("Cannot pop a frame from an empty call stack.")
        new_list = self.next.copy({})

        if self.state is not None:
            self.state.register_plugin('callstack', new_list)
            self.state.history.recent_stack_actions.append(CallStackAction(
                hash(new_list), len(new_list), 'pop', ret_site_addr=self.ret_addr
            ))

        return new_list
1118256
public static void simplify(Throwable e) {
		if (!isSimplifyStackTrace()) {
			return;
		}

		if (e.getCause() != null) {
			simplify(e.getCause());
		}

		StackTraceElement[] trace = e.getStackTrace();
		
		if (trace == null || trace.length == 0) {
			return;
		}

		List<StackTraceElement> simpleTrace = new ArrayList<StackTraceElement>(
				trace.length);
		simpleTrace.add(trace[0]);

		// Remove unnecessary stack trace elements.
		for (int i = 1; i < trace.length; i++) {
			if (EXCLUDED_STACK_TRACE.matcher(trace[i].getClassName()).matches()) {
				continue;
			}
			simpleTrace.add(trace[i]);
		}
		
		e.setStackTrace(simpleTrace.toArray(new StackTraceElement[simpleTrace
				.size()]));
	}
181309
function replaceAt(items, item, index) {
  var copy = items.slice();
  copy.splice(index, 1, item);
  return copy;
}
518359
def replace_with(self, other):
        """"""
        self.after(other)
        self.parent.pop(self._own_index)
        return other
1011764
def Pop(self, index=0):
    """"""
    if index < 0:
      index += len(self)

    if index == 0:
      result = self.__class__()
      result.SetRawData(self.GetRawData())

      self.SetRawData(self.nested_path.GetRawData())

    else:
      # Get the raw protobufs for the previous member.
      previous = self[index - 1]

      result = previous.nested_path

      # Manipulate the previous members protobuf to patch the next component in.
      previous.nested_path = result.nested_path

    result.nested_path = None

    return result
865271
def fragment(self, fragsize=1392):
        """"""
        fnb = 0
        fl = self
        lst = list()
        while fl.underlayer is not None:
            fnb += 1
            fl = fl.underlayer

        for p in fl:
            s = raw(p[fnb].payload)
            nb = (len(s) + fragsize) // fragsize
            for i in range(nb):
                q = p.copy()
                del q[fnb].payload
                q[fnb].len = SOMEIP.LEN_OFFSET_TP + \
                    len(s[i * fragsize:(i + 1) * fragsize])
                q[fnb].more_seg = 1
                if i == nb - 1:
                    q[fnb].more_seg = 0
                q[fnb].offset += i * fragsize // 16
                r = conf.raw_layer(load=s[i * fragsize:(i + 1) * fragsize])
                r.overload_fields = p[fnb].payload.overload_fields.copy()
                q.add_payload(r)
                lst.append(q)

        return lst
1174056
def replace_one(self, replacement):
        
        self.__bulk.add_replace(self.__selector, replacement, upsert=True,
                                collation=self.__collation)
316257
function Stack(global1, local, scope, stack) {
            this.global = global1 != null ? global1 : global;
            this.local = local != null ? local : {};
            this.scope = scope != null ? scope : [];
            this.stack = stack != null ? stack : [];
        }
62110
function destroy(stack) {
  if (stack.length > 0) {
    for (const chunk of stack) {
      if (isTemplateResult(chunk)) {
        chunk.destroy(true);
      }
    }
  }
  stack.length = 0;
}
803003
public static List<StackTraceElement> cleanup(StackTraceElement[] stack) {
        List<StackTraceElement> elements = new ArrayList<>();
        if (stack == null) {
            return elements;
        } else {
            for (StackTraceElement element : stack) {
                // Remove all iPOJO calls.
                if (element.getMethodName().startsWith("__M_")) {
                    String newMethodName = element.getMethodName().substring("__M_".length());
                    elements.add(new StackTraceElement(element.getClassName(), newMethodName, element.getFileName(),
                            element.getLineNumber()));
                } else if (element.getLineNumber() >= 0) {
                    elements.add(element);
                }
            }
        }
        return elements;
    }
1280111
@Override
    public void dup()
    {
        if (top < 1)
        {
            throw new EmptyStackException();
        }
        if (top >= stack.length)
        {
            stack = Arrays.copyOf(stack, (int) (stack.length*growFactor));
        }
        top++;
        stack[top-1] = stack[top-2];
    }
305758
public static <T extends AbstractJaxb> void replaceDescendants(T target,
            String clazz, T replace) throws TagTypeUnmatchException {
        execute(target, null, clazz, replace);
    }
681942
function() {
			var context = this.loopContext;
			var forkContext = this.forkContext;
			var leftSegments = forkContext.makeDisconnected(-1, -1);

			// Update state.
			context.prevSegments = forkContext.head;
			context.leftSegments = context.continueDestSegments = leftSegments;
			forkContext.replaceHead(leftSegments);
		}