Esempio n. 1
0
        /// <summary>
        /// Unifies this set of feature values with the specified set of feature values. If the specified
        /// set of feature values does not contain a feature specified in this set of feature values, then the
        /// default value will be used for that feature.
        /// </summary>
        /// <param name="fv">The feature values.</param>
        /// <param name="output">The unification.</param>
        /// <returns><c>true</c> if the feature values could be unified, otherwise <c>false</c>.</returns>
        public bool UnifyDefaults(FeatureValues fv, out FeatureValues output)
        {
            output = fv.Clone();
            foreach (KeyValuePair <Feature, ValueInstance> kvp in m_values)
            {
                ValueInstance value;
                if (fv.m_values.TryGetValue(kvp.Key, out value))
                {
                    ValueInstance vi = null;
                    if (kvp.Value != null && !kvp.Value.UnifyDefaults(value, out vi))
                    {
                        output = null;
                        return(false);
                    }
                    output.m_values[kvp.Key] = vi;
                }
                else if (kvp.Key.DefaultValue != null)
                {
                    ValueInstance vi = null;
                    if (kvp.Value != null && !kvp.Value.UnifyDefaults(kvp.Key.DefaultValue, out vi))
                    {
                        output = null;
                        return(false);
                    }
                    output.m_values[kvp.Key] = vi;
                }
                else
                {
                    output.m_values[kvp.Key] = kvp.Value;
                }
            }

            return(true);
        }
Esempio n. 2
0
        public override bool IsMatch(ValueInstance other)
        {
            ClosedValueInstance        vi           = other as ClosedValueInstance;
            HCObjectSet <FeatureValue> intersection = m_values.Intersection(vi.m_values);

            return(intersection.Count > 0);
        }
Esempio n. 3
0
        public override bool UnifyDefaults(ValueInstance other, out ValueInstance output)
        {
            FeatureValues fvs;

            if (UnifyDefaults(other as FeatureValues, out fvs))
            {
                output = fvs;
                return(true);
            }
            else
            {
                output = null;
                return(false);
            }
        }
Esempio n. 4
0
        public override bool Unify(ValueInstance other, out ValueInstance output)
        {
            ClosedValueInstance vi = other as ClosedValueInstance;

            HCObjectSet <FeatureValue> intersection = m_values.Intersection(vi.m_values);

            if (intersection.Count > 0)
            {
                output = new ClosedValueInstance(intersection);
                return(true);
            }
            else
            {
                output = null;
                return(false);
            }
        }
Esempio n. 5
0
		public override bool UnifyDefaults(ValueInstance other, out ValueInstance output)
		{
			FeatureValues fvs;
			if (UnifyDefaults(other as FeatureValues, out fvs))
			{
				output = fvs;
				return true;
			}
			else
			{
				output = null;
				return false;
			}
		}
Esempio n. 6
0
 public override bool UnifyDefaults(ValueInstance other, out ValueInstance output)
 {
     return(Unify(other, out output));
 }
Esempio n. 7
0
 public abstract bool IsMatch(ValueInstance other);
Esempio n. 8
0
 public abstract bool IsCompatible(ValueInstance other);
Esempio n. 9
0
 public override bool IsMatch(ValueInstance other)
 {
     return(IsMatch(other as FeatureValues));
 }
Esempio n. 10
0
		public abstract bool IsMatch(ValueInstance other);
Esempio n. 11
0
 public override bool IsCompatible(ValueInstance other)
 {
     return(IsMatch(other));
 }
Esempio n. 12
0
		public abstract bool IsCompatible(ValueInstance other);
Esempio n. 13
0
		/// <summary>
		/// Adds the specified feature-value pair.
		/// </summary>
		/// <param name="feature">The feature.</param>
		/// <param name="value">The value.</param>
		public void Add(Feature feature, ValueInstance value)
		{
			m_values[feature] = value;
		}
Esempio n. 14
0
		public override bool IsCompatible(ValueInstance other)
		{
			return IsMatch(other);
		}
Esempio n. 15
0
		public override bool IsMatch(ValueInstance other)
		{
			ClosedValueInstance vi = other as ClosedValueInstance;
			HCObjectSet<FeatureValue> intersection = m_values.Intersection(vi.m_values);
			return intersection.Count > 0;
		}
Esempio n. 16
0
		public override bool UnifyDefaults(ValueInstance other, out ValueInstance output)
		{
			return Unify(other, out output);
		}
Esempio n. 17
0
		public override bool Unify(ValueInstance other, out ValueInstance output)
		{
			ClosedValueInstance vi = other as ClosedValueInstance;

			HCObjectSet<FeatureValue> intersection = m_values.Intersection(vi.m_values);
			if (intersection.Count > 0)
			{
				output = new ClosedValueInstance(intersection);
				return true;
			}
			else
			{
				output = null;
				return false;
			}
		}
Esempio n. 18
0
 /// <summary>
 /// Adds the specified feature-value pair.
 /// </summary>
 /// <param name="feature">The feature.</param>
 /// <param name="value">The value.</param>
 public void Add(Feature feature, ValueInstance value)
 {
     m_values[feature] = value;
 }
Esempio n. 19
0
		public override bool IsMatch(ValueInstance other)
		{
			return IsMatch(other as FeatureValues);
		}
Esempio n. 20
0
		public override bool IsCompatible(ValueInstance other)
		{
			return IsCompatible(other as FeatureValues);
		}
Esempio n. 21
0
 public abstract bool UnifyDefaults(ValueInstance other, out ValueInstance output);
Esempio n. 22
0
 public override bool IsCompatible(ValueInstance other)
 {
     return(IsCompatible(other as FeatureValues));
 }
Esempio n. 23
0
		public abstract bool UnifyDefaults(ValueInstance other, out ValueInstance output);