Converts {@code <entrypoint/>} nested elements into Compiler entrypoint
replacements.
185281
private void convertEntryPointParameters(CompilerOptions options) {
    ImmutableList.Builder<ModuleIdentifier> entryPointsBuilder = ImmutableList.builder();
    for (Parameter p : entryPointParams) {
      entryPointsBuilder.add(ModuleIdentifier.forClosure(p.getName()));
    }
    if (this.manageDependencies) {
      options.setDependencyOptions(
          DependencyOptions.pruneLegacyForEntryPoints(entryPointsBuilder.build()));
    }
  }
1014364
private static void elementToEmitter(Element element,
			ConfigurableEmitter emitter) {
		emitter.name = element.getAttribute("name");
		emitter.setImageName(element.getAttribute("imageName"));

		String renderType = element.getAttribute("renderType");
		emitter.usePoints = Particle.INHERIT_POINTS;
		if (renderType.equals("quads")) {
			emitter.usePoints = Particle.USE_QUADS;
		}
		if (renderType.equals("points")) {
			emitter.usePoints = Particle.USE_POINTS;
		}

		String useOriented = element.getAttribute("useOriented");
		if (useOriented != null)
			emitter.useOriented = "true".equals(useOriented);

		String useAdditive = element.getAttribute("useAdditive");
		if (useAdditive != null)
			emitter.useAdditive = "true".equals(useAdditive);

		parseRangeElement(getFirstNamedElement(element, "spawnInterval"),
				emitter.spawnInterval);
		parseRangeElement(getFirstNamedElement(element, "spawnCount"),
				emitter.spawnCount);
		parseRangeElement(getFirstNamedElement(element, "initialLife"),
				emitter.initialLife);
		parseRangeElement(getFirstNamedElement(element, "initialSize"),
				emitter.initialSize);
		parseRangeElement(getFirstNamedElement(element, "xOffset"),
				emitter.xOffset);
		parseRangeElement(getFirstNamedElement(element, "yOffset"),
				emitter.yOffset);
		parseRangeElement(getFirstNamedElement(element, "initialDistance"),
				emitter.initialDistance);
		parseRangeElement(getFirstNamedElement(element, "speed"), emitter.speed);
		parseRangeElement(getFirstNamedElement(element, "length"),
				emitter.length);
		parseRangeElement(getFirstNamedElement(element, "emitCount"),
				emitter.emitCount);

		parseValueElement(getFirstNamedElement(element, "spread"),
				emitter.spread);
		parseValueElement(getFirstNamedElement(element, "angularOffset"),
				emitter.angularOffset);
		parseValueElement(getFirstNamedElement(element, "growthFactor"),
				emitter.growthFactor);
		parseValueElement(getFirstNamedElement(element, "gravityFactor"),
				emitter.gravityFactor);
		parseValueElement(getFirstNamedElement(element, "windFactor"),
				emitter.windFactor);
		parseValueElement(getFirstNamedElement(element, "startAlpha"),
				emitter.startAlpha);
		parseValueElement(getFirstNamedElement(element, "endAlpha"),
				emitter.endAlpha);
		parseValueElement(getFirstNamedElement(element, "alpha"), emitter.alpha);
		parseValueElement(getFirstNamedElement(element, "size"), emitter.size);
		parseValueElement(getFirstNamedElement(element, "velocity"),
				emitter.velocity);
		parseValueElement(getFirstNamedElement(element, "scaleY"),
				emitter.scaleY);

		Element color = getFirstNamedElement(element, "color");
		NodeList steps = color.getElementsByTagName("step");
		emitter.colors.clear();
		for (int i = 0; i < steps.getLength(); i++) {
			Element step = (Element) steps.item(i);
			float offset = Float.parseFloat(step.getAttribute("offset"));
			float r = Float.parseFloat(step.getAttribute("r"));
			float g = Float.parseFloat(step.getAttribute("g"));
			float b = Float.parseFloat(step.getAttribute("b"));

			emitter.addColorPoint(offset, new Color(r, g, b, 1));
		}

		// generate new random play length
		emitter.replay();
	}
431294
public static Map<String, EntryValue> convertBeanToEntryMap(Object bean) {
        Map<String, Object> buildAttributeValueMap = BeanUtilsExtended.buildObjectAttributeMap(bean);
        return Maps.transformEntries(buildAttributeValueMap, new ObjectToEntryValueTransformer());
    }
713043
public static List<ExecutableElement>
            constructorsIn(Iterable<? extends Element> elements) {
        return listFilter(elements, CONSTRUCTOR_KIND, ExecutableElement.class);
    }
708506
def _format_entrypoint_target(ep):
    '''
    
    '''
    s = ep.module_name
    if ep.attrs:
        s += ':' + '.'.join(ep.attrs)
    return s
1188402
protected void parseRootElement() {
    collectElementIds();
    parseDefinitionsAttributes();
    parseImports();
    parseMessages();
    parseSignals();
    parseErrors();
    parseEscalations();
    parseProcessDefinitions();
    parseCollaboration();

    // Diagram interchange parsing must be after parseProcessDefinitions,
    // since it depends and sets values on existing process definition objects
    parseDiagramInterchangeElements();

    for (BpmnParseListener parseListener : parseListeners) {
      parseListener.parseRootElement(rootElement, getProcessDefinitions());
    }
  }
1060622
public static List<StackLine> getStackLines(SrcTree srcTree,
            StackTraceElement[] elements, LineReplacer replacer) {
        List<StackLine> stackLines = new ArrayList<>(elements.length);
        for (StackTraceElement element : elements) {
            StackLine stackLine = getStackLine(srcTree, element, replacer);
            if (stackLine != null) {
                stackLines.add(stackLine);
            }
        }
        return stackLines;
    }
433242
public MultiChangeBuilder<PS, SEG, S> replaceAbsolutely(int start, int end, StyledDocument<PS, SEG, S> replacement) {
        return absoluteReplace(start, end, ReadOnlyStyledDocument.from(replacement));
    }
1360468
@Nullable
  public ELEMENTTYPE replaceTopElement (@Nullable final ELEMENTTYPE aItem)
  {
    if (isEmpty ())
      throw new EmptyStackException ();
    setLast (aItem);
    return aItem;
  }
1150067
protected void transform(final SarlBehaviorUnit source, JvmGenericType container) {
		final GenerationContext context = getContext(container);
		if (source.getName() != null && !Strings.isNullOrEmpty(source.getName().getSimpleName()) && context != null) {
			final XExpression guard = source.getGuard();

			final boolean isTrueGuard;

			// Check the guard value
			if (guard == null) {
				isTrueGuard = true;
			} else if (guard instanceof XBooleanLiteral) {
				final XBooleanLiteral literal = (XBooleanLiteral) guard;
				if (literal.isIsTrue()) {
					isTrueGuard = true;
				} else {
					// The guard is always false => no need to generate the code
					return;
				}
			} else {
				isTrueGuard = false;
			}

			final JvmTypeReference voidType = this._typeReferenceBuilder.typeRef(Void.TYPE);

			//----------------
			// Body function
			//----------------
			// Name
			final String bodyMethodName = Utils.createNameForHiddenEventHandlerMethod(source.getName().getSimpleName(),
					context.getBehaviorUnitIndex());
			// Operation
			final JvmOperation bodyOperation = this.typesFactory.createJvmOperation();
			bodyOperation.setAbstract(false);
			bodyOperation.setNative(false);
			bodyOperation.setSynchronized(false);
			bodyOperation.setStrictFloatingPoint(false);
			bodyOperation.setFinal(false);
			bodyOperation.setVisibility(JvmVisibility.PRIVATE);
			bodyOperation.setStatic(false);
			bodyOperation.setSimpleName(bodyMethodName);
			bodyOperation.setReturnType(voidType);
			// Add to container
			container.getMembers().add(bodyOperation);
			this.associator.associatePrimary(source, bodyOperation);
			// First parameter: occurrence
			JvmFormalParameter jvmParam = this.typesFactory.createJvmFormalParameter();
			jvmParam.setName(this.grammarKeywordAccess.getOccurrenceKeyword());
			jvmParam.setParameterType(this.typeBuilder.cloneWithProxies(source.getName()));
			this.associator.associate(source, jvmParam);
			bodyOperation.getParameters().add(jvmParam);
			// Body
			setBody(bodyOperation, source.getExpression());
			// Annotations
			translateAnnotationsTo(source.getAnnotations(), bodyOperation);
			if (context.getGeneratorConfig2().isGeneratePureAnnotation()
					&& !this.services.getExpressionHelper().hasSideEffects(source.getExpression())) {
				addAnnotationSafe(bodyOperation, Pure.class);
			}

			final Collection<Procedure1<? super ITreeAppendable>> evaluators = context.getGuardEvalationCodeFor(source);
			assert evaluators != null;

			if (isTrueGuard) {
				evaluators.add(it -> {
					it.append(RUNNABLE_COLLECTION);
					it.append(".add(() -> "); //$NON-NLS-1$
					it.append(bodyMethodName);
					it.append("("); //$NON-NLS-1$
					it.append(this.grammarKeywordAccess.getOccurrenceKeyword());
					it.append("));"); //$NON-NLS-1$
				});
			} else {
				assert guard != null;

				//----------------
				// Guard function
				//----------------
				// Name
				final String guardMethodName = Utils.createNameForHiddenGuardEvaluatorMethod(source.getName().getSimpleName(),
						context.getBehaviorUnitIndex());
				// Operation
				final JvmOperation guardOperation = this.typesFactory.createJvmOperation();
				guardOperation.setAbstract(false);
				guardOperation.setNative(false);
				guardOperation.setSynchronized(false);
				guardOperation.setStrictFloatingPoint(false);
				guardOperation.setFinal(false);
				guardOperation.setVisibility(JvmVisibility.PRIVATE);
				guardOperation.setStatic(false);
				guardOperation.setSimpleName(guardMethodName);
				guardOperation.setReturnType(this._typeReferenceBuilder.typeRef(Boolean.TYPE));
				// Add to container
				container.getMembers().add(guardOperation);
				this.associator.associate(source, guardOperation);
				this.associator.associatePrimary(guard, guardOperation);
				// First parameter: it
				jvmParam = this.typesFactory.createJvmFormalParameter();
				jvmParam.setName(this.grammarKeywordAccess.getItKeyword());
				jvmParam.setParameterType(this.typeBuilder.cloneWithProxies(source.getName()));
				this.associator.associate(source, jvmParam);
				guardOperation.getParameters().add(jvmParam);
				// Second parameter: occurrence
				jvmParam = this.typesFactory.createJvmFormalParameter();
				jvmParam.setName(this.grammarKeywordAccess.getOccurrenceKeyword());
				jvmParam.setParameterType(this.typeBuilder.cloneWithProxies(source.getName()));
				this.associator.associate(source, jvmParam);
				guardOperation.getParameters().add(jvmParam);
				// Body
				setBody(guardOperation, guard);
				// Annotations
				appendGeneratedAnnotation(guardOperation, context);
				if (context.getGeneratorConfig2().isGeneratePureAnnotation()) {
					addAnnotationSafe(guardOperation, Pure.class);
				}

				//------------------
				// Handler function
				//------------------
				evaluators.add(it -> {
					it.append("if ("); //$NON-NLS-1$
					it.append(guardMethodName);
					it.append("("); //$NON-NLS-1$
					it.append(this.grammarKeywordAccess.getOccurrenceKeyword());
					it.append(", "); //$NON-NLS-1$
					it.append(this.grammarKeywordAccess.getOccurrenceKeyword());
					it.append(")) {"); //$NON-NLS-1$
					it.increaseIndentation();
					it.newLine();
					it.append(RUNNABLE_COLLECTION);
					it.append(".add(() -> "); //$NON-NLS-1$
					it.append(bodyMethodName);
					it.append("("); //$NON-NLS-1$
					it.append(this.grammarKeywordAccess.getOccurrenceKeyword());
					it.append("));"); //$NON-NLS-1$
					it.decreaseIndentation();
					it.newLine();
					it.append("}"); //$NON-NLS-1$
				});
			}

			context.setBehaviorUnitIndex(context.getBehaviorUnitIndex() + 1);
			context.incrementSerial(bodyMethodName.hashCode());
		} else {
			logInternalError(Messages.SARLJvmModelInferrer_10);
		}
	}
373659
public static <S, T> Convert<S, T> to(Typed<T> targetType, Position.Readable<S> sourcePosition) {
        return new Convert<>(sourcePosition, targetType.getType());
    }
1112594
private void convertPropertiesMap(CompilerOptions options) {
    @SuppressWarnings("unchecked")
    Map<String, Object> props = getProject().getProperties();
    for (Map.Entry<String, Object> entry : props.entrySet()) {
      String key = entry.getKey();
      Object value = entry.getValue();

      if (key.startsWith(replacePropertiesPrefix)) {
        key = key.substring(replacePropertiesPrefix.length());

        if (!setDefine(options, key, value)) {
          log("Unexpected property value for key=" + key + "; value=" + value);
        }
      }
    }
  }
1200592
private void replaceArrayPattern(
      NodeTraversal t, Node arrayPattern, Node rhs, Node parent, Node nodeToDetach) {

    if (rewriteMode == ObjectDestructuringRewriteMode.REWRITE_OBJECT_REST) {
      if (patternNestingStack.isEmpty() || !patternNestingStack.peekLast().hasNestedObjectRest) {
        return;
      }
    }

    String tempVarName = getTempVariableName();
    Node makeIteratorCall = astFactory.createJSCompMakeIteratorCall(rhs.detach(), t.getScope());
    Node tempVarModel = astFactory.createName(tempVarName, makeIteratorCall.getJSType());
    Node tempDecl = IR.var(tempVarModel.cloneNode(), makeIteratorCall);
    tempDecl.useSourceInfoIfMissingFromForTree(arrayPattern);
    nodeToDetach.getParent().addChildBefore(tempDecl, nodeToDetach);

    for (Node child = arrayPattern.getFirstChild(), next; child != null; child = next) {
      next = child.getNext();
      if (child.isEmpty()) {
        // Just call the next() method to advance the iterator, but throw away the value.
        Node nextCall =
            IR.exprResult(
                astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")));
        nextCall.useSourceInfoIfMissingFromForTree(child);
        nodeToDetach.getParent().addChildBefore(nextCall, nodeToDetach);
        continue;
      }

      Node newLHS;
      Node newRHS;
      if (child.isDefaultValue()) {
        //   [x = defaultValue] = rhs;
        // becomes
        //   var temp0 = $jscomp.makeIterator(rhs);
        //   var temp1 = temp.next().value
        //   x = (temp1 === undefined) ? defaultValue : temp1;
        String nextVarName = getTempVariableName();
        // `temp.next().value`
        Node nextCallDotValue =
            astFactory.createGetProp(
                astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")),
                "value");
        JSType nextVarType = nextCallDotValue.getJSType();
        // `var temp1 = temp.next().value`
        Node var = IR.var(astFactory.createName(nextVarName, nextVarType), nextCallDotValue);
        var.useSourceInfoIfMissingFromForTree(child);
        nodeToDetach.getParent().addChildBefore(var, nodeToDetach);

        // `x`
        newLHS = child.getFirstChild().detach();
        // `(temp1 === undefined) ? defaultValue : temp1;
        newRHS =
            defaultValueHook(
                astFactory.createName(nextVarName, nextVarType), child.getLastChild().detach());
      } else if (child.isRest()) {
        //   [...x] = rhs;
        // becomes
        //   var temp = $jscomp.makeIterator(rhs);
        //   x = $jscomp.arrayFromIterator(temp);
        newLHS = child.getFirstChild().detach();
        newRHS =
            astFactory.createJscompArrayFromIteratorCall(tempVarModel.cloneNode(), t.getScope());
      } else {
        // LHS is just a name (or a nested pattern).
        //   var [x] = rhs;
        // becomes
        //   var temp = $jscomp.makeIterator(rhs);
        //   var x = temp.next().value;
        newLHS = child.detach();
        newRHS =
            astFactory.createGetProp(
                astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")),
                "value");
      }
      Node newNode;
      if (parent.isAssign()) {
        Node assignment = astFactory.createAssign(newLHS, newRHS);
        newNode = IR.exprResult(assignment);
      } else {
        newNode = IR.declaration(newLHS, newRHS, parent.getToken());
      }
      newNode.useSourceInfoIfMissingFromForTree(arrayPattern);

      nodeToDetach.getParent().addChildBefore(newNode, nodeToDetach);
      // Explicitly visit the LHS of the new node since it may be a nested
      // destructuring pattern.
      visit(t, newLHS, newLHS.getParent());
    }

    nodeToDetach.detach();
    t.reportCodeChange();
  }
525462
public void build(BuildContext context,
                      BuildUtils utils,
                      RuleConditionElement rce) {
        final EntryPointId entry = (EntryPointId) rce;
        context.setCurrentEntryPoint( entry );
        
        EntryPointNode epn = context.getKnowledgeBase().getRete().getEntryPointNode( entry );
        if( epn == null ) {
            NodeFactory nFactory = context.getComponentFactory().getNodeFactoryService();
            context.setObjectSource( utils.attachNode( context,
                                                       nFactory.buildEntryPointNode( context.getNextId(),
                                                                                     context.getKnowledgeBase().getRete(),
                                                                                     context ) ) );
        } else {
            context.setObjectSource( epn );
        }
     }
1035259
private void process(ImmutableSetMultimap<Class<? extends Annotation>, Element> validElements) {
    for (ProcessingStep step : steps) {
      ImmutableSetMultimap<Class<? extends Annotation>, Element> stepElements =
          new ImmutableSetMultimap.Builder<Class<? extends Annotation>, Element>()
              .putAll(indexByAnnotation(elementsDeferredBySteps.get(step), step.annotations()))
              .putAll(filterKeys(validElements, Predicates.<Object>in(step.annotations())))
              .build();
      if (stepElements.isEmpty()) {
        elementsDeferredBySteps.removeAll(step);
      } else {
        Set<? extends Element> rejectedElements = step.process(stepElements);
        elementsDeferredBySteps.replaceValues(
            step,
            transform(
                rejectedElements,
                new Function<Element, ElementName>() {
                  @Override
                  public ElementName apply(Element element) {
                    return ElementName.forAnnotatedElement(element);
                  }
                }));
      }
    }
  }
709408
@Beta
  @CheckReturnValue
  public final FluentIterable<E> append(E... elements) {
    return from(Iterables.concat(iterable, Arrays.asList(elements)));
  }
1039171
private static Fix replaceTargetAnnotation(
      Target annotation, AnnotationTree targetAnnotationTree) {
    Set<ElementType> types = EnumSet.copyOf(REQUIRED_ELEMENT_TYPES);
    types.addAll(Arrays.asList(annotation.value()));

    return replaceTargetAnnotation(targetAnnotationTree, types);
  }