コード例 #1
0
        /// <summary>
        /// Adds an option value to an option to one of the internal option container specified by the type.
        /// </summary>
        /// <param name="containerType">		the type of the option container. </param>
        /// <param name="containerIndex">	the index of the option container. </param>
        /// <param name="option">	an option to add </param>
        /// <param name="value">	an option value to add
        /// @return	true if the value is added, false if the value already is in use. </param>
        /// <exception cref="OptionException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected boolean addOptionValue(int containerType, int containerIndex, org.maltparser.core.options.option.Option option, Object value) throws OptionException
        protected internal virtual bool addOptionValue(int containerType, int containerIndex, Option.Option option, object value)
        {
            if (option == null)
            {
                throw new OptionException("The option cannot be found. ");
            }
            if (value == null)
            {
                throw new OptionException("The option value cannot be found. ");
            }

            if (!optionContainers.ContainsKey(containerIndex))
            {
                optionContainers[containerIndex] = new OptionContainer(containerIndex);
            }
            OptionContainer oc = optionContainers[containerIndex];

            if (oc == null)
            {
                throw new OptionException("The option container index " + containerIndex + " is unknown");
            }
            if (!oc.contains(containerType, option))
            {
                oc.addOptionValue(containerType, option, value);
                return(true);
            }
            return(false);
        }
コード例 #2
0
        /// <summary>
        /// Returns the option value for an option.
        /// </summary>
        /// <param name="option">	an option object
        /// @return	 the option value for an option, <i>null</i> if the option value could not be found. </param>
        /// <exception cref="OptionException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public Object getOptionValue(org.maltparser.core.options.option.Option option) throws OptionException
        public virtual object getOptionValue(Option.Option option)
        {
            if (optionContainers.Count == 0)
            {
                return(null);
            }
            OptionContainer oc = optionContainers[optionContainers.firstKey()];

            return(oc.getOptionValue(option));
        }
コード例 #3
0
        /// <summary>
        /// Returns a string representation of the option value for an option that is in a specific option container.
        /// </summary>
        /// <param name="containerIndex">	the index of the option container. </param>
        /// <param name="option">	an option object </param>
        /// <returns> a string representation of the option value for an option that is in a specific option container. </returns>
        /// <exception cref="OptionException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public String getOptionValueString(int containerIndex, org.maltparser.core.options.option.Option option) throws OptionException
        public virtual string getOptionValueString(int containerIndex, Option.Option option)
        {
            OptionContainer oc = optionContainers[containerIndex];

            if (oc == null)
            {
                throw new OptionException("The option container '" + containerIndex + "' cannot be found. ");
            }
            return(oc.getOptionValueString(option));
        }