Exemplo n.º 1
0
        public void Populate()
        {
            //variables
            int i = 0;

            while (i < _kB.Universe.Length)
            {
                if ((_kB.Universe[i] as Variable) != null)
                {
                    ChainNode n = new ChainNode(_kB.Universe[i]);

                    if ((_kB.Universe[i] as Variable).Defined)
                    {
                        _frontier.Add(n);
                    }

                    _nodes.Add(n);
                }

                i += 1;
            }

            //connections
            i = 0;
            while (i < _kB.Assertions.Length)
            {
                if ((_kB.Assertions[i] as Variable) == null)
                {
                    int j = 0;
                    while (j < _nodes.Count)
                    {
                        int k = 0;
                        while (k < _nodes.Count)
                        {
                            if (j != k)
                            {
                                if (_nodes[j].Stat.DependsOn(_kB.Assertions[i].Identifier))
                                {
                                    //set dependencies
                                }
                            }

                            k += 1;
                        }

                        j += 1;
                    }
                }

                i += 1;
            }
        }
Exemplo n.º 2
0
        public void AddDependancies(ChainNode toAdd)
        {
            bool found = false;

            foreach (ChainNode c in _dependingOn)
            {
                if (toAdd.Stat.Identifier == c.Stat.Identifier)
                {
                    found = true;

                    break;
                }
            }

            if (!found)
            {
                _dependingOn.Add(toAdd);
            }
        }