Beispiel #1
0
 public void RemoveLink(SemLink li)
 {
     if (Links.Contains(li))
         Links.Remove(li);
     if (li.Source.LinksFrom.Contains(li))
         li.Source.LinksFrom.Remove(li);
     if (li.Target.LinksTo.Contains(li))
         li.Target.LinksTo.Remove(li);
     if (li.AltLink != null && li.AltLink.AltLink == li)
         li.AltLink.AltLink = null;
 }
Beispiel #2
0
 public SemLink AddLink(SemLinkType typ, SemObject src, SemObject tgt, string ques = null, bool or = false, string prep = null)
 {
     if (src == null || tgt == null)
         return null;
     foreach (SemLink li in src.Graph.Links)
     {
         if (li.Typ == typ && li.Source == src && li.Target == tgt)
             return li;
     }
     if (src.Graph != tgt.Graph)
     {
         foreach (SemLink li in tgt.Graph.Links)
         {
             if (li.Typ == typ && li.Source == src && li.Target == tgt)
                 return li;
         }
     }
     if (tgt.Morph.NormalCase == "ДОМ")
     {
     }
     SemLink res = new SemLink(this, src, tgt) { Typ = typ, Question = ques, IsOr = or, Preposition = prep };
     Links.Add(res);
     return res;
 }