Ejemplo n.º 1
0
        public void AddLink(string node1, string node2, ConceptLink.ConceptLinkType linkType, int strength, int elasticity)
        {
            // First search for nodes; add if they don't exist.
            ConceptNode n1, n2;

            n1 = FindNodeOrNull(node1);
            n2 = FindNodeOrNull(node2);

            if (n1 == null)
            {
                n1 = new ConceptNode(node1, getNewNodeID(), DEFAULT_CONCEPTUAL_DEPTH, false, true, DEFAULT_ACTIVATION);
                AddNode(n1);
            }
            if (n2 == null)
            {
                n2 = new ConceptNode(node2, getNewNodeID(), DEFAULT_CONCEPTUAL_DEPTH, false, true, DEFAULT_ACTIVATION);
                AddNode(n1);
            }

            // Make the new link.
            ConceptLink link = new ConceptLink(n1, n2, linkType, strength, elasticity);

            // Add the link to each node.
            n1.AddLink(link);
            n2.AddLink(link);

            // Keep the links list in sync too.
            links.Add(link);
        }
Ejemplo n.º 2
0
 public void AddLink(ConceptLink link)
 {
     links.Add(link);
 }