Esempio n. 1
0
        internal virtual FxMatrixBuilder merge(FxMatrixBuilder other)
        {
            // Find the common currencies
            Optional <Currency> common = currencies.Keys.Where(other.currencies.containsKey).First();

            Currency commonCurrency = common.orElseThrow(() => new System.ArgumentException("There are no currencies in common between " + currencies.Keys + " and " + other.currencies.Keys));

            // Add in all currencies that we don't already have
            MapStream.of(other.currencies).filterKeys(ccy => !ccy.Equals(commonCurrency) && !currencies.containsKey(ccy)).forEach((ccy, idx) => addCurrencyPair(commonCurrency, ccy, other.getRate(commonCurrency, ccy)));

            return(this);
        }
Esempio n. 2
0
 //[MethodImpl(MethodImplOptions.Synchronized)]
 public boolean containsKey(K key)
 {
     lock (this)
     {
         return(map.containsKey(key));
     }
 }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void add(String subModelName, String featureSpec) throws org.maltparser.core.exception.MaltChainedException
        public virtual void add(string subModelName, string featureSpec)
        {
            if (ReferenceEquals(subModelName, null) || subModelName.Length < 1 || subModelName.ToUpper().Equals("MAIN"))
            {
                if (!subModelMap.containsKey("MAIN"))
                {
                    subModelMap.put("MAIN", new SpecificationSubModel("MAIN"));
                }
                subModelMap.get("MAIN").add(featureSpec);
            }
            else
            {
                if (!subModelMap.containsKey(subModelName.ToUpper()))
                {
                    subModelMap.put(subModelName.ToUpper(), new SpecificationSubModel(subModelName.ToUpper()));
                }
                subModelMap.get(subModelName.ToUpper()).add(featureSpec);
            }
        }
Esempio n. 4
0
 public virtual Builder ParameterizedWith(string name, TypeReference.Bound bound)
 {
     if (TypeParametersConflict == null)
     {
         TypeParametersConflict = new LinkedHashMap <string, TypeReference.Bound>();
     }
     else if (TypeParametersConflict.containsKey(name))
     {
         throw new System.ArgumentException(name + " defined twice");
     }
     TypeParametersConflict.put(name, bound);
     return(this);
 }
Esempio n. 5
0
        /// <summary>
        /// Reloads the internal SPI list from the given <seealso cref="ClassLoader"/>.
        /// Changes to the service list are visible after the method ends, all
        /// iterators (e.g., from <seealso cref="#availableServices()"/>,...) stay consistent.
        ///
        /// <para><b>NOTE:</b> Only new service providers are added, existing ones are
        /// never removed or replaced.
        ///
        /// </para>
        /// <para><em>This method is expensive and should only be called for discovery
        /// of new service providers on the given classpath/classloader!</em>
        /// </para>
        /// </summary>
        public void reload(ClassLoader classloader)
        {
            lock (this)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.LinkedHashMap<String,Class> services = new java.util.LinkedHashMap<>(this.services);
                LinkedHashMap <string, Type> services = new LinkedHashMap <string, Type>(this.services);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.util.SPIClassIterator<S> loader = org.apache.lucene.util.SPIClassIterator.get(clazz, classloader);
                SPIClassIterator <S> loader = SPIClassIterator.get(clazz, classloader);
                while (loader.hasNext())
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Class service = loader.next();
                    Type service = loader.next();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String clazzName = service.getSimpleName();
                    string clazzName = service.SimpleName;
                    string name      = null;
                    foreach (string suffix in suffixes)
                    {
                        if (clazzName.EndsWith(suffix, StringComparison.Ordinal))
                        {
                            name = clazzName.Substring(0, clazzName.Length - suffix.Length).ToLower(Locale.ROOT);
                            break;
                        }
                    }
                    if (name == null)
                    {
                        throw new ServiceConfigurationError("The class name " + service.Name + " has wrong suffix, allowed are: " + Arrays.ToString(suffixes));
                    }
                    // only add the first one for each name, later services will be ignored
                    // this allows to place services before others in classpath to make
                    // them used instead of others
                    //
                    // TODO: Should we disallow duplicate names here?
                    // Allowing it may get confusing on collisions, as different packages
                    // could contain same factory class, which is a naming bug!
                    // When changing this be careful to allow reload()!
                    if (!services.containsKey(name))
                    {
                        services.put(name, service);
                    }
                }
                this.services = Collections.unmodifiableMap(services);
            }
        }
Esempio n. 6
0
 public virtual bool hasVertex(VertexInfo vertexInfo)
 {
     return(cache.containsKey(getKey(vertexInfo)));
 }
Esempio n. 7
0
 public virtual bool hasTexture(int addr, int clutAddr, int clutStart, int clutMode)
 {
     return(cache.containsKey(getKey(addr, clutAddr, clutStart, clutMode)));
 }
Esempio n. 8
0
 public boolean containsKey(K key)
 {
     return(map.containsKey(key));
 }