/*
CircuitsExtractor
9187
@Override
    public Map<Circuit, Collection<TileRef>> getCircuits(Collection<Media> levels,
                                                         Media sheetsConfig,
                                                         Media groupsConfig)
    {
        final Collection<MapTile> mapsSet = new HashSet<>(levels.size());
        for (final Media level : levels)
        {
            final Services services = new Services();
            final MapTile map = services.create(MapTileGame.class);
            map.create(level, sheetsConfig);

            final MapTileGroup mapGroup = map.addFeatureAndGet(new MapTileGroupModel());
            final MapTileTransition mapTransition = map.addFeatureAndGet(new MapTileTransitionModel(services));

            mapGroup.loadGroups(groupsConfig);
            mapTransition.loadTransitions(levels, sheetsConfig, groupsConfig);

            mapsSet.add(map);
        }
        return getCircuits(mapsSet);
    }
473973
function captureExpressions(expressionChain, booleans) {
        var expressions, re;

        if (booleans) {
            re = new RegExp(PREFIX + booleans.join(INFIX) + POSTFIX, 'i');
            expressions = expressionChain.match(re);
            expressions.shift(); // discard [0] (input)
        } else {
            expressions = [expressionChain];
        }

        return expressions;
    }
582010
private static Collection<TileRef> getTiles(Map<Circuit, Collection<TileRef>> circuits, Circuit circuit)
    {
        if (!circuits.containsKey(circuit))
        {
            circuits.put(circuit, new HashSet<TileRef>());
        }
        return circuits.get(circuit);
    }
1285317
static <T, S extends Sequence> Comparator<T>
    getComparatorOfObjectsRegardingSequences(final Comparator<T> objectComparator, final SequenceExtractor<T, S> extractor) {
        return new Comparator<T>() {
            @Override
            public int compare(T o1, T o2) {
                int i = objectComparator.compare(o2, o1);  // Reverse comparison
                return i == 0 ?
                        extractor.getSequence(o2).compareTo(extractor.getSequence(o1))
                        : i;
            }
        };
    }
726458
@Override
    public List<AbstractExpression> bindingToIndexedExpression(AbstractExpression expr) {
        if (m_originalValue == null || ! m_originalValue.equals(expr)) {
            return null;
        }
        // This parameter's value was matched, so return this as one bound parameter.
        List<AbstractExpression> result = new ArrayList<AbstractExpression>();
        result.add(this);
        return result;
    }
1096556
private boolean isInstanceofFor(Node expression, Node reference) {
    return expression.isInstanceOf() && expression.getLastChild().isEquivalentTo(reference);
  }
67098
function onClientPreRequestCircuitBreaker (ctx, next) {
  if (ctx._config.circuitBreaker.enabled) {
    // any pattern represent an own circuit breaker
    const circuitBreaker = ctx._circuitBreakerMap.get(ctx.trace$.method);
    if (!circuitBreaker) {
      const cb = new CircuitBreaker(ctx._config.circuitBreaker);
      ctx._circuitBreakerMap.set(ctx.trace$.method, cb);
    } else {
      if (!circuitBreaker.available()) {
        // trigger half-open timer
        circuitBreaker.record();
        return next(new Errors.CircuitBreakerError(
          `Circuit breaker is ${circuitBreaker.state}`,
          { state: circuitBreaker.state, method: ctx.trace$.method, service: ctx.trace$.service }));
      }
    }

    next();
  } else {
    next();
  }
}
286294
function(node){
    var test = null;
    if ('default' != node.expr) {
      test = node.astExpr || this.parseExpr(node.expr);
    }
    var consequent = []
    if (node.block) {
      consequent = this.visit(node.block, node);
      consequent.push(t.breakStatement());
    }
    var c = t.switchCase(test, consequent);
    return [c];
  }
218436
@Override
  public Extractor<S, D> getExtractor(WorkUnitState state) throws IOException {
    Preconditions.checkNotNull(state, "WorkUnitState should not be null");
    LOG.info("WorkUnitState from getExtractor: " + state);

    try {
      //GoogleDriveExtractor needs GoogleDriveFsHelper
      initFileSystemHelper(state);
    } catch (FileBasedHelperException e) {
      throw new IOException(e);
    }

    Preconditions.checkNotNull(fsHelper, "File system helper should not be null");
    return new GoogleDriveExtractor<>(state, fsHelper);
  }
252891
public static CircuitBreakerExports ofCircuitBreaker(CircuitBreaker circuitBreaker) {
        requireNonNull(circuitBreaker);
        return new CircuitBreakerExports(Array.of(circuitBreaker));
    }
184356
function processCodePathToExit(analyzer, node) {
    const codePath = analyzer.codePath;
    const state = CodePath.getState(codePath);
    let dontForward = false;

    switch (node.type) {
        case "IfStatement":
        case "ConditionalExpression":
            state.popChoiceContext();
            break;

        case "LogicalExpression":
            if (isHandledLogicalOperator(node.operator)) {
                state.popChoiceContext();
            }
            break;

        case "SwitchStatement":
            state.popSwitchContext();
            break;

        case "SwitchCase":

            /*
             * This is the same as the process at the 1st `consequent` node in
             * `preprocess` function.
             * Must do if this `consequent` is empty.
             */
            if (node.consequent.length === 0) {
                state.makeSwitchCaseBody(true, !node.test);
            }
            if (state.forkContext.reachable) {
                dontForward = true;
            }
            break;

        case "TryStatement":
            state.popTryContext();
            break;

        case "BreakStatement":
            forwardCurrentToHead(analyzer, node);
            state.makeBreak(node.label && node.label.name);
            dontForward = true;
            break;

        case "ContinueStatement":
            forwardCurrentToHead(analyzer, node);
            state.makeContinue(node.label && node.label.name);
            dontForward = true;
            break;

        case "ReturnStatement":
            forwardCurrentToHead(analyzer, node);
            state.makeReturn();
            dontForward = true;
            break;

        case "ThrowStatement":
            forwardCurrentToHead(analyzer, node);
            state.makeThrow();
            dontForward = true;
            break;

        case "Identifier":
            if (isIdentifierReference(node)) {
                state.makeFirstThrowablePathInTryBlock();
                dontForward = true;
            }
            break;

        case "CallExpression":
        case "MemberExpression":
        case "NewExpression":
            state.makeFirstThrowablePathInTryBlock();
            break;

        case "WhileStatement":
        case "DoWhileStatement":
        case "ForStatement":
        case "ForInStatement":
        case "ForOfStatement":
            state.popLoopContext();
            break;

        case "AssignmentPattern":
            state.popForkContext();
            break;

        case "LabeledStatement":
            if (!astUtils.isBreakableStatement(node.body)) {
                state.popBreakContext();
            }
            break;

        default:
            break;
    }

    // Emits onCodePathSegmentStart events if updated.
    if (!dontForward) {
        forwardCurrentToHead(analyzer, node);
    }
    debug.dumpState(node, state, true);
}
89088
@SuppressWarnings("unchecked")
    public static <T> Expression<T> extract(Expression<T> expr) {
        if (expr != null) {
            final Class<?> clazz = expr.getClass();
            if (clazz == PathImpl.class || clazz == PredicateOperation.class || clazz == ConstantImpl.class) {
                return expr;
            } else {
                return (Expression<T>) expr.accept(ExtractorVisitor.DEFAULT, null);
            }
        } else {
            return null;
        }
    }
390655
function parseExtractor (inp) {
    var match = inp.takeAPeek(EXTRACTOR);
    if (match)
      return wrapped("(", ")", parsePattern, extractorRes, inp)
          || nodeExtractor(match[1]);
  
    function extractorRes (res) {
      return nodeExtractor(match[1], res);
    }
  }
1173809
private IRingSet removeExtraRings(IAtomContainer m) throws Exception {

        IRingSet rs = Cycles.sssr(m).toRingSet();

        //remove rings which dont have all aromatic atoms (according to hybridization set by lower case symbols in smiles):
        Iterator<IAtomContainer> i = rs.atomContainers().iterator();
        while (i.hasNext()) {
            IRing r = (IRing) i.next();
            if (r.getAtomCount() > 8) {
                i.remove();
            } else {
                for (IAtom a : r.atoms()) {
                    Hybridization h = a.getHybridization();
                    if (h == CDKConstants.UNSET || !(h == Hybridization.SP2 || h == Hybridization.PLANAR3)) {
                        i.remove();
                        break;
                    }
                }
            }
        }
        return rs;
    }
1045223
function subtract(otherData, compareExpression) {
	
		//If other data is invalid, return empty array
        if (!otherData)
            return new jslinq([]);
			
        //Data for output
        var outData = [];

        //Check every element of "items"
        for (var n = 0; n < this.items.length; n++) {
		
			//Current element on items
			var currentOnItems = this.items[n];
			
			//Set flag of "found match" as false
			var aMatchWasFound = false;
		
			//Check every element on "otherData"
			for (var i = 0; i < otherData.length; i++) {
			
				//If a match was already found, skip
				if (aMatchWasFound)
					continue;
			
				//Current element on "otherData"
				var currentOnOtherData = otherData[i];
				
				//Fails by default matching of elements
				var doesMatch = false;
			
				//If compare expression was not set
				if (!compareExpression){
				
					//Compare on same instance
					//doesMatch = currentOnItems == currentOnOtherData;
					doesMatch = equals(currentOnItems, currentOnOtherData);					
				}
				else{
				
					//Calculate comparison value for each element
					var comparisonForItems = compareExpression(currentOnItems);
					var comparisonForOtherData = compareExpression(currentOnOtherData);
				
					//Compare result of compare expressions
					//doesMatch = comparisonForItems == comparisonForOtherData;
					doesMatch = equals(comparisonForItems, comparisonForOtherData);
				}
				
				//If there's a match, set the flag
				if (doesMatch){
					aMatchWasFound = true;
				}				
			}
			
			//If no match was found, append element to output
			if (!aMatchWasFound){
				outData.push(currentOnItems);
			}
        }

        //Return for chaining
        return new jslinq(outData);        
    }
111235
public void elemSubtract(VTensor other) {
        checkEqualSize(this, other);
        for (int c = 0; c < this.size(); c++) {
            subtractValue(c, other.getValue(c));
        }
    }
1096065
@Override
    public int drainTo(Collection<? super T> c, int maxElements) {

        //TODO- The elements aren't added to the given collection...

        if (c == null)
            throw new NullPointerException();
        if (c == this)
            throw new IllegalArgumentException();

        int n = Math.min(maxElements, size());

        int numRemaining = n;

        synchronized (this) {
            synchronized (lock) {
                //Retrieve and remove at most n elements from the expedited buffer and add them to the passed collection
                for (int i = 0; i < n; i++) {
                    T retrieved = expeditedExtract();
                    numRemaining = n - i;
                    if (retrieved != null) {
                        numberOfUsedExpeditedSlots.getAndDecrement();
                        //TODO if expedited is added for put or offer with timeout add notification here
                    } else {
                        break; //retrieved is null so nothing left in the expedited buffer, move on to the main buffer
                    }
                }
                //Retrieve and remove at most numRemaining elements and add them to the passed collection
                for (int i = 0; i < numRemaining; i++) {
                    T retrieved = extract();
                    numberOfUsedSlots.getAndDecrement();
                    if (retrieved != null) {
                        notifyPut_();
                    }
                }
            }
        }
        return n;
    }