Constructs a CoverageExtractor for a given container using the coverage
        instructions provided by its accompanying bug description.
498507
def build(installation: 'BugZoo',
              container: Container
              ) -> 'CoverageExtractor':
        
        bug = installation.bugs[container.bug]  # type: Bug
        instructions = bug.instructions_coverage
        if instructions is None:
            raise exceptions.NoCoverageInstructions

        name = instructions.__class__.registered_under_name()
        extractor_cls = _NAME_TO_EXTRACTOR[name]
        builder = extractor_cls.from_instructions
        extractor = builder(installation, container, instructions)
        return extractor
15004
protected ExpressionContextDescription getExpressionContextDescription() {
		for (final CodeElementExtractor.ElementDescription containerDescription : getCodeElementExtractor().getTopElements(
				getGrammar(), getCodeBuilderConfig())) {
			final AbstractRule rule = getMemberRule(containerDescription);
			if (rule != null) {
				final Pattern fieldTypePattern = Pattern.compile(getExpressionConfig().getExpressionFieldTypenamePattern());
				final ExpressionContextDescription description = getCodeElementExtractor().visitMemberElements(
						containerDescription, rule, null,
					(it, grammarContainer, memberContainer, classifier) -> {
						if (fieldTypePattern.matcher(classifier.getName()).find()) {
							final Assignment expressionAssignment = findAssignmentFromTerminalPattern(
									memberContainer,
									getExpressionConfig().getExpressionGrammarPattern());
							final CodeElementExtractor.ElementDescription memberDescription =
									it.newElementDescription(classifier.getName(), memberContainer,
											classifier, XExpression.class);
							return new ExpressionContextDescription(
									containerDescription,
									memberDescription,
									ensureContainerKeyword(containerDescription.getGrammarComponent()),
									ensureFieldDeclarationKeyword(memberDescription),
									expressionAssignment);
						}
						return null;
					},
					null);
				if (description != null) {
					return description;
				}
			}
		}
		return null;
	}
221281
public static <T extends Case1<A>, A> Case1Extractor<T, A> create(Class<T> caseClazz) {
    return new Case1Extractor<>(caseClazz);
  }
682711
private CoverageClassVisitor createCoverageClassVisitor(String className, ClassWriter cv, boolean isRedefined) {
        // We cannot change classfiles if class is being redefined.
        return new CoverageClassVisitor(className, cv);
    }
230884
public CoverageBuilder analyzeFiles(ExecutionDataStore executionDataStore, Collection<File> classFiles) {
    CoverageBuilder coverageBuilder = new CoverageBuilder();
    if (useCurrentBinaryFormat) {
      Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
      for (File classFile : classFiles) {
        analyzeClassFile(analyzer, classFile);
      }
    } else {
      org.jacoco.previous.core.analysis.Analyzer analyzer = new org.jacoco.previous.core.analysis.Analyzer(executionDataStore, coverageBuilder);
      for (File classFile : classFiles) {
        analyzeClassFile(analyzer, classFile);
      }
    }
    return coverageBuilder;
  }
1297905
public static Component scan(Component root, ScannerMatcher matcher) {
        if (matcher.matches(root)) return root;
        if (!(root instanceof Container)) return null;
        Container container = (Container) root;
        for (Component component : container.getComponents()) {
            Component found = scan(component, matcher);
            if (found != null) return found;
        }
        return null;
    }
881568
function(app, options) {
  let map = istanbul.libCoverage.createCoverageMap();
  app.post(WRITE_COVERAGE,
    bodyParser,
    coverageHandler.bind(null, map, options),
    logError);
}
190286
function(app, options) {
  app.post(WRITE_COVERAGE,
    bodyParser,
    (req, res) => {
      let map = istanbul.libCoverage.createCoverageMap();
      coverageHandler(map, options, req, res);
    },
    logError);
}
18262
private AssumptionSet generateFunctionOrMethodAssumptionSet(WyilFile.Decl.FunctionOrMethod declaration,
			LocalEnvironment environment) {
		Tuple<WyilFile.Decl.Variable> parameters = declaration.getParameters();
		Expr[] preconditions = new Expr[declaration.getRequires().size()];
		Expr[] arguments = new Expr[parameters.size()];
		// Translate parameters as arguments to invocation
		for (int i = 0; i != arguments.length; ++i) {
			WyilFile.Decl.Variable var = parameters.get(i);
			WyalFile.VariableDeclaration versionedVar = environment.read(var);
			arguments[i] = new Expr.VariableAccess(versionedVar);
		}
		//
		for (int i = 0; i != preconditions.length; ++i) {
			WyalFile.Name name = convert(declaration.getQualifiedName(), "_requires_" + i, declaration.getName());
			preconditions[i] = new Expr.Invoke(null, name, null, arguments);
		}
		// Add all the preconditions as assupmtions
		return AssumptionSet.ROOT.add(preconditions);
	}
783269
protected static ReturnCode createExtractor() {
        if (!extractorCreated) {
            createExtractor_rc = SelfExtractor.buildInstance();
            extractor = SelfExtractor.getInstance();
            extractorCreated = true;
        }
        return createExtractor_rc;
    }
934077
@Override
    public void execute() throws MojoFailureException
    {
        if ( "pom".equals( project.getPackaging() ) )
        {
            getLog().info( "Skipping SCoverage execution for project with packaging type 'pom'" );
            //for aggragetor mojo - list of submodules: List<MavenProject> modules = project.getCollectedProjects();
            return;
        }

        if ( skip )
        {
            getLog().info( "Skipping Scoverage execution" );
            return;
        }

        long ts = System.currentTimeMillis();

        SCoverageForkedLifecycleConfigurator.afterForkedLifecycleExit( project, reactorProjects );

        if ( !dataDirectory.exists() || !dataDirectory.isDirectory() )
        {
            getLog().info( "Cannot perform check, instrumentation not performed - skipping" );
            return;
        }

        File coverageFile = Serializer.coverageFile( dataDirectory );
        if ( !coverageFile.exists() )
        {
            getLog().info( "Scoverage data file does not exist. Skipping check" );
            return;
        }
        if ( !coverageFile.isFile() )
        {
            getLog().info( "Scoverage data file is a directory, not a file. Skipping check" );
            return;
        }

        Coverage coverage = Serializer.deserialize( coverageFile );
        List<File> measurementFiles = Arrays.asList( IOUtils.findMeasurementFiles( dataDirectory ) );
        scala.collection.Set<Object> measurements = IOUtils.invoked( JavaConverters.asScalaBuffer( measurementFiles ) );
        coverage.apply( measurements );

        int branchCount = coverage.branchCount();
        int statementCount = coverage.statementCount();
        int invokedBranchesCount = coverage.invokedBranchesCount();
        int invokedStatementCount = coverage.invokedStatementCount();

        getLog().info( String.format( "Statement coverage.: %s%%", coverage.statementCoverageFormatted() ) );
        getLog().info( String.format( "Branch coverage....: %s%%", coverage.branchCoverageFormatted() ) );
        getLog().debug( String.format( "invokedBranchesCount:%d / branchCount:%d, invokedStatementCount:%d / statementCount:%d",
                                      invokedBranchesCount, branchCount, invokedStatementCount, statementCount ) );
        if ( minimumCoverage > 0.0 )
        {
            String minimumCoverageFormatted = scoverage.DoubleFormat.twoFractionDigits( minimumCoverage );
            if ( is100( minimumCoverage ) && is100( coverage.statementCoveragePercent() ) )
            {
                getLog().info( "100% Coverage !" );
            }
            else if ( coverage.statementCoveragePercent() < minimumCoverage )
            {
                getLog().error( String.format( "Coverage is below minimum [%s%% < %s%%]",
                                               coverage.statementCoverageFormatted(), minimumCoverageFormatted ) );
                if ( failOnMinimumCoverage )
                {
                    throw new MojoFailureException( "Coverage minimum was not reached" );
                }
            }
            else
            {
                getLog().info( String.format( "Coverage is above minimum [%s%% >= %s%%]",
                                              coverage.statementCoverageFormatted(), minimumCoverageFormatted ) );
            }
        }

        long te = System.currentTimeMillis();
        getLog().debug( String.format( "Mojo execution time: %d ms", te - ts ) );
    }
139301
public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
		setTypeResolutionContext(context);
		if (this.sarlEnumLiteral == null) {
			this.container = container;
			this.sarlEnumLiteral = SarlFactory.eINSTANCE.createSarlEnumLiteral();
			this.sarlEnumLiteral.setName(name);
			container.getMembers().add(this.sarlEnumLiteral);
		}
	}
740231
public static Matcher<AssertTree> assertionWithCondition(
      final Matcher<ExpressionTree> conditionMatcher) {
    return new Matcher<AssertTree>() {
      @Override
      public boolean matches(AssertTree tree, VisitorState state) {
        return conditionMatcher.matches(tree.getCondition(), state);
      }
    };
  }
510061
public @Nonnull BugPattern getBugPattern() {
        BugPattern result = DetectorFactoryCollection.instance().lookupBugPattern(getType());
        if (result != null) {
            return result;
        }
        AnalysisContext.logError("Unable to find description of bug pattern " + getType());
        result = DetectorFactoryCollection.instance().lookupBugPattern("UNKNOWN");
        if (result != null) {
            return result;
        }
        return BugPattern.REALLY_UNKNOWN;
    }
198893
function (coverageId, webCoverageService) {
            if (!coverageId) {
                throw new ArgumentError(
                    Logger.logMessage(Logger.LEVEL_SEVERE, "WcsUrlBuilder", "constructor", "missingId"));
            }

            if (!webCoverageService) {
                throw new ArgumentError(
                    Logger.logMessage(Logger.LEVEL_SEVERE, "WcsUrlBuilder", "constructor", "missingWebCoverageService"));
            }

            /**
             * The Coverage id or name.
             * @type {*|String}
             */
            this.coverageId = coverageId;

            /**
             * The WebCoverageService object which provided this coverage.
             * @type {*|WebCoverageService|String}
             */
            this.service = webCoverageService;
        }
746309
@SuppressWarnings("checkstyle:all")
	protected void generateTopElement(TopElementDescription description,
			boolean forInterface, boolean forAppender) {
		final AtomicBoolean isExtendKeywordFound = new AtomicBoolean(false);
		final AtomicBoolean isExtendsKeywordFound = new AtomicBoolean(false);
		final AtomicBoolean isImplementKeywordFound = new AtomicBoolean(false);
		final AtomicBoolean isImplementsKeywordFound = new AtomicBoolean(false);
		final AtomicBoolean isAnnotated = new AtomicBoolean(false);
		final AtomicBoolean hasModifiers = new AtomicBoolean(false);
		final AtomicBoolean hasTypeParameters = new AtomicBoolean(false);
		AbstractRule memberRule = null;

		for (Assignment assignment : GrammarUtil.containedAssignments(description.getElementDescription().getGrammarComponent())) {
			if (Objects.equals(getCodeBuilderConfig().getModifierListGrammarName(), assignment.getFeature())) {
				hasModifiers.set(true);
			} else if (Objects.equals(getCodeBuilderConfig().getTypeParameterListGrammarName(), assignment.getFeature())) {
					hasTypeParameters.set(true);
			} else if (Objects.equals(getCodeBuilderConfig().getAnnotationListGrammarName(), assignment.getFeature())) {
				isAnnotated.set(true);
			} else if (Objects.equals(getCodeBuilderConfig().getTypeExtensionGrammarName(), assignment.getFeature())) {
				if (Objects.equals("*", assignment.getCardinality()) //$NON-NLS-1$
						|| Objects.equals("+=", assignment.getCardinality()) //$NON-NLS-1$
						|| isExtendKeywordFound.get()) {
					isExtendsKeywordFound.set(true);
				}
				isExtendKeywordFound.set(true);
			} else if (Objects.equals(getCodeBuilderConfig().getTypeImplementationGrammarName(), assignment.getFeature())) {
				if (Objects.equals("*", assignment.getCardinality()) //$NON-NLS-1$
						|| Objects.equals("+=", assignment.getCardinality()) //$NON-NLS-1$
						|| isImplementKeywordFound.get()) {
					isImplementsKeywordFound.set(true);
				}
				isImplementKeywordFound.set(true);
			} else if (Objects.equals(getCodeBuilderConfig().getMemberCollectionExtensionGrammarName(), assignment.getFeature())) {
				if (memberRule == null && assignment.getTerminal() instanceof RuleCall) {
					memberRule = ((RuleCall) assignment.getTerminal()).getRule();
				}
			}
		}

		if (memberRule != null) {
			final EClassifier commonSuperClassifier = getCodeElementExtractor().getGeneratedTypeFor(memberRule);
			getCodeElementExtractor().visitMemberElements(description.getElementDescription(), memberRule,
					(it, grammarContainer, memberContainer, classifier) -> {
						description.getConstructors().add(it.newElementDescription(
								classifier.getName(), memberContainer, classifier, commonSuperClassifier));
						return null;
					},
					(it, grammarContainer, memberContainer, classifier) -> {
						description.getNamedMembers().add(it.newElementDescription(
								classifier.getName(), memberContainer, classifier, commonSuperClassifier));
						return null;
					},
					(it, grammarContainer, memberContainer, classifier) -> {
						description.getUnnamedMembers().add(it.newElementDescription(
								classifier.getName(), memberContainer, classifier, commonSuperClassifier));
						return null;
					});
		}

		String generatedObjectFieldName = Strings.toFirstLower(description.getElementDescription().getElementType().getSimpleName());

		description.setContent(new StringConcatenationClient() {
			@Override
			protected void appendTo(TargetStringConcatenation it) {
				if (!forInterface && !forAppender) {
					it.append("\tprivate "); //$NON-NLS-1$
					it.append(description.getElementDescription().getElementType());
					it.append(" "); //$NON-NLS-1$
					it.append(generatedObjectFieldName);
					it.append(";"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();
					if (description.isMemberElement()) {
						it.append("\tprivate "); //$NON-NLS-1$
						it.append(EObject.class);
						it.append(" container;"); //$NON-NLS-1$
						it.newLineIfNotEmpty();
						it.newLine();
					}
				} else {
					it.append("\t/** Find the reference to the type with the given name."); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @param typeName the fully qualified name of the type"); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @return the type reference."); //$NON-NLS-1$
					it.newLine();
					it.append("\t */"); //$NON-NLS-1$
					it.newLine();
					it.append("\t"); //$NON-NLS-1$
					if (!forInterface) {
						it.append("public "); //$NON-NLS-1$
					}
					it.append(JvmParameterizedTypeReference.class);
					it.append(" newTypeRef(String typeName)"); //$NON-NLS-1$
					if (forInterface) {
						it.append(";"); //$NON-NLS-1$
					} else {
						it.append(" {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\treturn this.builder.newTypeRef(typeName);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t}"); //$NON-NLS-1$
					}
					it.newLineIfNotEmpty();
					it.newLine();
					it.append("\t/** Find the reference to the type with the given name."); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @param context the context for the type reference use"); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @param typeName the fully qualified name of the type"); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @return the type reference."); //$NON-NLS-1$
					it.newLine();
					it.append("\t */"); //$NON-NLS-1$
					it.newLine();
					it.append("\t"); //$NON-NLS-1$
					if (!forInterface) {
						it.append("public "); //$NON-NLS-1$
					}
					it.append(JvmParameterizedTypeReference.class);
					it.append(" newTypeRef("); //$NON-NLS-1$
					it.append(Notifier.class);
					it.append(" context, String typeName)"); //$NON-NLS-1$
					if (forInterface) {
						it.append(";"); //$NON-NLS-1$
					} else {
						it.append(" {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\treturn this.builder.newTypeRef(context, typeName);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t}"); //$NON-NLS-1$
					}
					it.newLineIfNotEmpty();
					it.newLine();
				}
				if (forInterface) {
					it.append("\t/** Replies the context for type resolution."); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @return the context or <code>null</code> if the Ecore object is the context."); //$NON-NLS-1$
					it.newLine();
					it.append("\t */"); //$NON-NLS-1$
					it.newLine();
					it.append("\t"); //$NON-NLS-1$
					it.append(IJvmTypeProvider.class);
					it.append(" getTypeResolutionContext();"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();
				} else if (forAppender) {
					it.append("\tpublic "); //$NON-NLS-1$
					it.append(IJvmTypeProvider.class);
					it.append(" getTypeResolutionContext() {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\treturn this.builder.getTypeResolutionContext();"); //$NON-NLS-1$
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();
				}
				if (forInterface) {
					it.append("\t/** Dispose the resource."); //$NON-NLS-1$
					it.newLine();
					it.append("\t */"); //$NON-NLS-1$
					it.newLine();
					it.append("\tvoid dispose();"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();
				} else if (forAppender) {
					it.append("\t/** Dispose the resource."); //$NON-NLS-1$
					it.newLine();
					it.append("\t */"); //$NON-NLS-1$
					it.newLine();
					it.append("\tpublic void dispose() {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\tthis.builder.dispose();"); //$NON-NLS-1$
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();
				}
				if (!forInterface) {
					it.append("\t@"); //$NON-NLS-1$
					it.append(Override.class);
					it.newLine();
					it.append("\t@"); //$NON-NLS-1$
					it.append(Pure.class);
					it.newLine();
					it.append("\tpublic "); //$NON-NLS-1$
					it.append(String.class);
					it.append(" toString() {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\treturn "); //$NON-NLS-1$
					if (forAppender) {
						it.append("this.builder.toString();"); //$NON-NLS-1$
					} else {
						it.append(EmfFormatter.class);
						it.append(".objToStr("); //$NON-NLS-1$
						it.append(getGeneratedTypeAccessor(description.getElementDescription().getElementType()));
						it.append(");"); //$NON-NLS-1$
					}
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();
				}
				it.append("\t/** Initialize the Ecore element when inside a script."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t"); //$NON-NLS-1$
				if (!forInterface) {
					it.append("public "); //$NON-NLS-1$
				}
				it.append("void eInit("); //$NON-NLS-1$
				it.append(getCodeElementExtractor().getLanguageScriptInterface());
				it.append(" script, String name, "); //$NON-NLS-1$
				it.append(IJvmTypeProvider.class);
				it.append(" context)"); //$NON-NLS-1$
				if (forInterface) {
					it.append(";"); //$NON-NLS-1$
				} else {
					it.append(" {"); //$NON-NLS-1$
					it.newLine();
					if (forAppender) {
						it.append("\t\tthis.builder.eInit(script, name, context);"); //$NON-NLS-1$
					} else {
						it.append("\t\tsetTypeResolutionContext(context);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tif (this."); //$NON-NLS-1$
						it.append(generatedObjectFieldName);
						it.append(" == null) {"); //$NON-NLS-1$
						it.newLine();
						if (description.isMemberElement()) {
							it.append("\t\t\tthis.container = script;"); //$NON-NLS-1$
							it.newLine();
						}
						it.append("\t\t\tthis."); //$NON-NLS-1$
						it.append(generatedObjectFieldName);
						it.append(" = "); //$NON-NLS-1$
						it.append(getXFactoryFor(description.getElementDescription().getElementType()));
						it.append(".eINSTANCE.create"); //$NON-NLS-1$
						it.append(Strings.toFirstUpper(description.getElementDescription().getElementType().getSimpleName()));
						it.append("();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tscript."); //$NON-NLS-1$
						it.append(getLanguageScriptMemberGetter());
						it.append("().add(this."); //$NON-NLS-1$
						it.append(generatedObjectFieldName);
						it.append(");"); //$NON-NLS-1$
						it.newLine();
						if (description.isAnnotationInfo()) {
							final TypeReference commonType = description.getElementDescription().getCommonSuperType();
							it.append("\t\t\tthis."); //$NON-NLS-1$
							it.append(generatedObjectFieldName);
							it.append(".setAnnotationInfo("); //$NON-NLS-1$
							it.append(getXFactoryFor(commonType));
							it.append(".eINSTANCE.create"); //$NON-NLS-1$
							it.append(Strings.toFirstUpper(commonType.getSimpleName()));
							it.append("());"); //$NON-NLS-1$
							it.newLine();
						}
						it.append("\t\t\tif (!"); //$NON-NLS-1$
						it.append(Strings.class);
						it.append(".isEmpty(name)) {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tthis."); //$NON-NLS-1$
						it.append(generatedObjectFieldName);
						it.append(".setName(name);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t}"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t}"); //$NON-NLS-1$
					}
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();
				if (description.isMemberElement()) {
					it.append("\t/** Initialize the Ecore element when inner type declaration."); //$NON-NLS-1$
					it.newLine();
					it.append("\t */"); //$NON-NLS-1$
					it.newLine();
					it.append("\t"); //$NON-NLS-1$
					if (!forInterface) {
						it.append("public "); //$NON-NLS-1$
					}
					it.append("void eInit("); //$NON-NLS-1$
					it.append(getCodeElementExtractor().getLanguageTopElementType());
					it.append(" container, String name, "); //$NON-NLS-1$
					it.append(IJvmTypeProvider.class);
					it.append(" context)"); //$NON-NLS-1$
					if (forInterface) {
						it.append(";"); //$NON-NLS-1$
					} else {
						it.append(" {"); //$NON-NLS-1$
						it.newLine();
						if (forAppender) {
							it.append("\t\tthis.builder.eInit(container, name, context);"); //$NON-NLS-1$
						} else {
							it.append("\t\tif (this."); //$NON-NLS-1$
							it.append(generatedObjectFieldName);
							it.append(" == null) {"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t\tthis.container = container;"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t\tthis."); //$NON-NLS-1$
							it.append(generatedObjectFieldName);
							it.append(" = "); //$NON-NLS-1$
							it.append(getXFactoryFor(description.getElementDescription().getElementType()));
							it.append(".eINSTANCE.create"); //$NON-NLS-1$
							it.append(Strings.toFirstUpper(description.getElementDescription().getElementType().getSimpleName()));
							it.append("();"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t\tcontainer."); //$NON-NLS-1$
							it.append(getLanguageContainerMemberGetter());
							it.append("().add(this."); //$NON-NLS-1$
							it.append(generatedObjectFieldName);
							it.append(");"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t\tif (!"); //$NON-NLS-1$
							it.append(Strings.class);
							it.append(".isEmpty(name)) {"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t\t\tthis."); //$NON-NLS-1$
							it.append(generatedObjectFieldName);
							it.append(".setName(name);"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t\t}"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t}"); //$NON-NLS-1$
						}
						it.newLine();
						it.append("\t}"); //$NON-NLS-1$
					}
					it.newLineIfNotEmpty();
					it.newLine();
				}
				it.append("\t/** Replies the generated " //$NON-NLS-1$
						+ description.getElementDescription().getElementType().getSimpleName() + "."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\t"); //$NON-NLS-1$
				if (!forInterface) {
					it.append("public "); //$NON-NLS-1$
				}
				it.append(description.getElementDescription().getElementType());
				it.append(" "); //$NON-NLS-1$
				it.append(getGeneratedTypeAccessor(description.getElementDescription().getElementType()));
				if (forInterface) {
					it.append(";"); //$NON-NLS-1$
				} else {
					it.append(" {"); //$NON-NLS-1$
					it.newLine();
					if (forAppender) {
						it.append("\t\treturn this.builder."); //$NON-NLS-1$
						it.append(getGeneratedTypeAccessor(description.getElementDescription().getElementType()));
						it.append(";"); //$NON-NLS-1$
					} else {
						it.append("\t\treturn this."); //$NON-NLS-1$
						it.append(generatedObjectFieldName);
						it.append(";"); //$NON-NLS-1$
					}
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the resource to which the " //$NON-NLS-1$
						+ description.getElementDescription().getElementType().getSimpleName() + " is attached."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\t"); //$NON-NLS-1$
				if (!forInterface) {
					it.append("public "); //$NON-NLS-1$
				}
				it.append(Resource.class);
				it.append(" eResource()"); //$NON-NLS-1$
				if (forInterface) {
					it.append(";"); //$NON-NLS-1$
				} else {
					it.append(" {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\treturn "); //$NON-NLS-1$
					it.append(getGeneratedTypeAccessor(description.getElementDescription().getElementType()));
					it.append(".eResource();"); //$NON-NLS-1$
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();
				it.append(generateStandardCommentFunctions(forInterface, forAppender,
						getGeneratedTypeAccessor(description.getElementDescription().getElementType())));
				if (isExtendKeywordFound.get()) {
					String defaultType = getCodeBuilderConfig().getDefaultSupers().get(
							description.getElementDescription().getElementType().getSimpleName());
					if (isExtendsKeywordFound.get()) {
						it.append("\t/** Add the super type."); //$NON-NLS-1$
						it.newLine();
						it.append("\t * @param superType the qualified name of the super type."); //$NON-NLS-1$
						it.newLine();
						it.append("\t */"); //$NON-NLS-1$
						it.newLine();
						it.append("\t"); //$NON-NLS-1$
						if (!forInterface) {
							it.append("public "); //$NON-NLS-1$
						}
						it.append("void addExtends(String superType)"); //$NON-NLS-1$
					} else {
						it.append("\t/** Change the super type."); //$NON-NLS-1$
						it.newLine();
						it.append("\t * @param superType the qualified name of the super type,"); //$NON-NLS-1$
						it.newLine();
						it.append("\t *     or <code>null</code> if the default type."); //$NON-NLS-1$
						it.newLine();
						it.append("\t */"); //$NON-NLS-1$
						it.newLine();
						it.append("\t"); //$NON-NLS-1$
						if (!forInterface) {
							it.append("public "); //$NON-NLS-1$
						}
						it.append("void setExtends(String superType)"); //$NON-NLS-1$
					}
					if (forInterface) {
						it.append(";"); //$NON-NLS-1$
					} else {
						it.append(" {"); //$NON-NLS-1$
						it.newLine();
						if (forAppender) {
							if (isExtendsKeywordFound.get()) {
								it.append("\t\tthis.builder.addExtends(superType);"); //$NON-NLS-1$
							} else {
								it.append("\t\tthis.builder.setExtends(superType);"); //$NON-NLS-1$
							}
						} else {
							it.append("\t\tif (!"); //$NON-NLS-1$
							it.append(Strings.class);
							it.append(".isEmpty(superType)"); //$NON-NLS-1$
							if (!Strings.isEmpty(defaultType)) {
								it.newLine();
								it.append("\t\t\t\t&& !"); //$NON-NLS-1$
								it.append(new TypeReference(defaultType));
								it.append(".class.getName().equals(superType)"); //$NON-NLS-1$
							}
							it.append(") {"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t\t"); //$NON-NLS-1$
							it.append(JvmParameterizedTypeReference.class);
							it.append(" superTypeRef = newTypeRef(this."); //$NON-NLS-1$
							if (description.isMemberElement()) {
								it.append("container"); //$NON-NLS-1$
							} else {
								it.append(generatedObjectFieldName);
							}
							it.append(", superType);"); //$NON-NLS-1$
							it.newLine();
							if (!Strings.isEmpty(defaultType)) {
								it.append("\t\t\t"); //$NON-NLS-1$
								it.append(JvmTypeReference.class);
								it.append(" baseTypeRef = findType(this."); //$NON-NLS-1$
								if (description.isMemberElement()) {
									it.append("container"); //$NON-NLS-1$
								} else {
									it.append(generatedObjectFieldName);
								}
								it.append(", "); //$NON-NLS-1$
								it.append(new TypeReference(defaultType));
								it.append(".class.getCanonicalName());"); //$NON-NLS-1$
								it.newLine();
								it.append("\t\t\tif (isSubTypeOf(this."); //$NON-NLS-1$
								if (description.isMemberElement()) {
									it.append("container"); //$NON-NLS-1$
								} else {
									it.append(generatedObjectFieldName);
								}
								it.append(", superTypeRef, baseTypeRef)) {"); //$NON-NLS-1$
								it.newLine();
								it.append("\t\t\t\t"); //$NON-NLS-1$
							} else {
								it.append("\t\t\t"); //$NON-NLS-1$
							}
							it.append("this."); //$NON-NLS-1$
							it.append(generatedObjectFieldName);
							if (isExtendsKeywordFound.get()) {
								it.append(".getExtends().add(superTypeRef);"); //$NON-NLS-1$
							} else {
								it.append(".setExtends(superTypeRef);"); //$NON-NLS-1$
							}
							it.newLine();
							if (!Strings.isEmpty(defaultType)) {
								it.append("\t\t\t\treturn;"); //$NON-NLS-1$
							} else {
								it.append("\t\t\treturn;"); //$NON-NLS-1$
							}
							it.newLine();
							if (!Strings.isEmpty(defaultType)) {
								it.append("\t\t\t}"); //$NON-NLS-1$
								it.newLine();
							}
							it.append("\t\t}"); //$NON-NLS-1$
							it.newLine();
							if (!isExtendsKeywordFound.get()) {
								it.append("\t\tthis."); //$NON-NLS-1$
								it.append(generatedObjectFieldName);
								it.append(".setExtends(null);"); //$NON-NLS-1$
								it.newLine();
							}
						}
						it.append("\t}"); //$NON-NLS-1$
					}
					it.newLineIfNotEmpty();
					it.newLine();
				}
				if (isImplementKeywordFound.get()) {
					if (isImplementsKeywordFound.get()) {
						it.append("\t/** Add an implemented type."); //$NON-NLS-1$
						it.newLine();
						it.append("\t * @param type the qualified name of the implemented type."); //$NON-NLS-1$
						it.newLine();
						it.append("\t */"); //$NON-NLS-1$
						it.newLine();
						it.append("\t"); //$NON-NLS-1$
						if (!forInterface) {
							it.append("public "); //$NON-NLS-1$
						}
						it.append("void addImplements(String type)"); //$NON-NLS-1$
						if (forInterface) {
							it.append(";"); //$NON-NLS-1$
						} else {
							it.append(" {"); //$NON-NLS-1$
							it.newLine();
							if (forAppender) {
								it.append("\t\tthis.builder.addImplements(type);"); //$NON-NLS-1$
							} else {
								it.append("\t\tif (!"); //$NON-NLS-1$
								it.append(Strings.class);
								it.append(".isEmpty(type)) {"); //$NON-NLS-1$
								it.newLine();
								it.append("\t\t\tthis."); //$NON-NLS-1$
								it.append(generatedObjectFieldName);
								it.append(".getImplements().add(newTypeRef(this."); //$NON-NLS-1$
								if (description.isMemberElement()) {
									it.append("container"); //$NON-NLS-1$
								} else {
									it.append(generatedObjectFieldName);
								}
								it.append(", type));"); //$NON-NLS-1$
								it.newLine();
								it.append("\t\t}"); //$NON-NLS-1$
							}
							it.newLine();
							it.append("\t}"); //$NON-NLS-1$
						}
						it.newLineIfNotEmpty();
						it.newLine();
					} else {
						it.append("\t/** Change the implemented type."); //$NON-NLS-1$
						it.newLine();
						it.append("\t * @param type the qualified name of the implemented type,"); //$NON-NLS-1$
						it.newLine();
						it.append("\t *     or <code>null</code> for nothing."); //$NON-NLS-1$
						it.newLine();
						it.append("\t */"); //$NON-NLS-1$
						it.newLine();
						it.append("\t"); //$NON-NLS-1$
						if (!forInterface) {
							it.append("public "); //$NON-NLS-1$
						}
						it.append("void setImplements(String type)"); //$NON-NLS-1$
						if (forInterface) {
							it.append(";"); //$NON-NLS-1$
						} else {
							it.append(" {"); //$NON-NLS-1$
							it.newLine();
							if (forAppender) {
								it.append("\t\tthis.builder.setImplements(type);"); //$NON-NLS-1$
							} else {
								it.append("\t\tthis."); //$NON-NLS-1$
								it.append(generatedObjectFieldName);
								it.append(".setImplements("); //$NON-NLS-1$
								it.newLine();
								it.append("\t\t\t("); //$NON-NLS-1$
								it.append(Strings.class);
								it.append(".isEmpty(type)) ? null : newTypeRef(this."); //$NON-NLS-1$
								if (description.isMemberElement()) {
									it.append("container"); //$NON-NLS-1$
								} else {
									it.append(generatedObjectFieldName);
								}
								it.append(", type));"); //$NON-NLS-1$
							}
							it.newLine();
							it.append("\t}"); //$NON-NLS-1$
						}
						it.newLineIfNotEmpty();
						it.newLine();
					}
				}
				if (isAnnotated.get()) {
					it.append("\t/** Add an annotation."); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @param type the qualified name of the annotation."); //$NON-NLS-1$
					it.newLine();
					it.append("\t */"); //$NON-NLS-1$
					it.newLine();
					it.append("\t"); //$NON-NLS-1$
					if (!forInterface) {
						it.append("public "); //$NON-NLS-1$
					}
					it.append("void addAnnotation(String type)"); //$NON-NLS-1$
					if (forInterface) {
						it.append(";"); //$NON-NLS-1$
					} else {
						it.append(" {"); //$NON-NLS-1$
						it.newLine();
						if (forAppender) {
							it.append("\t\tthis.builder.addAnnotation(type);"); //$NON-NLS-1$
						} else {
							it.append("\t\tif (!"); //$NON-NLS-1$
							it.append(Strings.class);
							it.append(".isEmpty(type)) {"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t\t"); //$NON-NLS-1$
							it.append(XAnnotation.class);
							it.append(" annotation = "); //$NON-NLS-1$
							it.append(XAnnotationsFactory.class);
							it.append(".eINSTANCE.createXAnnotation();"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t\tannotation.setAnnotationType(newTypeRef(this."); //$NON-NLS-1$
							if (description.isMemberElement()) {
								it.append("container"); //$NON-NLS-1$
							} else {
								it.append(generatedObjectFieldName);
							}
							it.append(", type).getType());"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t\tthis."); //$NON-NLS-1$
							it.append(generatedObjectFieldName);
							it.append(".getAnnotations().add(annotation);"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t}"); //$NON-NLS-1$
						}
						it.newLine();
						it.append("\t}"); //$NON-NLS-1$
					}
					it.newLineIfNotEmpty();
					it.newLine();
				}
				if (hasModifiers.get()) {
					it.append("\t/** Add a modifier."); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @param modifier the modifier to add."); //$NON-NLS-1$
					it.newLine();
					it.append("\t */"); //$NON-NLS-1$
					it.newLine();
					it.append("\t"); //$NON-NLS-1$
					if (!forInterface) {
						it.append("public "); //$NON-NLS-1$
					}
					it.append("void addModifier(String modifier)"); //$NON-NLS-1$
					if (forInterface) {
						it.append(";"); //$NON-NLS-1$
					} else {
						it.append(" {"); //$NON-NLS-1$
						it.newLine();
						if (forAppender) {
							it.append("\t\tthis.builder.addModifier(modifier);"); //$NON-NLS-1$
						} else {
							it.append("\t\tif (!"); //$NON-NLS-1$
							it.append(Strings.class);
							it.append(".isEmpty(modifier)) {"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t\tthis."); //$NON-NLS-1$
							it.append(generatedObjectFieldName);
							it.append(".getModifiers().add(modifier);"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\t}"); //$NON-NLS-1$
						}
						it.newLine();
						it.append("\t}"); //$NON-NLS-1$
					}
					it.newLineIfNotEmpty();
					it.newLine();
				}
				if (hasTypeParameters.get()) {
					if (!forInterface && !forAppender) {
						it.append("\t@"); //$NON-NLS-1$
						it.append(Inject.class);
						it.newLine();
						it.append("\tprivate "); //$NON-NLS-1$
						it.append(Provider.class);
						it.append("<"); //$NON-NLS-1$
						it.append(getTypeParameterBuilderInterface());
						it.append("> iTypeParameterBuilderProvider;"); //$NON-NLS-1$
						it.newLineIfNotEmpty();
						it.newLine();
					}
					it.append("\t/** Add a type parameter."); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @param name the simple name of the type parameter."); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @return the builder of type parameter."); //$NON-NLS-1$
					it.newLine();
					it.append("\t */"); //$NON-NLS-1$
					it.newLine();
					it.append("\t"); //$NON-NLS-1$
					if (!forInterface) {
						it.append("public "); //$NON-NLS-1$
					}
					it.append(getTypeParameterBuilderInterface());
					it.append(" addTypeParameter(String name)"); //$NON-NLS-1$
					if (forInterface) {
						it.append(";"); //$NON-NLS-1$
					} else {
						it.append(" {"); //$NON-NLS-1$
						it.newLine();
						if (forAppender) {
							it.append("\t\treturn this.builder.addTypeParameter(name);"); //$NON-NLS-1$
						} else {
							it.append("\t\t"); //$NON-NLS-1$
							it.append(getTypeParameterBuilderInterface());
							it.append(" builder = this.iTypeParameterBuilderProvider.get();"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\tfinal "); //$NON-NLS-1$
							it.append(description.getElementDescription().getElementType());
							it.append(" object = "); //$NON-NLS-1$
							it.append(getGeneratedTypeAccessor(description.getElementDescription().getElementType()));
							it.append(";"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\tbuilder.eInit(object, name, getTypeResolutionContext());"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\tobject.getTypeParameters().add(builder.getJvmTypeParameter());"); //$NON-NLS-1$
							it.newLine();
							it.append("\t\treturn builder;"); //$NON-NLS-1$
						}
						it.newLine();
						it.append("\t}"); //$NON-NLS-1$
					}
					it.newLineIfNotEmpty();
					it.newLine();
				}
			}
		});
	}
254179
public static synchronized <T> WithOrWithoutExpectedArguments<T> whenNew(Constructor<T> ctor) {
        return new ConstructorAwareExpectationSetup<T>(ctor);
    }