コード例 #1
0
        protected override SimpleContext CombineFeatures(SimpleContext ctxt)
        {
            NaturalClassContext result = base.CombineFeatures(ctxt) as NaturalClassContext;

            if (ctxt.ContextType == SimpleContextType.NATURAL_CLASS)
            {
                NaturalClassContext ncCtxt = ctxt as NaturalClassContext;
                // add variables from the specified pattern's context
                foreach (KeyValuePair <string, bool> varPolarity in ncCtxt.m_variables)
                {
                    if (!Owner.IsFeatureReferenced(m_alphaVars.GetFeature(varPolarity.Key)))
                    {
                        result.m_variables[varPolarity.Key] = varPolarity.Value;
                    }
                }

                foreach (KeyValuePair <string, bool> varPolarity in ncCtxt.m_antiVariables)
                {
                    if (!Owner.IsFeatureReferenced(m_alphaVars.GetFeature(varPolarity.Key)))
                    {
                        result.m_antiVariables[varPolarity.Key] = varPolarity.Value;
                    }
                }
            }
            return(result);
        }
コード例 #2
0
        public bool Equals(NaturalClassContext other)
        {
            if (other == null)
            {
                return(false);
            }

            foreach (KeyValuePair <string, bool> varPolarity in m_variables)
            {
                Feature feat  = m_alphaVars.GetFeature(varPolarity.Key);
                bool    found = false;
                foreach (KeyValuePair <string, bool> otherVarPolarity in other.m_variables)
                {
                    Feature otherFeat = other.m_alphaVars.GetFeature(otherVarPolarity.Key);
                    if (feat.Equals(otherFeat))
                    {
                        if (varPolarity.Value != otherVarPolarity.Value)
                        {
                            return(false);
                        }
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    return(false);
                }
            }

            return(m_natClass == other.m_natClass);
        }
コード例 #3
0
        public bool Equals(NaturalClassContext other)
        {
            if (other == null)
            {
                return(false);
            }

            return(m_natClass == other.m_natClass);
        }
コード例 #4
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="ctxt">The simple context.</param>
 public NaturalClassContext(NaturalClassContext ctxt)
     : base(ctxt)
 {
     m_natClass = ctxt.m_natClass;
     if (ctxt.m_variables != null)
     {
         m_variables     = new Dictionary <string, bool>(ctxt.m_variables);
         m_antiVariables = new Dictionary <string, bool>(ctxt.m_antiVariables);
         m_alphaVars     = ctxt.m_alphaVars;
     }
 }
コード例 #5
0
ファイル: NaturalClass.cs プロジェクト: bbriggs/FieldWorks
		public bool Equals(NaturalClassContext other)
		{
			if (other == null)
				return false;

			foreach (KeyValuePair<string, bool> varPolarity in m_variables)
			{
				Feature feat = m_alphaVars.GetFeature(varPolarity.Key);
				bool found = false;
				foreach (KeyValuePair<string, bool> otherVarPolarity in other.m_variables)
				{
					Feature otherFeat = other.m_alphaVars.GetFeature(otherVarPolarity.Key);
					if (feat.Equals(otherFeat))
					{
						if (varPolarity.Value != otherVarPolarity.Value)
							return false;
						found = true;
						break;
					}
				}
				if (!found)
					return false;
			}

			return m_natClass == other.m_natClass;
		}
コード例 #6
0
ファイル: NaturalClass.cs プロジェクト: bbriggs/FieldWorks
		/// <summary>
		/// Copy constructor.
		/// </summary>
		/// <param name="ctxt">The simple context.</param>
		public NaturalClassContext(NaturalClassContext ctxt)
			: base(ctxt)
		{
			m_natClass = ctxt.m_natClass;
			if (ctxt.m_variables != null)
			{
				m_variables = new Dictionary<string, bool>(ctxt.m_variables);
				m_antiVariables = new Dictionary<string, bool>(ctxt.m_antiVariables);
				m_alphaVars = ctxt.m_alphaVars;
			}
		}
コード例 #7
0
ファイル: NaturalClass.cs プロジェクト: sillsdev/WorldPad
		public bool Equals(NaturalClassContext other)
		{
			if (other == null)
				return false;

			return m_natClass == other.m_natClass;
		}