예제 #1
0
        public bool Unify(FeatureStruct other, bool useDefaults, VariableBindings varBindings, out FeatureStruct output)
        {
            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            other = Dereference(other);

            VariableBindings tempVarBindings = varBindings == null ? null : varBindings.DeepClone();
            FeatureValue     newFV;

            if (!UnifyImpl(other, useDefaults, tempVarBindings, out newFV))
            {
                output = null;
                return(false);
            }

            if (varBindings != null)
            {
                varBindings.Replace(tempVarBindings);
            }
            output = (FeatureStruct)newFV;
            return(true);
        }
예제 #2
0
        public bool Subsumes(FeatureStruct other, bool useDefaults, VariableBindings varBindings)
        {
            other = Dereference(other);

            VariableBindings tempVarBindings = varBindings == null ? new VariableBindings() : varBindings.DeepClone();

            if (SubsumesImpl(other, useDefaults, tempVarBindings))
            {
                if (varBindings != null)
                {
                    varBindings.Replace(tempVarBindings);
                }
                return(true);
            }
            return(false);
        }
예제 #3
0
        /// <summary>
        /// Determines whether the specified set of feature values is compatible with this
        /// set of feature values. It is much like <c>Matches</c> except that if a the
        /// specified set does not contain a feature in this set, it is still a match.
        /// It basically checks to make sure that there is no contradictory features.
        /// </summary>
        /// <param name="other">The feature value.</param>
        /// <param name="useDefaults"></param>
        /// <param name="varBindings"></param>
        /// <returns>
        ///     <c>true</c> the sets are compatible, otherwise <c>false</c>.
        /// </returns>
        public bool IsUnifiable(FeatureStruct other, bool useDefaults, VariableBindings varBindings)
        {
            other = Dereference(other);

            VariableBindings definiteVarBindings = varBindings == null ? new VariableBindings() : varBindings.DeepClone();

            if (IsUnifiableImpl(other, useDefaults, definiteVarBindings))
            {
                if (varBindings != null)
                {
                    varBindings.Replace(definiteVarBindings);
                }
                return(true);
            }
            return(false);
        }
예제 #4
0
        /// <summary>
        /// Determines whether the specified set of feature values is compatible with this
        /// set of feature values. It is much like <c>Matches</c> except that if a the
        /// specified set does not contain a feature in this set, it is still a match.
        /// It basically checks to make sure that there is no contradictory features.
        /// </summary>
        /// <param name="other">The feature value.</param>
        /// <param name="useDefaults"></param>
        /// <param name="varBindings"></param>
        /// <returns>
        ///     <c>true</c> the sets are compatible, otherwise <c>false</c>.
        /// </returns>
        public bool IsUnifiable(FeatureStruct other, bool useDefaults, VariableBindings varBindings)
        {
            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            other = Dereference(other);

            VariableBindings definiteVarBindings = varBindings == null ? null : varBindings.DeepClone();

            if (IsUnifiableImpl(other, useDefaults, definiteVarBindings))
            {
                if (varBindings != null)
                {
                    varBindings.Replace(definiteVarBindings);
                }
                return(true);
            }
            return(false);
        }
예제 #5
0
        public bool Subsumes(FeatureStruct other, bool useDefaults, VariableBindings varBindings)
        {
            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            other = Dereference(other);

            VariableBindings tempVarBindings = varBindings == null ? null : varBindings.DeepClone();

            if (SubsumesImpl(other, useDefaults, tempVarBindings))
            {
                if (varBindings != null)
                {
                    varBindings.Replace(tempVarBindings);
                }
                return(true);
            }
            return(false);
        }