/// <summary>
        /// Gets all valid bindings between the specified variables and the feature values
        /// currently set on the specified segment. It adds the variable values to the varFeats of
        /// instantiated variables.
        /// </summary>
        /// <param name="variables">The variables.</param>
        /// <param name="seg">The segment.</param>
        /// <param name="instantiatedVars">The instantiated variables.</param>
        /// <returns><c>true</c> if a valid binding was found, otherwise <c>false</c></returns>
        public bool GetAllBindings(IDictionary <string, bool> variables, Segment seg, VariableValues instantiatedVars)
        {
            foreach (KeyValuePair <string, bool> varPolarity in variables)
            {
                List <FeatureValue> valuesToAdd = new List <FeatureValue>();
                foreach (FeatureValue value in GetVarFeatValue(varPolarity.Key, varPolarity.Value, instantiatedVars))
                {
                    if (seg.FeatureValues.Get(value))
                    {
                        valuesToAdd.Add(value);
                    }
                }

                if (valuesToAdd.Count == 0)
                {
                    return(false);
                }

                foreach (FeatureValue value in valuesToAdd)
                {
                    instantiatedVars.Add(varPolarity.Key, value);
                }
            }

            return(true);
        }
Esempio n. 2
0
		/// <summary>
		/// Gets a valid binding between the specified variable and the feature values
		/// currently set on the specified segment. It adds the variable value to the varFeats of
		/// instantiated variables.
		/// </summary>
		/// <param name="variable">The variable.</param>
		/// <param name="polarity">The variable polarity.</param>
		/// <param name="seg">The segment.</param>
		/// <param name="instantiatedVars">The instantiated variables.</param>
		/// <returns><c>true</c> if a valid binding was found, otherwise <c>false</c></returns>
		public bool GetBinding(string variable, bool polarity, Segment seg, VariableValues instantiatedVars)
		{
			bool match = false;
			foreach (FeatureValue value in GetVarFeatValue(variable, polarity, instantiatedVars))
			{
				if (seg.FeatureValues.Get(value))
				{
					instantiatedVars.Add(variable, value);
					match = true;
					break;
				}
			}

			return match;
		}
        /// <summary>
        /// Gets a valid binding between the specified variable and the feature values
        /// currently set on the specified segment. It adds the variable value to the varFeats of
        /// instantiated variables.
        /// </summary>
        /// <param name="variable">The variable.</param>
        /// <param name="polarity">The variable polarity.</param>
        /// <param name="seg">The segment.</param>
        /// <param name="instantiatedVars">The instantiated variables.</param>
        /// <returns><c>true</c> if a valid binding was found, otherwise <c>false</c></returns>
        public bool GetBinding(string variable, bool polarity, Segment seg, VariableValues instantiatedVars)
        {
            bool match = false;

            foreach (FeatureValue value in GetVarFeatValue(variable, polarity, instantiatedVars))
            {
                if (seg.FeatureValues.Get(value))
                {
                    instantiatedVars.Add(variable, value);
                    match = true;
                    break;
                }
            }

            return(match);
        }
Esempio n. 4
0
        /// <summary>
        /// Gets all valid bindings between the specified variables and the feature values
        /// currently set on the specified segment. It adds the variable values to the varFeats of
        /// instantiated variables.
        /// </summary>
        /// <param name="variables">The variables.</param>
        /// <param name="seg">The segment.</param>
        /// <param name="instantiatedVars">The instantiated variables.</param>
        /// <returns><c>true</c> if a valid binding was found, otherwise <c>false</c></returns>
        public bool GetAllBindings(IDictionary <string, bool> variables, Segment seg, VariableValues instantiatedVars)
        {
            foreach (KeyValuePair <string, bool> varPolarity in variables)
            {
                bool match = false;
                foreach (FeatureValue value in GetVarFeatValue(varPolarity.Key, varPolarity.Value, instantiatedVars))
                {
                    if (seg.FeatureValues.Get(value))
                    {
                        instantiatedVars.Add(varPolarity.Key, value);
                        match = true;
                    }
                }

                if (!match)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 5
0
		/// <summary>
		/// Gets all valid bindings between the specified variables and the feature values
		/// currently set on the specified segment. It adds the variable values to the varFeats of
		/// instantiated variables.
		/// </summary>
		/// <param name="variables">The variables.</param>
		/// <param name="seg">The segment.</param>
		/// <param name="instantiatedVars">The instantiated variables.</param>
		/// <returns><c>true</c> if a valid binding was found, otherwise <c>false</c></returns>
		public bool GetAllBindings(IDictionary<string, bool> variables, Segment seg, VariableValues instantiatedVars)
		{
			foreach (KeyValuePair<string, bool> varPolarity in variables)
			{
				List<FeatureValue> valuesToAdd = new List<FeatureValue>();
				foreach (FeatureValue value in GetVarFeatValue(varPolarity.Key, varPolarity.Value, instantiatedVars))
				{
					if (seg.FeatureValues.Get(value))
						valuesToAdd.Add(value);
				}

				if (valuesToAdd.Count == 0)
					return false;

				foreach (FeatureValue value in valuesToAdd)
					instantiatedVars.Add(varPolarity.Key, value);
			}

			return true;
		}
Esempio n. 6
0
		/// <summary>
		/// Gets all valid bindings between the specified variables and the feature values
		/// currently set on the specified segment. It adds the variable values to the varFeats of
		/// instantiated variables.
		/// </summary>
		/// <param name="variables">The variables.</param>
		/// <param name="seg">The segment.</param>
		/// <param name="instantiatedVars">The instantiated variables.</param>
		/// <returns><c>true</c> if a valid binding was found, otherwise <c>false</c></returns>
		public bool GetAllBindings(IDictionary<string, bool> variables, Segment seg, VariableValues instantiatedVars)
		{
			foreach (KeyValuePair<string, bool> varPolarity in variables)
			{
				bool match = false;
				foreach (FeatureValue value in GetVarFeatValue(varPolarity.Key, varPolarity.Value, instantiatedVars))
				{
					if (seg.FeatureValues.Get(value))
					{
						instantiatedVars.Add(varPolarity.Key, value);
						match = true;
					}
				}

				if (!match)
					return false;
			}

			return true;
		}