public MatchParameterFilter(final Pair<String, ?>... parameters) { HashMap<String, Object> _newHashMap = CollectionLiterals.<String, Object>newHashMap(parameters); this.filterMap = _newHashMap; }
/** * Creates a mutable {@link Map} instance containing the given initial entries. Repeated occurrences of a keys * will cause an {@link IllegalArgumentException}. * * @param elements * the entries that should be contained in the map. May not be <code>null</code> but may contain * <code>null</code> keys or values. * @return a new {@link Map} containing those elements * @throws IllegalArgumentException * if duplicate keys are contained the {@code elements} entries. */ public static <K, V> Map<K, V> map(Pair<K, V>... elements){ return newHashMap(elements); }
public MatchParameterFilter(final Map<String, Object> filterMap) { HashMap<String, Object> _newHashMap = CollectionLiterals.<String, Object>newHashMap(); this.filterMap = _newHashMap; this.filterMap.putAll(filterMap); }
/** * combine maps into one map (duplicates within later maps overwrite previous ones) */ public <K extends Object, V extends Object> Map<K, V> mergeOverwriting(final Iterable<Map<K, V>> mapList) { final HashMap<K, V> result = CollectionLiterals.<K, V>newHashMap(); final Consumer<Map<K, V>> _function = (Map<K, V> it) -> { result.putAll(it); }; mapList.forEach(_function); return result; } }
/** * Copies the fully resolved signature from the source to this method, including type parameter resolution */ public void copySignatureFrom(final MutableMethodDeclaration it, final ResolvedMethod source) { this.copySignatureFrom(it, source, Collections.<TypeReference, TypeReference>unmodifiableMap(CollectionLiterals.<TypeReference, TypeReference>newHashMap())); }
private Map<EObject, EObject> createENamedElementMapping(final Map<String, EPackage> usedEPackages, final Map<String, EPackage> loadedEPackages) { final HashMap<EObject, EObject> result = CollectionLiterals.<EObject, EObject>newHashMap(); Set<Map.Entry<String, EPackage>> _entrySet = usedEPackages.entrySet(); for (final Map.Entry<String, EPackage> entry : _entrySet) { this.putMappingData(result, entry.getValue(), loadedEPackages.get(entry.getKey())); } return result; }
protected Object getAttribute(final URI uri, final String attributeName) { Object _xblockexpression = null; { if ((uri == null)) { return null; } final HashMap<String, Set<String>> options = CollectionLiterals.<String, Set<String>>newHashMap(); options.put(URIConverter.OPTION_REQUESTED_ATTRIBUTES, Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet(attributeName))); _xblockexpression = this.getURIConverter().getAttributes(uri, options).get(attributeName); } return _xblockexpression; }
protected HashMap<String, JvmIdentifiableElement> getAllVisibleFields(final JvmDeclaredType type) { final HashMap<String, JvmIdentifiableElement> result = CollectionLiterals.<String, JvmIdentifiableElement>newHashMap(); new ConstantExpressionsInterpreter.VisibleFieldsCollector().collect(type, result); return result; }
@Check public void checkUniqueProperties(final EMapPropertyHolder propertyHolder) { final HashMap<IProperty<?>, Map.Entry<IProperty<?>, Object>> usedProperties = CollectionLiterals.<IProperty<?>, Map.Entry<IProperty<?>, Object>>newHashMap(); EMap<IProperty<?>, Object> _properties = propertyHolder.getProperties(); for (final Map.Entry<IProperty<?>, Object> entry : _properties) { { final IProperty<?> property = entry.getKey(); boolean _containsKey = usedProperties.containsKey(property); if (_containsKey) { this.propertyAlreadyAssigned(entry); final Map.Entry<IProperty<?>, Object> other = usedProperties.get(property); if ((other != null)) { this.propertyAlreadyAssigned(other); usedProperties.put(property, null); } } else { usedProperties.put(property, entry); } } } }
/** * Creates a mutable {@link HashMap} instance containing the given initial entries. Repeated occurrences of a keys * will cause an {@link IllegalArgumentException}. * * @param initial * the entries that should be contained in the map. May not be <code>null</code> but may contain * <code>null</code> keys or values. * @return a new {@link HashMap} containing those elements * @throws IllegalArgumentException * if duplicate keys are contained the {@code initial} entries. */ @SafeVarargs @Pure public static <K, V> HashMap<K, V> newHashMap(Pair<? extends K, ? extends V>... initial) { if (initial.length > 0) { HashMap<K, V> result = new HashMap<K, V>(capacity(initial.length)); putAll(result, initial); return result; } return newHashMap(); }
private Map<String, EPackage> findEPackagesInGenPackages(final Collection<String> packageNsURIs, final ResourceSet resourceSet) { final HashMap<String, EPackage> result = CollectionLiterals.<String, EPackage>newHashMap(); for (final String nsURI : packageNsURIs) { { final Resource resource = GenModelUtil2.getGenModelResource(null, nsURI, resourceSet); if ((resource != null)) { final GenModel loadedGenModel = IterableExtensions.<GenModel>head(Iterables.<GenModel>filter(resource.getContents(), GenModel.class)); if ((loadedGenModel != null)) { final GenPackage genPackage = this.findGenPackageByNsURI(loadedGenModel, nsURI); result.put(nsURI, genPackage.getEcorePackage()); } } } } return result; }
protected void withOutputConfig(final BuildRequest it, final Procedure1<? super OutputConfiguration> init) { Set<OutputConfiguration> _outputConfigurations = this.configurationProvider.getOutputConfigurations(); final OutputConfiguration config = IterableExtensions.<OutputConfiguration>head(_outputConfigurations); init.apply(config); Pair<String, Set<OutputConfiguration>> _mappedTo = Pair.<String, Set<OutputConfiguration>>of(this.languageName, Collections.<OutputConfiguration>unmodifiableSet(CollectionLiterals.<OutputConfiguration>newHashSet(config))); final OutputConfigurationAdapter adapter = new OutputConfigurationAdapter(Collections.<String, Set<OutputConfiguration>>unmodifiableMap(CollectionLiterals.<String, Set<OutputConfiguration>>newHashMap(_mappedTo))); XtextResourceSet _resourceSet = it.getResourceSet(); EList<Adapter> _eAdapters = _resourceSet.eAdapters(); _eAdapters.add(adapter); }
public List<EqualAmbiguousTransitions> getAllAmbiguousTransitionsBySyntax() { if ((this.ambiguousTransitions != null)) { return this.ambiguousTransitions; } final Map<GrammarAlias.AbstractElementAlias, EqualAmbiguousTransitions> result = CollectionLiterals.<GrammarAlias.AbstractElementAlias, EqualAmbiguousTransitions>newHashMap(); Set<ISyntacticSequencerPDAProvider.ISynTransition> _allAmbiguousTransitions = this.getAllAmbiguousTransitions(); for (final ISyntacticSequencerPDAProvider.ISynTransition transition : _allAmbiguousTransitions) { List<GrammarAlias.AbstractElementAlias> _ambiguousSyntaxes = transition.getAmbiguousSyntaxes(); for (final GrammarAlias.AbstractElementAlias syntax : _ambiguousSyntaxes) { { EqualAmbiguousTransitions list = result.get(syntax); if ((list == null)) { String _elementAliasToIdentifier = this.elementAliasToIdentifier(syntax); EqualAmbiguousTransitions _equalAmbiguousTransitions = new EqualAmbiguousTransitions(_elementAliasToIdentifier, syntax); list = _equalAmbiguousTransitions; result.put(syntax, list); } list.getTransitions().add(transition); } } } this.ambiguousTransitions = CollectionLiterals.<EqualAmbiguousTransitions>newArrayList(((EqualAmbiguousTransitions[])Conversions.unwrapArray(result.values(), EqualAmbiguousTransitions.class))); ListExtensions.<EqualAmbiguousTransitions>sortInplace(this.ambiguousTransitions); return this.ambiguousTransitions; }
private Map<String, EPackage> findAllUsedEPackages(final List<EPackage> generatedPackages) { final HashMap<String, EPackage> result = CollectionLiterals.<String, EPackage>newHashMap(); final TreeIterator<EObject> packageContentIterator = EcoreUtil.<EObject>getAllContents(generatedPackages); while (packageContentIterator.hasNext()) { { final EObject current = packageContentIterator.next(); EList<EObject> _eCrossReferences = current.eCrossReferences(); for (final EObject referenced : _eCrossReferences) { { boolean _eIsProxy = referenced.eIsProxy(); if (_eIsProxy) { throw new RuntimeException(((("Unresolved proxy: " + referenced) + " in ") + current)); } if ((referenced instanceof EClassifier)) { final EPackage referencedPackage = ((EClassifier)referenced).getEPackage(); boolean _contains = generatedPackages.contains(referencedPackage); boolean _not = (!_contains); if (_not) { result.put(referencedPackage.getNsURI(), referencedPackage); } } } } } } return result; }
@Check public void checkInteractionNameIsUnique(final AmlModel amlModel) { final HashMap<String, EObject> mapInteractionName2InteractionTypes = CollectionLiterals.<String, EObject>newHashMap(); final Consumer<InteractionType> _function = (InteractionType it) -> { boolean _containsKey = mapInteractionName2InteractionTypes.containsKey(it.getName()); if (_containsKey) { final String message = MessageFormat.format(Messages.Validation_InteractionType_Name_Dublicate, it.getName()); this.error(message, mapInteractionName2InteractionTypes.get(it.getName()), mapInteractionName2InteractionTypes.get(it.getName()).eContainer().eContainingFeature(), AmlValidator.INTERACTION_NAME_DUPLICATION); this.error(message, it, it.eContainer().eContainingFeature(), AmlValidator.INTERACTION_NAME_DUPLICATION); } else { mapInteractionName2InteractionTypes.put(it.getName(), it); } }; amlModel.getInteractionTypes().forEach(_function); }
public Map<String, JvmTypeReference> getEnvironmentVariablesTypeMap(final Iterable<EnvironmentVariable> envParams) { final HashMap<String, JvmTypeReference> envParameterVariablesTypeMap = CollectionLiterals.<String, JvmTypeReference>newHashMap(); boolean _isEmpty = IterableExtensions.isEmpty(envParams); boolean _not = (!_isEmpty); if (_not) { this.typeReferenceUtil.initWith(IterableExtensions.<EnvironmentVariable>head(envParams).eResource()); final JvmTypeReference stringTypeReference = this.typeReferenceUtil.stringJvmTypeReference(); final JvmTypeReference maskingStringTypeReference = this.typeReferenceUtil.buildFrom(MaskingString.class); final Consumer<EnvironmentVariable> _function = (EnvironmentVariable it) -> { String _name = it.getName(); JvmTypeReference _xifexpression = null; boolean _isNonConfidential = it.isNonConfidential(); if (_isNonConfidential) { _xifexpression = stringTypeReference; } else { _xifexpression = maskingStringTypeReference; } envParameterVariablesTypeMap.put(_name, _xifexpression); }; envParams.forEach(_function); } return envParameterVariablesTypeMap; }
protected Map<String, JvmTypeReference> _collectDeclaredVariablesTypeMap(final TestStepWithAssignment testStep) { InteractionType _interaction = this._tclModelUtil.getInteraction(testStep); MethodReference _defaultMethod = null; if (_interaction!=null) { _defaultMethod=_interaction.getDefaultMethod(); } JvmOperation _operation = null; if (_defaultMethod!=null) { _operation=_defaultMethod.getOperation(); } JvmTypeReference _returnType = null; if (_operation!=null) { _returnType=_operation.getReturnType(); } final JvmTypeReference typeReference = _returnType; String _name = testStep.getVariable().getName(); Pair<String, JvmTypeReference> _mappedTo = Pair.<String, JvmTypeReference>of(_name, typeReference); return Collections.<String, JvmTypeReference>unmodifiableMap(CollectionLiterals.<String, JvmTypeReference>newHashMap(_mappedTo)); }
@Check public void checkDupplicateTemplatesInComponentType(final ElementTypeWithInteractions componentType) { final HashMap<String, EObject> mapTemplateCode2InteractionType = CollectionLiterals.<String, EObject>newHashMap(); final Consumer<InteractionType> _function = (InteractionType it) -> { String templateCode = this._modelUtil.normalize(it.getTemplate()); boolean _containsKey = mapTemplateCode2InteractionType.containsKey(templateCode); if (_containsKey) { this.error(Messages.Validation_TemplateCode_NotUnique, componentType, componentType.eContainer().eContainingFeature(), AmlValidator.TEMPLATE_CODE_NOT_UNIQUE); this.error(Messages.Validation_TemplateCode_NotUnique, mapTemplateCode2InteractionType.get(templateCode), mapTemplateCode2InteractionType.get(templateCode).eContainer().eContainingFeature(), AmlValidator.TEMPLATE_CODE_NOT_UNIQUE); this.error(Messages.Validation_TemplateCode_NotUnique, it, it.eContainer().eContainingFeature(), AmlValidator.TEMPLATE_CODE_NOT_UNIQUE); } else { mapTemplateCode2InteractionType.put(templateCode, it); } }; componentType.getInteractionTypes().forEach(_function); }
public NamedSerializationContextProvider(final Grammar grammar) { final Function1<Pair<Integer, ParserRule>, Pair<ParserRule, Integer>> _function = (Pair<Integer, ParserRule> it) -> { ParserRule _value = it.getValue(); Integer _key = it.getKey(); return Pair.<ParserRule, Integer>of(_value, _key); }; this.rules = CollectionLiterals.<ParserRule, Integer>newHashMap(((Pair<? extends ParserRule, ? extends Integer>[])Conversions.unwrapArray(IterableExtensions.<Pair<Integer, ParserRule>, Pair<ParserRule, Integer>>map(IterableExtensions.<ParserRule>indexed(GrammarUtil.allParserRules(grammar)), _function), Pair.class))); }
public String getThingWorxDataType(final String vortoType) { String dataType = ""; Pair<String, String> _mappedTo = Pair.<String, String>of("base64Binary", "BLOB"); Pair<String, String> _mappedTo_1 = Pair.<String, String>of("boolean", "BOOLEAN"); Pair<String, String> _mappedTo_2 = Pair.<String, String>of("dateTime", "DATETIME"); Pair<String, String> _mappedTo_3 = Pair.<String, String>of("int", "INTEGER"); Pair<String, String> _mappedTo_4 = Pair.<String, String>of("short", "INTEGER"); Pair<String, String> _mappedTo_5 = Pair.<String, String>of("long", "INTEGER"); Pair<String, String> _mappedTo_6 = Pair.<String, String>of("byte", "INTEGER"); Pair<String, String> _mappedTo_7 = Pair.<String, String>of("double", "NUMBER"); Pair<String, String> _mappedTo_8 = Pair.<String, String>of("float", "NUMBER"); Pair<String, String> _mappedTo_9 = Pair.<String, String>of("string", "STRING"); final HashMap<String, String> typeMap = CollectionLiterals.<String, String>newHashMap(_mappedTo, _mappedTo_1, _mappedTo_2, _mappedTo_3, _mappedTo_4, _mappedTo_5, _mappedTo_6, _mappedTo_7, _mappedTo_8, _mappedTo_9); String _get = typeMap.get(vortoType); dataType = _get; boolean _equals = Objects.equal(dataType, null); if (_equals) { dataType = "UNDEFINED"; } return dataType; } }