Exemple #1
0
        public override bool CanBeEquals(Pullenti.Ner.Referent obj, Pullenti.Ner.Core.ReferentsEqualType typ)
        {
            NamedEntityReferent ent = obj as NamedEntityReferent;

            if (ent == null)
            {
                return(false);
            }
            if (ent.Kind != Kind)
            {
                return(false);
            }
            List <string> names   = this.GetStringValues(ATTR_NAME);
            List <string> names2  = obj.GetStringValues(ATTR_NAME);
            bool          eqNames = false;

            if ((names != null && names.Count > 0 && names2 != null) && names2.Count > 0)
            {
                foreach (string n in names)
                {
                    if (names2.Contains(n))
                    {
                        eqNames = true;
                    }
                }
                if (!eqNames)
                {
                    return(false);
                }
            }
            List <string> typs   = this.GetStringValues(ATTR_TYPE);
            List <string> typs2  = obj.GetStringValues(ATTR_TYPE);
            bool          eqTyps = false;

            if ((typs != null && typs.Count > 0 && typs2 != null) && typs2.Count > 0)
            {
                foreach (string ty in typs)
                {
                    if (typs2.Contains(ty))
                    {
                        eqTyps = true;
                    }
                }
                if (!eqTyps)
                {
                    return(false);
                }
            }
            if (!eqTyps && !eqNames)
            {
                return(false);
            }
            Pullenti.Ner.Referent re1 = this.GetSlotValue(ATTR_REF) as Pullenti.Ner.Referent;
            Pullenti.Ner.Referent re2 = obj.GetSlotValue(ATTR_REF) as Pullenti.Ner.Referent;
            if (re1 != null && re2 != null)
            {
                if (!re1.CanBeEquals(re2, typ))
                {
                    return(false);
                }
            }
            else if (re1 != null || re2 != null)
            {
            }
            return(true);
        }