Generate the given object.

@param whileLoop the while-loop.
@param it the target for the generated content.
@param context the context.
@return the last statement in the loop or {@code null}.
422663
protected XExpression _generate(XWhileExpression whileLoop, IAppendable it, IExtraLanguageGeneratorContext context) {
		it.append("while "); //$NON-NLS-1$
		generate(whileLoop.getPredicate(), it, context);
		it.append(":"); //$NON-NLS-1$
		it.increaseIndentation().newLine();
		final XExpression last = generate(whileLoop.getBody(), it, context);
		it.decreaseIndentation();
		return last;
	}
950742
@Override
	public void visitClassContext(ClassContext classContext) {
		try {
			stack = new OpcodeStack();
			localMethodCalls = new HashMap<>();
			fieldMethodCalls = new HashMap<>();
			staticMethodCalls = new HashMap<>();
			branchTargets = new BitSet();
			super.visitClassContext(classContext);
		} finally {
			stack = null;
			localMethodCalls = null;
			fieldMethodCalls = null;
			staticMethodCalls = null;
			branchTargets = null;
		}
	}
403388
def loop(self):
        """"""
        if not self._loop:
            self._loop = IOLoop.current()
            return self._loop
        return self._loop
1302265
public static Statement forLoop(String localVar, Expression limit, Statement body) {
    return For.create(localVar, Expression.number(0), limit, Expression.number(1), body);
  }
595906
protected XExpression _generate(XBlockExpression block, IAppendable it, IExtraLanguageGeneratorContext context) {
		XExpression last = block;
		if (block.getExpressions().isEmpty()) {
			it.append("pass"); //$NON-NLS-1$
		} else {
			it.openScope();
			if (context.getExpectedExpressionType() == null) {
				boolean first = true;
				for (final XExpression expression : block.getExpressions()) {
					if (first) {
						first = false;
					} else {
						it.newLine();
					}
					last = generate(expression, it, context);
				}
			} else {
				final List<XExpression> exprs = block.getExpressions();
				if (!exprs.isEmpty()) {
					for (int i = 0; i < exprs.size() - 1; ++i) {
						if (i > 0) {
							it.newLine();
						}
						last = generate(exprs.get(i), it, context);
					}
					last = generate(exprs.get(exprs.size() - 1), context.getExpectedExpressionType(), it, context);
				}
			}
			it.closeScope();
		}
		return last;
	}
91641
@Benchmark
    public long notJmhEventLoop(StreamObjects streamObjects) throws Exception {
        ANOTHER_EVENT_LOOP.execute(() -> {
            final StreamMessage<Integer> stream = newStream(streamObjects);
            stream.subscribe(streamObjects.subscriber, ANOTHER_EVENT_LOOP);
            streamObjects.writeAllValues(stream);
        });
        streamObjects.completedLatch.await(10, TimeUnit.SECONDS);
        return streamObjects.computedSum();
    }
146138
NullnessPropagationTransfer setContext(@Nullable Context context) {
    // This is a best-effort check (similar to ArrayList iterators, for instance), no guarantee
    Preconditions.checkArgument(
        context == null || this.context == null,
        "Context already set: reset after use and don't use this class concurrently");
    this.context = context;
    // Clear traversed set just-in-case as this marks the beginning or end of analyzing a method
    this.traversed.clear();
    // Null out local inference results when leaving a method
    this.inferenceResults = null;
    return this;
  }
1088856
public boolean execute(Context context)
     throws Exception {
        if(context == null)
            throw new IllegalArgumentException();

        if(!_frozen)
            _frozen = true;

        boolean result = false;
        Exception saveException = null;
        for(int i = 0; i < _commands.length; i++) {
            try {
                result = _commands[i].execute(context);
                if(result)
                    break;
            }
            catch(Exception e) {
                saveException = e;
            }
        }

        if(saveException != null)
            throw saveException;
        else return result;
    }
1032296
@Override
    public void visitClassContext(ClassContext classContext) {
        if ((collectionClass == null) || (iteratorClass == null)) {
            return;
        }

        try {
            collectionGroups = new ArrayList<>();
            groupToIterator = new HashMap<>();
            loops = new HashMap<>(10);
            super.visitClassContext(classContext);
        } finally {
            collectionGroups = null;
            groupToIterator = null;
            loops = null;
            endOfScopes = null;
        }
    }
1018761
void timerLoop() throws ResourceException
    {
        final String methodName = "timerLoop";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName);
        }

        checkMEs(getMEsToCheck());

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.exit(TRACE, methodName);
        }
    }
851585
protected void _generate(SarlEvent event, IExtraLanguageGeneratorContext context) {
		final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(event);
		final PyAppendable appendable = createAppendable(jvmType, context);
		final List<JvmTypeReference> superTypes;
		if (event.getExtends() != null) {
			superTypes = Collections.singletonList(event.getExtends());
		} else {
			superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Event.class, event));
		}
		if (generateTypeDeclaration(
				this.qualifiedNameProvider.getFullyQualifiedName(event).toString(),
				event.getName(), event.isAbstract(), superTypes,
				getTypeBuilder().getDocumentation(event),
				true,
				event.getMembers(), appendable, context, null)) {
			final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(event);
			writeFile(name, appendable, context);
		}
	}
422463
protected XExpression _generate(XTryCatchFinallyExpression tryStatement, IAppendable it, IExtraLanguageGeneratorContext context) {
		it.append("try:"); //$NON-NLS-1$
		it.increaseIndentation().newLine();
		generate(tryStatement.getExpression(), context.getExpectedExpressionType(), it, context);
		it.decreaseIndentation().newLine();
		for (final XCatchClause clause : tryStatement.getCatchClauses()) {
			it.append("except "); //$NON-NLS-1$
			it.append(clause.getDeclaredParam().getParameterType().getType());
			it.append(", "); //$NON-NLS-1$
			it.append(it.declareUniqueNameVariable(clause.getDeclaredParam(), clause.getDeclaredParam().getSimpleName()));
			it.append(":"); //$NON-NLS-1$
			it.increaseIndentation().newLine();
			generate(clause.getExpression(), context.getExpectedExpressionType(), it, context);
			it.decreaseIndentation().newLine();
		}
		if (tryStatement.getFinallyExpression() != null) {
			it.append("finally:"); //$NON-NLS-1$
			it.increaseIndentation().newLine();
			generate(tryStatement.getFinallyExpression(), it, context);
			it.decreaseIndentation();
		}
		return tryStatement;
	}
1035835
public void generate(Context context) {
        Appendable target = context.getTarget();

        for (ProcTemplateElement element : elements) {
            try {
                target.append(element.generate(context));
            } catch (IOException e) {
                // Nothing! Because StringBuilder doesn't catch IOException
            }
        }
    }
354138
public boolean process(Context context) throws NestingException {
        for(ProcPattern pattern: patterns){
            Context codeContext = new Context(context);
            if (pattern.parse(codeContext)) {
                if(transparent) {
                    codeContext.mergeWithParent();
                }
                template.generate(codeContext);

                if(logContext.isTraceEnabled()){
                    for(Map.Entry<String, CharSequence> entry:context.getAttributes().entrySet()){
                        logContext.trace("Context: {} = {}", entry.getKey(), entry.getValue());
                    }
                }

                if(logGenerate.isTraceEnabled()){
                    logGenerate.trace("Generated text: {}", codeContext.getTarget());
                }

                return true;
            }
        }

        return false;
    }
955421
protected void postProcessApplicationContext(ConfigurableApplicationContext context) {
		if (this.beanNameGenerator != null) {
			context.getBeanFactory().registerSingleton(
					AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR,
					this.beanNameGenerator);
		}
		if (this.resourceLoader != null) {
			if (context instanceof GenericApplicationContext) {
				((GenericApplicationContext) context)
						.setResourceLoader(this.resourceLoader);
			}
			if (context instanceof DefaultResourceLoader) {
				((DefaultResourceLoader) context)
						.setClassLoader(this.resourceLoader.getClassLoader());
			}
		}
		if (this.addConversionService) {
			context.getBeanFactory().setConversionService(
					ApplicationConversionService.getSharedInstance());
		}
	}
228096
public void loop(int count) throws ExecutionException, InterruptedException {
        if (count == -1) {
            while (true) {
                print(context.nextPacket());
            }
        } else {
            for (int i = 0; i < count; i++) {
                print(context.nextPacket());
            }
            executorService.shutdownNow();
        }
    }
239284
public boolean parse(Context context) throws NestingException {
        boolean flag = true;
        Source source = context.getSource();
        int offset = source.getOffset();

        // Log start parsing
        if (log.isTraceEnabled()) {
            log.trace("[{}] Begin {}", offset, this);
        }

        int i;
        for (i = 0; i < patternSize && flag; i++) {
            ProcPatternElement current = elements.get(i);
            ProcPatternElement next;
            if (i < patternSize - 1) {
                next = elements.get(i + 1);
            } else {
                next = context.getTerminator();
            }
            flag = current.parse(context, next);
        }

        if (!flag) {
            if (log.isTraceEnabled()) {
                log.trace("[{}] Rollback {} on {} element", source.getOffset(), this, i);
            }

            source.setOffset(offset);
        } else {
            if (log.isTraceEnabled()) {
                log.trace("[{}] Complete {}", source.getOffset(), this);
            }
        }

        return flag;
    }