Пример #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.Clone();
            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
        /// <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.Clone();

            if (IsUnifiableImpl(other, useDefaults, definiteVarBindings))
            {
                if (varBindings != null)
                {
                    varBindings.Replace(definiteVarBindings);
                }
                return(true);
            }
            return(false);
        }
Пример #3
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.Clone();

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