internal static unsafe FreeNode *Create(PhysicalHeap *inHeap, UIntPtr addr, UIntPtr pages) { DebugStub.Assert(addr >= inHeap->startAddr); DebugStub.Assert((addr + (pages * MemoryManager.PageSize)) <= inHeap->heapLimit); FreeNode *node = (FreeNode *)addr; // This had better be a free page in the main table DebugStub.Assert(inHeap->PageWord(inHeap->PageIndex(addr)) == FreePage, "Creating a FreeNode for non-free page {0:x}", __arglist(addr)); node->signature = FreeNode.Signature; node->bytes = pages * MemoryManager.PageSize; node->prev = null; node->next = null; node->last = null; if (pages > 1) { node->last = LastNode.Create(inHeap, addr, node); } return(node); }
protected virtual QueryNode VisitLast(LastNode node, AzureQueryOptimizerState state) { QueryNode queryNode1 = this.Visit(node.SourceNode, state); QueryNode queryNode2 = this.Visit(node.PredicateNode, state); if (queryNode2.NodeType == QueryNodeType.MatchAll) { return((QueryNode) new LastNode(queryNode1, queryNode2, node.AllowDefaultValue)); } return((QueryNode) new LastNode(this.VisitAnd(new AndNode(queryNode1, queryNode2), state), (QueryNode) new MatchAllNode(), node.AllowDefaultValue)); }
protected virtual QueryNode VisitLast(LastNode node, ElasticSearchQueryOptimizerState state) { var node2 = Visit(node.SourceNode, state); var node3 = Visit(node.PredicateNode, state); if (node3.NodeType == QueryNodeType.MatchAll) { return(new LastNode(node2, node3, node.AllowDefaultValue)); } return(new LastNode(VisitAnd(new AndNode(node2, node3), state), new MatchAllNode(), node.AllowDefaultValue)); }
/// <summary> /// Removes the last node from the primary timeline /// </summary> public void RemoveLastNode() { //is there actually something to remove? if (!LastNode.Equals(GameTreeRoot)) { //remove last node, make its parent last var previousMove = LastNode.Parent; previousMove.Branches.RemoveNode(LastNode); LastNode = previousMove; } }
private void tvFiles_DragOver(object sender, DragEventArgs e) { // Retrieve the client coordinates of the mouse position. Point targetPoint = tvFiles.PointToClient(new Point(e.X, e.Y)); // Select the node at the mouse position. tvFiles.SelectedNode = tvFiles.GetNodeAt(targetPoint); if (LastNode != null) { LastNode.Collapse(); } CurrentNode.Expand(); }
/// <summary> /// Adds a node to the end of this code path /// </summary> /// <param name="node">node to add</param> /// <param name="lastNode">the new last node</param> private CodePath AddLast(MethodNode node, MethodNode lastNode) { if (FirstNode == null) { FirstNode = node; } if (LastNode != null) { var version = LastNode.AddNextNode(node); this.treePath[LastNode.NodeId] = version; } LastNode = lastNode; this.Length += 1; return(this); }
/// <summary> /// 生成word /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { //获取组合目录的节点个数 int count = treeView2.Nodes.Count; if (count == 0) { MessageBox.Show("组合目录中未有章节!"); return; } List <LeaderNode> leaderNodes = new List <LeaderNode>(); foreach (TreeNode node in treeView2.Nodes) { LeaderNode leaderNode = new LeaderNode(); leaderNode.Name = node.Text; if (node.Nodes.Count != 0) { List <CentreNode> centreNodes = new List <CentreNode>(); foreach (TreeNode node1 in node.Nodes) { CentreNode centreNode = new CentreNode(); centreNode.Name = node1.Text; if (node1.Nodes.Count != 0) { List <LastNode> lastNodes = new List <LastNode>(); foreach (TreeNode node2 in node1.Nodes) { LastNode lastNode = new LastNode(); lastNode.Name = node2.Text; lastNodes.Add(lastNode); } centreNode.LastNodeList = lastNodes; } centreNodes.Add(centreNode); } leaderNode.CentreNodeList = centreNodes; } leaderNodes.Add(leaderNode); } CreateWord createWord = CreateWord.GetInstance(leaderNodes); //CreateWord cw = new CreateWord(); createWord.Create(); }
public unsafe void Free(UIntPtr addr, UIntPtr bytes, Process process) { if (addr == UIntPtr.Zero) { // Silently accept freeing null return; } // We always hand out memory in page-size chunks, so round up what // the caller thinks their block size is bytes = MemoryManager.PagePad(bytes); // Our blocks always start on page boundaries DebugStub.Assert(MemoryManager.IsPageAligned(addr)); ushort tag = process != null ? (ushort)process.ProcessId : KernelPage; bool iflag = Lock(); try { CheckConsistency(); UIntPtr numPages = MemoryManager.PagesFromBytes(bytes); VerifyOwner(addr, numPages, tag); FreeNode *nextBlock = null; FreeNode *prevBlock = null; if ((addr + bytes) < heapLimit) { fixed(PhysicalHeap *thisPtr = &this) { nextBlock = FreeNode.GetNodeAt(thisPtr, addr + bytes); } } if (addr > startAddr) { fixed(PhysicalHeap *thisPtr = &this) { prevBlock = LastNode.GetNodeFromLast(thisPtr, addr - MemoryManager.PageSize); } } // Don't mark pages as free until we're done discovering the // previous and next blocks, or the attempt to discover // the previous and next blocks gets confused to find itself // adjacent to a free block. SetPages(addr, numPages, FreePage); // Coalesce with the preceding region if (prevBlock != null) { addr = (UIntPtr)prevBlock; bytes += prevBlock->bytes; freeList.Remove(prevBlock); } // Coalesce with the following region if (nextBlock != null) { bytes += nextBlock->bytes; freeList.Remove(nextBlock); } // Blocks should always be integral numbers of pages DebugStub.Assert(MemoryManager.IsPageAligned(bytes)); // Create the free node. fixed(PhysicalHeap *thisPtr = &this) { freeList.CreateAndInsert(thisPtr, addr, bytes / MemoryManager.PageSize); } CheckConsistency(); } finally { Unlock(iflag); } }
protected virtual void StripLast(LastNode node, HashSet <QueryMethod> additionalQueryMethods) { additionalQueryMethods.Add(new LastMethod(node.AllowDefaultValue)); }
/// <summary> /// 创建章节 /// </summary> /// <param name="doc"></param> private void CreateChaptersAndSections(XWPFDocument doc) { using (var myEntity = new MyEntity()) { //读取模板 FileStream stream = File.OpenRead(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "模板\\施工说明书(模板).docx"); XWPFDocument readDoc = new XWPFDocument(stream); //创建段落 XWPFParagraph paragraph = doc.CreateParagraph(); paragraph.CreateRun().AddBreak();//新建页 for (int i = 0; i < leaderNodes.Count; i++) { LeaderNode leaderNode = leaderNodes[i]; paragraph = doc.CreateParagraph(); //创建段落 //行距 paragraph.setSpacingBetween(30, LineSpacingRule.EXACT); //固定值,30磅 //间距 paragraph.SpacingAfterLines = 8; //上 paragraph.SpacingBeforeLines = 8; //下 //对齐方式 paragraph.Alignment = ParagraphAlignment.BOTH; //两端对齐 //大纲级别 CT_DecimalNumber cT_DecimalNumber = new CT_DecimalNumber(); cT_DecimalNumber.val = "0级";//1级目录 paragraph.GetCTP().AddNewPPr().outlineLvl = cT_DecimalNumber; //标题信息 XWPFRun run = paragraph.CreateRun(); run.SetText((i + 1).ToString()); //1级 run.FontSize = 14; //字体大小 run.FontFamily = "Times New Roman"; //字体 run = paragraph.CreateRun(); run.SetText(" " + leaderNode.Name); //1级 run.FontSize = 14; //字体大小 run.FontFamily = "宋体"; //字体 //根据节点信息在数据库中查询 var se = (from s in myEntity.Section where s.name == leaderNode.Name select s).ToList(); Section section = se.First();//章节对象 //判断章节中是否存在内容 bool flag = IsContainTable(leaderNode.Name, doc, readDoc); if (flag) { //根据节点对象id信息在数据库内容表中查询 var contents = (from c in myEntity.ContentTab where c.section_id == section.Id select c).ToList(); if (contents.Count > 0) { foreach (ContentTab contentTab in contents) { paragraph = doc.CreateParagraph(); //创建段落 paragraph.IndentationFirstLine = MainForm.Indentation("宋体", 14, 4, new FontStyle()); //首行缩进 XWPFRun r = paragraph.CreateRun(); r.SetText(contentTab.content); r.FontFamily = "宋体"; r.FontSize = 14; } } } if (leaderNode.CentreNodeList != null) { //遍历二级目录 for (int j = 0; j < leaderNode.CentreNodeList.Count; j++) { CentreNode centreNode = leaderNode.CentreNodeList[j]; paragraph = doc.CreateParagraph(); //创建段落 //行距 paragraph.setSpacingBetween(30, LineSpacingRule.EXACT); //固定值,30磅 //对齐方式 paragraph.Alignment = ParagraphAlignment.BOTH; //两端对齐 //大纲级别 cT_DecimalNumber = new CT_DecimalNumber(); cT_DecimalNumber.val = "1级";//2级目录 paragraph.GetCTP().AddNewPPr().outlineLvl = cT_DecimalNumber; //标题信息 run = paragraph.CreateRun(); run.SetText((i + 1) + "." + (j + 1)); //2级 run.FontSize = 14; //字体大小 run.FontFamily = "Times New Roman"; //字体 run = paragraph.CreateRun(); run.SetText(" " + centreNode.Name); //2级 run.FontSize = 14; //字体大小 run.FontFamily = "宋体"; //字体 //根据节点信息在数据库中查询 se = (from s in myEntity.Section where s.name == centreNode.Name select s).ToList(); section = se.First();//章节对象 //判断章节中是否存在内容 flag = IsContainTable(centreNode.Name, doc, readDoc); if (flag) { //根据节点对象id信息在数据库内容表中查询 var contents = (from c in myEntity.ContentTab where c.section_id == section.Id select c).ToList(); if (contents.Count > 0) { foreach (ContentTab contentTab in contents) { paragraph = doc.CreateParagraph(); //创建段落 paragraph.IndentationFirstLine = MainForm.Indentation("宋体", 14, 4, new FontStyle()); //首行缩进 XWPFRun r = paragraph.CreateRun(); r.SetText(contentTab.content); r.FontFamily = "宋体"; r.FontSize = 14; } } } if (centreNode.LastNodeList != null) { //遍历三级目录 for (int k = 0; k < centreNode.LastNodeList.Count; k++) { LastNode lastNode = centreNode.LastNodeList[k]; paragraph = doc.CreateParagraph(); //创建段落 //行距 paragraph.setSpacingBetween(30, LineSpacingRule.EXACT); //固定值,30磅 //对齐方式 paragraph.Alignment = ParagraphAlignment.BOTH; //两端对齐 //大纲级别 cT_DecimalNumber = new CT_DecimalNumber(); cT_DecimalNumber.val = "2级";//3级目录 paragraph.GetCTP().AddNewPPr().outlineLvl = cT_DecimalNumber; //标题信息 run = paragraph.CreateRun(); run.SetText((i + 1) + "." + (j + 1) + "." + (k + 1)); //3级 run.FontSize = 14; //字体大小 run.FontFamily = "Times New Roman"; //字体 run = paragraph.CreateRun(); run.SetText(" " + lastNode.Name); //3级 run.FontSize = 14; //字体大小 run.FontFamily = "宋体"; //字体 //根据节点信息在数据库中查询 se = (from s in myEntity.Section where s.name == lastNode.Name select s).ToList(); section = se.First(); //章节对象 //判断章节中是否存在内容 flag = IsContainTable(lastNode.Name, doc, readDoc); if (flag) { //根据节点对象id信息在数据库内容表中查询 var contents = (from c in myEntity.ContentTab where c.section_id == section.Id select c).ToList(); if (contents.Count > 0) { foreach (ContentTab contentTab in contents) { paragraph = doc.CreateParagraph(); //创建段落 paragraph.IndentationFirstLine = MainForm.Indentation("宋体", 14, 4, new FontStyle()); //首行缩进 XWPFRun r = paragraph.CreateRun(); r.SetText(contentTab.content); r.FontFamily = "宋体"; r.FontSize = 14; } } } } } } } } stream.Close(); } }