Exemplo n.º 1
0
        public void SetProgram(List<Loop> loops, List<BasicBlock> blocks)
        {
            // build DAG of basic blocks
            //  excluding backedges
            Graph g = new Graph();
            Dictionary<BasicBlock, Node> NodeMap = new Dictionary<BasicBlock, Node>();
            foreach (BasicBlock b in blocks)
            {
                Node n = new Node(b);
                g.AddNode(n);
                NodeMap.Add(b,n);
            }

            foreach (BasicBlock b in blocks)
                foreach (BasicBlock s in b.Successors)
                    if (!s.Dominates(b))
                        g.AddEdge(NodeMap[b], NodeMap[s]);

            // walk over loops inner to outer
            //  for each loop, replace its contents with a single "super-node"
            foreach( Loop l in loops )
            {
                Node[] loopNodes = new Node[l.BlockCount];
                int n = 0;
                foreach (BasicBlock b in l.Blocks)
                    loopNodes[n++] = NodeMap[b];

                g.CombineNodes(loopNodes,l);
            }

            // now populate the tree view with loops and branches
            TreeNode root = new TreeNode("program");
            BuildTree(root, g);
            treeView1.Nodes.Add(root);
        }
Exemplo n.º 2
0
		internal SecurityHandler(Node node)
		{
			if (node == null)
				throw new ArgumentNullException("node");

			_node = node;
		}
Exemplo n.º 3
0
		/** --------------------------------------------
		 * @brief  BVH構造を取得
		 * @return void
		 * --------------------------------------------*/
		private void setBVH()
		{
			if (_bvh == null) return;
			if (_bvh.IsEnable == false) return;

			// 仮格納
			foreach (var node in _bvh.GetNodeList())
			{
				Node n = new Node();

				n.name = node.Name;
				n.parentName = (node.Parent != null) ? node.Parent.Name : "";
				n.localPos = new Vector3(node.Offset.X, node.Offset.Y, node.Offset.Z) * SCALE;

				_nodeList.Add(n);
			}
			// 親インスタンスを探索、格納
			foreach (var node in _nodeList)
			{
				foreach (var n in _nodeList)
				{
					if (node.parentName == n.name)
					{
						node.parent = n;
						break;
					}
				}

			}

		}
Exemplo n.º 4
0
		internal void Delete()
		{
			_iBalance = -2;
			_nLeft = null;
			_nRight = null;
			_nParent = null;
		}
Exemplo n.º 5
0
        private void Constructure_Click(object sender, EventArgs e)
        {
            node = new Node[275];
            for (int i = 0; i < 275; i++)
            {
                node[i] = new Node();
                node[i].Visit = new double[530];
                node[i].VTotal = 0;
                node[i].FTable = new double[530];
                node[i].current = 0;
                node[i].Rank = 0;
            }

            packet = new Packet[21];
            for (int j = 0; j < 21; j++)
            {
                packet[j] = new Packet();
                packet[j].current = 0;
                packet[j].so = 0;
                packet[j].des = 0;
                packet[j].Rank = 0;
                packet[j].transtime = 0;
                packet[j].fin = false;
            }
            state.Text = "Construct over.";
        }
Exemplo n.º 6
0
 private void SubscribeCallback(
     string topic, Node.Lib.Message snap_shot, Node.Lib.Message update)
 {
     string val;
     if(null != update)
         if (update.TryGetValue("counter", out val))
             txtOutput.Text = val;
 }
Exemplo n.º 7
0
 public static void Button(Node node)
 {
     node.button.BackColor = Color.White;
     if (node.Left != null)
         Button(node.Left);
     if (node.Right != null)
         Button(node.Right);
 }
Exemplo n.º 8
0
 public static string GetCode(Node node, bool resolvedNames)
 {
     var sw = new StringWriter();
     var cg = new SqlServerCodeGenerator();
     cg.ResolveNames = resolvedNames;
     cg.Execute(sw, node);
     return sw.ToString();
 }
Exemplo n.º 9
0
 private void CalculateBoardScore(Node<BoardState> node )
 {
     node.Data.calculateBoardScore();
     foreach (var childNode in node.ChildrenList)
     {
         CalculateBoardScore(childNode);
     }
 }
Exemplo n.º 10
0
 public Form_weight(List<Link> links, char NameLink, Node nodeOut, Node nodeIn)
 {
     InitializeComponent();
     this.links = links;
     this.NameLink = NameLink;
     this.nodeIn = nodeIn;
     this.nodeOut = nodeOut;
 }
Exemplo n.º 11
0
 private void btnPush_Click(object sender, EventArgs e)
 {
     if (txtPush.Text != "")
     {
         Node newNode = new Node(txtPush.Text);
         stack.Push(newNode);
     }
     else MessageBox.Show("Cannot enter empty string.");
 }
Exemplo n.º 12
0
 private void AddChildClick(object sender, EventArgs e)
 {
     if (_tree.SelectedNode != null)
     {
         Node parent = _tree.SelectedNode.Tag as Node;
         Node node = new Node("child" + parent.Nodes.Count.ToString());
         parent.Nodes.Add(node);
         _tree.SelectedNode.IsExpanded = true;
     }
 }
Exemplo n.º 13
0
 public Form1()
 {
     InitializeComponent();
     pictureBoxs = this.Controls.OfType<PictureBox>().ToList();
     cross = Image.FromFile("cross.png");
     nought = Image.FromFile("nought.png");
     boardTree = new Node<BoardState>(BoardState.getEmptyBord());
     populateNode(boardTree);
     CalculateBoardScore(boardTree);
 }
 bool handleMouseDown(MouseEventArgs e, Vector3 v, Node q)
 {
     if (q.Tag == null || (q.Tag as ILrentObject.ObjectTagger).Object == null)
         return false;
     label8.Visible = false;
     ((lastLabel as Label).Tag as eCEntityProxy).Entity = (q.Tag as ILrentObject.ObjectTagger).Object;
     lastLabel.Text = ((lastLabel as Label).Tag as eCEntityProxy).Entity.ToString();
     (Parent as PoperContainer).CAN_CLOSE = true;
     P.OnBufferClick = null;
     return false;
 }
Exemplo n.º 15
0
        public void cycleBoxes(Node<BoardState> node)
        {
            setImageBoxes(node.Data);
            Application.DoEvents();
            Thread.Sleep(50);

            foreach (var childNode in node.ChildrenList)
            {
                cycleBoxes(childNode);
            }
        }
Exemplo n.º 16
0
        public void load_document(Node root)
        {
            this.DocumentRoot = root;
            this.DocumentRoot.RealRenameDisabled = true;
            this.nodeTreeView.Nodes[0].Text = this.DocumentRoot.Name;
            build_node_tree(this.DocumentRoot, this.nodeTreeView.Nodes[0]);

            this.nodeTreeView.SelectedNode = this.nodeTreeView.Nodes[0];
            load_node(this.DocumentRoot);

            refresh_enabled_states();
        }
Exemplo n.º 17
0
        private void AddNode(TreeNode fromView, Node<string> n)
        {
            var node = fromView.Nodes.Add(n.Value);

            if (n.Children.Count > 0)
            {
                foreach (var token in n.Children)
                {
                    AddNode(node, token);
                }
            }
        }
Exemplo n.º 18
0
 //以下是窗体控制内容
 public PlayForm()
 {
     InitializeComponent();
     outputStack = new Stack<string>();
     begainNode = new Node();
     targetNode = new Node();
     AddWeghit();
     InitMyData();
     InitMyParam();
     UnEnableMyForm();
     resetStartEndState();
 }
Exemplo n.º 19
0
        private void WriteNode(Node<NodeType> node, int indent)
        {
            foreach (Node<NodeType> child in node.Children)
            {
                nodes.Text += Environment.NewLine +
                    new string(' ', indent * 4) +
                    child.NodeType +
                    (child.Text == "" ? "" : ":" + child.Text);

                WriteNode(child, indent + 1);
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 左ペインのつりーノードの表示
        /// </summary>
        /// <param name="treeNode"></param>
        /// <param name="node"></param>
        void ConstructTreeNode(TreeNode treeNode, Node node)
        {
            if (treeNode == null) {
                treeNode = treeView1.Nodes.Add (node.UniqueID.ToString (), node.Name);
            }
            else {
                treeNode = treeNode.Nodes.Add (node.UniqueID.ToString (), node.Name);
            }
            treeNode.Tag = node;

            foreach (var child in node.Children) {
                ConstructTreeNode (treeNode, child);
            }
        }
Exemplo n.º 21
0
        public void Add(BaseItem item)
        {
            if (_currentItem == item) return;

            Node node = new Node(item.Name);
            _items.Add(node, item);

            if (_currentNode != null)
            {
                if (_currentNode.NextNode == null)
                {
                    Node parent = _currentNode.Parent;

                    if (parent != null)
                    {
                        parent.Nodes.Add(node);
                        node.Parent = parent;
                    }
                    else
                    {
                        _model.Nodes.Add(node);
                    }
                }
                else
                {
                    Node parent = _currentNode;
                    parent.Nodes.Add(node);
                    node.Parent = parent;
                }
            }
            else
            {
                _model.Nodes.Add(node);
            }

            _currentItem = item;
            _currentNode = node;

            try
            {
                _ignoreSelect = true;
                _treeView.SelectedNode = _treeView.FindNode(_model.GetPath(node));
            }
            finally
            {
                _ignoreSelect = false;
            }

            SetCaption();
        }
Exemplo n.º 22
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            TreeModel Model = new TreeModel();
            Node Root = new Node("Bla bla bla");

            for (int i = 0; i < 20; i++)
                Root.Nodes.Add(new Node("Child " + i.ToString()));

            Model.Nodes.Add(Root);
            treeListView1.Model = Model;

            treeListView1.SelectedNode = treeListView1.FindNode(Model.GetPath(Root));
            treeListView1.SelectedNode.IsExpanded = true;
            treeListView1.Focus();
        }
Exemplo n.º 23
0
 private void LoadModel(Entry entry, Func<Entry, Item> itemSelector, Node parentNode)
 {
     foreach (var childEntry in entry.ChildEntries)
     {
         var item = itemSelector(childEntry);
         string text = string.Empty;
         if (item != null)
         {
             text = item.Name;
         }
         var node = new Node(text);
         LoadModel(childEntry, itemSelector, node);
         parentNode.Nodes.Add(node);
     }
 }
Exemplo n.º 24
0
        private void Constructure_Click(object sender, EventArgs e)
        {
            //packnum = int.Parse(packn.Text);
            //locanum = int.Parse(locan.Text);
            //copiesnum = int.Parse(copies.Text);
            packnum = 2000;
            locanum = 20;
            copiesnum = 10;
            picc = new int[10];
            node = new Node[100];
            income = new bool[100];
            for (int i = 0; i < 100; i++)
            {
                node[i] = new Node();
                node[i].Visit = new double[21];
                node[i].VTotal = 0;
                node[i].FTable = new double[21];
                node[i].current = 0;
                node[i].Rank = 0;
                node[i].buffer = new int[(packnum + 1)];
                income[i] = false;

            }

            packet = new Packet[(int)packnum];
            for (int j = 0; j < packnum; j++)
            {
                packet[j] = new Packet();
                packet[j].current = 0;
                packet[j].so = 0;
                packet[j].des = 0;
                packet[j].Rank = 0;
                packet[j].transtime = 0;
                packet[j].begintime = 0;
                packet[j].fin = false;
                packet[j].PTable = new double[(locanum + 1)];

            }

            location = new Loca[(int)locanum + 1];
            for (int k = 0; k < locanum + 1; k++)
            {
                location[k] = new Loca();
                location[k].buffer = new int[(packnum)];
            }
            state.Text = "Construct over.";
        }
Exemplo n.º 25
0
 public void AddToTree(Node node)
 {
     string s = " ";
     if (Checker(treeView1.Nodes, node.parent, ref s))
     {
         s = s.Substring(1);
         string[] strHelp = s.Split(' ');
         TreeNodeCollection nodeCollection = treeView1.Nodes;
         for (int i = 1; i < strHelp.Length; i++)
         {
             if (strHelp[i]!="")
             nodeCollection = nodeCollection[strHelp[i]].Nodes;
         }
         nodeCollection.Add(node.key, node.text);
     }
     else treeView1.Nodes.Add(node.key, node.text);
 }
Exemplo n.º 26
0
        public string Build(Node<NodeType> node)
        {
            string sql = "select";

            if (node.Children.Any(x => x.NodeType == NodeType.Distinct))
            {
                sql += @" distinct
            ";
            }
            else
            {
                sql += "      ";
            }

            foreach (Node<NodeType> selectField in node.Children.First(x => x.NodeType == NodeType.SelectFields).Children)
            {
                if (selectField.NodeType == NodeType.Star)
                {
                    sql += "*";
                }
                else
                {
                    foreach (Node<NodeType> child in selectField.Children)
                    {
                        if (child.NodeType == NodeType.ObjectRef)
                        {
                            sql += " ";
                            sql = ObjectRef(child, sql);
                        }
                    }
                }
            }

            Node<NodeType> table = node.Children.First(x => x.NodeType == NodeType.Table);

            sql += $@"
from        {TableAndAlias(table)}";

            foreach (Node<NodeType> selectField in node.Children.Where(x => x.NodeType == NodeType.Join))
            {
                sql += $@"
{JoinAndAlias(selectField)}";
            }

            return sql;
        }
Exemplo n.º 27
0
 private void Constructure_Click(object sender, EventArgs e)
 {
     node = new Node[275];
     for (int i = 0; i < 275; i++)
     {
         node[i] = new Node();
         node[i].Visit = new double[530];
         node[i].VTotal = 0;
         node[i].FTable = new double[530];
         node[i].current = 0;
         node[i].Rank = 0;
         node[i].packet = false;
         node[i].so = false;
         node[i].des = false;
     }
     state.Text = "Construct over.";
 }
Exemplo n.º 28
0
        private static List<int> FindRoots()
        {
            List<int> roots = new List<int>();
            for (int i = 0; i < nodes.Length; i++)
            {
                if (nodes[i] == null)
                {
                    nodes[i] = new Node(i);
                }
                if (nodes[i].Parent == null)
                {
                    roots.Add(nodes[i].Value);
                }

            }
            return roots;
        }
Exemplo n.º 29
0
        private void RefreshDomain(Node node)
        {
            NodeTreeNode nodeTreeNode = domain.Nodes.Cast<NodeTreeNode>().FirstOrDefault();

            if (nodeTreeNode == null)
            {
                nodeTreeNode = new NodeTreeNode(node);
                domain.Nodes.Add(nodeTreeNode);
            }
            else
            {
                nodeTreeNode.Node = node;
            }

            RefreshDomain(nodeTreeNode);

            nodeTreeNode.Expand();
        }
Exemplo n.º 30
0
 private void CreateTree()
 {
     root = new Node("Root");
     for (int i = 0; i < 1000; i++)
     {
         var n = new Node("Node " + i);
         root.Childs.Add(n);
         for (int j = 0; j < 10; j++)
         {
             var subNode = new Node("SubNode " + i + "-" + j);
             n.Childs.Add(subNode);
             for (int k = 0; k < 10; k++)
             {
                 var subSubNode = new Node("SubNode " + i + "-" + j + "-" + k);
                 subNode.Childs.Add(subSubNode);
             }
         }
     }
 }