public void TestAddition() { var p = new NodesList<Node>(); p.Add(new Node("1.1.1.1")); p.Add(new Node("1.1.1.1")); p.Add(new Node("1.1.1.2")); Assert.IsTrue(p.Count==2); }
/// <summary> /// Determine if the graph specified with list of nodes and list of nodes is partial /// Graph of the Graph that called the method on. /// </summary> /// <param name="nodes">List of nodes that specify the nodes of the graph that we want to exam.</param> /// <param name="lines">List of lines that specify the lines of the graph that we want to exam.</param> /// <returns>Return true if the graph is Partial , Otherwise , false.</returns> public bool IsPartialGraph(SortedList <int, Node> nodes, SortedList <string, Line> lines) { // Check if all nodes in parameter in the Primary graph. foreach (Node node in nodes.Values) { if (NodesList.ContainsValue(node) == false) // node not found in NodesList { return(false); } } // Check if all lines in paramter in the Primary graph. foreach (Line line in lines.Values) { if (LinesList.ContainsValue(line) == false) // line not found in lineslist { return(false); } } foreach (Line line in LinesList.Values) { if ((nodes.ContainsValue(line.FirstNode) && nodes.ContainsValue(line.SecondNode)) && (lines.ContainsValue(line) == false)) { return(false); } } return(true); }
private void BindgingSettingNodeToNodeTlv(IXmlSetting currentXmlSetting, string strSelectedItemText) { if (SelectType != "") { NodesList.Clear(); foreach (IXmlSettingNode tempNode in currentXmlSetting.GetNodes) { tempNode.IdtAttributes = tempNode.identifier(); if (tempNode.compare_flag) { tempNode.Compare_flag = "1"; tempNode.CompareImage = System.IO.Directory.GetCurrentDirectory() + "\\Images\\compare_flag_true.png"; } else { tempNode.Compare_flag = "0"; tempNode.CompareImage = System.IO.Directory.GetCurrentDirectory() + "\\Images\\compare_flag_false.png"; } tempNode.NameImage = System.IO.Directory.GetCurrentDirectory() + "\\Images\\node.png"; NodesList.Add(tempNode); if (tempNode.name == strSelectedItemText) { // neoItem.Selected = true; } } } }
public void LoadTestData(string path) { using (StreamReader stream = new StreamReader(path)) { numberOfNodes = Convert.ToInt32(stream.ReadLine()); string line = null; int inc = 0; do { line = stream.ReadLine(); if (line != null) { var data = line.Split(' '); NodesList.Add(new Node { Position = inc++, X = Double.Parse(data[0], System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture), Y = Double.Parse(data[1], System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture), Profit = Convert.ToDouble(data[2]), Visited = false }); } } while (line != null); } calcDistances(); }
public void AddNode(Node node) { ValidateArgumentIsNotNull(node); NodesList.Add(node.NodeNumber, node); //SetTheConnectionAndStartArray(); }
public bool Apply(Ets2Node node) { if (node.NodeUID == PrefabNodeUID) { PrefabNode = node; } if (node.NodeUID == StartNodeUID) { StartNode = node; return(true); } else if (node.NodeUID == EndNodeUID) { EndNode = node; return(true); } else if (NodesList.ContainsKey(node.NodeUID)) { NodesList[node.NodeUID] = node; return(true); } else { //Console.WriteLine("Could not apply node " + node.NodeUID.ToString("X16") + " to item " + ItemUID.ToString("X16")); return(false); } }
public bool Apply(Ets2Node node) { if (node.NodeUID == PrefabNodeUID) { PrefabNode = node; } if (node.NodeUID == StartNodeUID) { StartNode = node; return(true); } else if (node.NodeUID == EndNodeUID) { EndNode = node; return(true); } else if (NodesList.ContainsKey(node.NodeUID)) { NodesList[node.NodeUID] = node; return(true); } else { return(false); } }
private void DeleteNode() { if (SelectedNode != null) { NodesList.Remove(SelectedNode); } }
public bool LoadData(string path) { randomlyFlag = 0; if (NodesList != null) { NodesList.Clear(); } NodesList = new List <Node>(); StreamReader streamCheck = new StreamReader(path); string[] lineCheck = streamCheck.ReadLine().Split(' '); streamCheck.Close(); if (lineCheck.Length < 2) { LoadTestData(path); calcDistances(); return(true); } else { LoadPolishRoadData(path); return(false); } UnvisitedNodesList = new List <Node>(NodesList); }
private void AddNode(string name) { var id = Guid.NewGuid(); var node = new Node(id, name); Ids.Add(name, id); NodesList.Add(node); }
private Node create(Node node, Node selectedNode, Node lastSelectedNode) { Node n = new Node(); n.tagDeleted = node.tagDeleted; n.tokenType = node.tokenType; n.xmlTagName = node.xmlTagName; n.namespaceURI = node.namespaceURI; n.isVisible = node.isVisible; n.isGlyph = node.isGlyph; n.skip = node.skip; n.literalText = node.literalText; n.literalCaret = node.literalCaret; n.literalStart = node.literalStart; n.yOffset = node.yOffset; n.displayStyle = node.displayStyle; n.glyph = node.glyph; n.scriptLevel_ = node.scriptLevel_; n.type_ = node.type_; if (node.attrs != null) { n.attrs = new AttributeList(); node.attrs.CopyTo(n.attrs); } n.FontStyle = node.FontStyle; if (node.style_ != null) { n.style_ = new StyleAttributes(); node.style_.CopyTo(n.style_); } if (node == selectedNode) { this.selected_ = n; } if (node == lastSelectedNode) { this.lastSel_ = n; } if (node.HasChildren()) { NodesList list = node.GetChildrenNodes(); int count = list.Count; for (int i = 0; i < count; i++) { Node c = list.Get(i); Node child = this.create(c, selectedNode, lastSelectedNode); if (child != null) { n.AdoptChild(child); } } } return(n); }
public void TestAddition() { var p = new NodesList <Node>(); p.Add(new Node("1.1.1.1")); p.Add(new Node("1.1.1.1")); p.Add(new Node("1.1.1.2")); Assert.IsTrue(p.Count == 2); }
public void Prepare() { scenes[0].Prepare(); // Do not export empty arrays if (NodesList.Count > 0) { nodes = NodesList.ToArray(); NodesList.ForEach(node => node.Prepare()); } if (CamerasList.Count > 0) { cameras = CamerasList.ToArray(); } if (BuffersList.Count > 0) { buffers = BuffersList.ToArray(); } if (BufferViewsList.Count > 0) { bufferViews = BufferViewsList.ToArray(); } if (AccessorsList.Count > 0) { accessors = AccessorsList.ToArray(); } if (MeshesList.Count > 0) { meshes = MeshesList.ToArray(); } if (MaterialsList.Count > 0) { materials = MaterialsList.ToArray(); } if (TexturesList.Count > 0) { textures = TexturesList.ToArray(); } if (ImagesList.Count > 0) { images = ImagesList.ToArray(); } if (SamplersList.Count > 0) { samplers = SamplersList.ToArray(); } if (AnimationsList.Count > 0) { animations = AnimationsList.ToArray(); AnimationsList.ForEach(animation => animation.Prepare()); } if (SkinsList.Count > 0) { skins = SkinsList.ToArray(); } }
private void AddNode() { int nodesCount = NodesList.Count; if (nodesCount < maxNodesCount) { NodesList.Add(new Node("node" + nodesCount, new NodePin[10] { new NodePin(), new NodePin(), new NodePin(), new NodePin(), new NodePin(), new NodePin(), new NodePin(), new NodePin(), new NodePin(), new NodePin() })); } }
private bool AddNodeUID(ulong nodeUid) { if (nodeUid == 0 || Sector.Mapper.Nodes.ContainsKey(nodeUid) == false) { Valid = false; return(false); } else { NodesList.Add(nodeUid, null); return(true); } }
public void LoadPolishRoadData(string path) { StreamReader streamCheck = new StreamReader(path); string[] lineCheck = streamCheck.ReadLine().Split(' '); numberOfNodes = Convert.ToInt32(lineCheck[0]); numberOfPaths = Convert.ToInt32(lineCheck[1]); //wczytywanie miast profitow i pozycji geograficznej for (int j = 0; j < numberOfNodes; j++) { string[] linee = streamCheck.ReadLine().Split(' '); NodesList.Add(new Node { Position = Convert.ToInt32(linee[0]) - 1, Profit = Convert.ToInt32(linee[1]), X = Convert.ToDouble(linee[2]), Y = Convert.ToDouble(linee[3]) }); } UnvisitedNodesList = new List <Node>(NodesList); //wczytywanie dystansow miedzy miastami NodeDistances = new double[NodesList.Count, NodesList.Count]; NodeDistancesDisjkstry = new double[NodesList.Count, NodesList.Count]; int i = 0; string[] line = null; try { for (i = 0; i < numberOfPaths - 1; i++) { if (i > 852) { } line = streamCheck.ReadLine().Split(' '); int from = Convert.ToInt32(line[0]); int to = Convert.ToInt32(line[1]); int distance = Convert.ToInt32(line[2]); NodeDistances[from - 1, to - 1] = distance; NodeDistances[to - 1, from - 1] = distance; NodeDistancesDisjkstry[from - 1, to - 1] = distance; NodeDistancesDisjkstry[to - 1, from - 1] = distance; } } catch (Exception e) { MessageBox.Show(e.ToString() + "\n i:" + i + "\n" + line.ToString()); } streamCheck.Close(); }
public void getRoute(double maxDistance, int startPoint) { var currentNode = NodesList.First(p => p.Position == startPoint - 1); var list = new List <int>(); currentNode.Visited = true; double currentProfit = currentNode.Profit; var notVisitedNodes = new List <Node>(NodesList); list.Add(currentNode.Position); notVisitedNodes.Remove(currentNode); double distance = 0; while (true) { Node nextNode = null; double bestResult = 0; //wez srednio najlepszy punkt. foreach (var notVisitedNode in NodesList) { if (notVisitedNode.Visited == false) { var result = notVisitedNode.Profit / NodeDistances[currentNode.Position, notVisitedNode.Position]; if (result > bestResult && distance + NodeDistances[currentNode.Position, notVisitedNode.Position] <= maxDistance) { bestResult = result; nextNode = notVisitedNode; } } } //isc randomowo po bliskich dosc dobrych miastach, i miec ok. pol odleglosci powrotnej w zapasie jak zblizymy sie do tej wartosci wracamy. if (nextNode == null) { break; } nextNode.Visited = true; currentProfit += nextNode.Profit; distance += NodeDistances[currentNode.Position, nextNode.Position]; //var pair = new Tuple<Node,Node>(currentNode,nextNode); //Connections.Add(pair); //list.Add(nextNode.Position); currentNode = nextNode; } currentSequence = list.ToArray(); }
public void TestMergeInto() { var p = new NodesList<Node>(); p.Add(new Node("1.1.1.1")); p.Add(new Node("1.1.1.1")); p.Add(new Node("1.1.1.2")); p.Add(new Node("1.1.1.4")); var p2 = new NodesList<Node>(); p2.Add(new Node("1.1.1.1")); p2.Add(new Node("1.1.1.1")); p2.Add(new Node("1.1.1.2")); p2.Add(new Node("1.1.1.3")); p.MergeInto(p2); Assert.IsTrue(p.Count==4); }
private void InfoUpdate(object sender, EventArgs e) { InQueueCount.Content = replicationNode.MessagesQueueProc.InMessagesQueue.Count; OutQueueCount.Content = replicationNode.MessagesQueueProc.OutMessagesQueue.Count; Counter.Content = replicationNode.CheckCounter; NodesList.Clear(); if (replicationNode.NodesInfo != null) { foreach (var value in replicationNode.NodesInfo) { NodesList.AppendText( $"Id={value.NodeId},Role={value.Role},State={value.State},Count={value.CheckCounter},PCount={value.CheckCounterPrev} \r\n"); } } }
public void InitMockup() { var viewNode = new ViewNodeControl() { Width = 100, Height = 50, Title = "First", AllowDrop = true }; viewNode.HighlightAdorner = new HighlightAdorner(viewNode); viewNode.LinkAdorner = new LinkAdorner(viewNode); viewNode.Drop += LinkAction; viewNode.IsSelectedChanged += (node, isSelected) => { if (isSelected) { NodesList.ToList().ForEach(n => { if (n.Equals(node) == false) { (n as ISelectable).IsSelected = false; } }); } }; NodesList = new ObservableCollection <UIElement>(); NodesList.Add(viewNode); viewNode = new ViewNodeControl() { Width = 100, Height = 50, Title = "Second", AllowDrop = true }; viewNode.HighlightAdorner = new HighlightAdorner(viewNode); viewNode.LinkAdorner = new LinkAdorner(viewNode); viewNode.Drop += LinkAction; viewNode.IsSelectedChanged += (node, isSelected) => { if (isSelected) { NodesList.ToList().ForEach(n => { if (n.Equals(node) == false) { (n as ISelectable).IsSelected = false; } }); } }; NodesList.Add(viewNode); }
public Route GreedyRouteConstruction() { double distance = 0; double profit = 0; List <Node> route = new List <Node>(); //construct route List <Node> unvisited = new List <Node>(NodesList); Node currentNode; Node startNode = new Node(); //int random = rand.Next(0, NodesList.Count - 1); //random = rand.Next(0, NodesList.Count - 1); startNode = NodesList.ElementAt(0); route.Add(startNode); //add start point to route unvisited.Remove(startNode); currentNode = startNode; while (distance < Dmax) { Node best = GetTheBestNode(currentNode, unvisited, distance, profit); //get whivh has the best overal profil to distance if (CheckDistance(distance, Dmax, currentNode, best, startNode)) //check wether route back to start is possible { distance = distance + NodeDistances[currentNode.Position, best.Position]; profit = profit + best.Profit; route.Add(best); unvisited.Remove(best); currentNode = best; } else { break; } } route.Add(route.ElementAt(0)); distance = distance + NodeDistances[route.ElementAt(route.Count() - 2).Position, route.ElementAt(route.Count() - 1).Position]; //UnvisitedNodesList = unvisited; Route r = new Route(); r.CalculatedRoute = route; r.Distance = distance; r.RouteProfit = profit; r.Unvisited = unvisited; UnvisitedNodesList = unvisited; return(r); }
public override void getSize(Node containerNode) { if (containerNode.firstChild == null) { base.painter_.MeasureBox(containerNode, containerNode.style_, "X"); } else if (this.isStretchy) { int rowB = containerNode.box.Baseline; int rowH = containerNode.box.Height; int normBase = base.painter_.MeasureBaseline(containerNode, containerNode.style_, "X"); int baseLine_Shift = base.painter_.CenterHeight(containerNode); if (!base.painter_.IsAboveBaseline(base.rect.height, base.rect.baseline, normBase)) { NodesList list = containerNode.GetChildrenNodes(); for (int i = 0; i < list.Count; i++) { Node node = list.Get(i); if (base.painter_.IsStretchy(node)) { int w = node.box.Width; try { ((Box_Mo)node.box).updateRowSize(node, rowH, rowB, baseLine_Shift); } catch { } base.rect.width -= w - node.box.Width; if (node.box.Height > base.rect.height) { base.rect.height = node.box.Height; } if (node.box.Baseline > base.rect.baseline) { base.rect.baseline = node.box.Baseline; } } } } } }
public void ConfigHCTREASJson() { try { using (StreamReader r = new StreamReader(@"C:\METROM\hctreasNodes.json")) { string json = r.ReadToEnd(); List <Node> items = JsonConvert.DeserializeObject <List <Node> >(json); foreach (Node n in items) { NodesList.Add(n); } } } catch (Exception e) { MessageBox.Show(e.Message); } }
public void AddNode(int nodenumber) { bool found = false; foreach (Node node in NodesList.Values) { if (node.NodeNumber == nodenumber) { found = true; break; } } if (!found) { Node node = new Node(nodenumber); NodesList.Add(nodenumber, node); } //SetTheConnectionAndStartArray(); }
public void TestMergeInto() { var p = new NodesList <Node>(); p.Add(new Node("1.1.1.1")); p.Add(new Node("1.1.1.1")); p.Add(new Node("1.1.1.2")); p.Add(new Node("1.1.1.4")); var p2 = new NodesList <Node>(); p2.Add(new Node("1.1.1.1")); p2.Add(new Node("1.1.1.1")); p2.Add(new Node("1.1.1.2")); p2.Add(new Node("1.1.1.3")); p.MergeInto(p2); Assert.IsTrue(p.Count == 4); }
/// <summary> /// 清除所有勾选节点 /// </summary> public virtual void ClearAllCheckBoxSelectedNode() { NodesList.BeginUpdate(); foreach (var node in NodesList) { if (node.Node != null && node.Node.Item != null) { (node.Node.Item as UCheckBoxTreeViewItem).IsCheckBoxOn = false; } if (node.Node.Nodes != null && node.Node.Nodes.Count > 0) { for (int i = 0; i < node.Node.Nodes.Count; ++i) { (node.Node.Nodes[i].Item as UCheckBoxTreeViewItem).IsCheckBoxOn = false; } } } NodesList.EndUpdate(); }
/// <summary> /// Removes the node with the specified number from the Graph. /// </summary> /// <param name="nodeNumber">The number of node to remove.</param> /// <exception cref="KeyNotFoundException">node to remove is not in the Graph.</exception> public void RemoveNode(int nodeNumber) // Validated { List <Line> Lines = new List <Line>(); foreach (Line line in LinesList.Values) { if ((line.FirstNode.NodeNumber == nodeNumber) || (line.SecondNode.NodeNumber == nodeNumber)) { //RemoveLine(line.LineName); //line.Deleted = true; Lines.Add(line); } } for (int i = 0; i < Lines.Count; i++) { LinesList.Remove(Lines[i].LineName); } NodesList.Remove(nodeNumber); //SetTheConnectionAndStartArray(); }
/// <summary> /// 处理节点逻辑上的勾选 /// </summary> /// <param name="_nIndex"></param> /// <param name="_bCheck"></param> protected virtual void NodeCBValueChange(int _nIndex, bool _bCheck) { //当前开关按钮的节点 var node = NodesList[_nIndex]; NodesList.BeginUpdate(); //数据上改变 (node.Node.Item as UCheckBoxTreeViewItem).IsCheckBoxOn = _bCheck; //选择父节点时把子节点都选上 //if(node.Node.Nodes != null && node.Node.Nodes.Count > 0) //{ // for (int i = 0; i < node.Node.Nodes.Count; ++i) // { // (node.Node.Nodes[i].Item as UCheckBoxTreeViewItem).IsCheckBoxOn = _bCheck; // } //} //修改父节点的勾选状态 if (node.Node.Parent != null && node.Node.Parent.Item != null) { bool _bParentCheck = _bCheck; { if (_bCheck == false) { for (int i = 0; i < node.Node.Parent.Nodes.Count; ++i) { if (node.Node.Parent.Nodes[i].Item.IsCheckBoxOn == true) { _bParentCheck = true; break; } } } node.Node.Parent.Item.IsCheckBoxOn = _bParentCheck; } } NodesList.EndUpdate(); }
public Node(char letter) { this.Letter = letter; this.Children = new NodesList(); }
public void Prepare() { scenes[0].Prepare(); // Do not export empty arrays if (NodesList.Count > 0) { nodes = NodesList.ToArray(); NodesList.ForEach(node => node.Prepare()); } if (CamerasList.Count > 0) { cameras = CamerasList.ToArray(); } if (BuffersList.Count > 0) { buffers = BuffersList.ToArray(); } if (BufferViewsList.Count > 0) { bufferViews = BufferViewsList.ToArray(); } if (AccessorsList.Count > 0) { accessors = AccessorsList.ToArray(); } if (MeshesList.Count > 0) { meshes = MeshesList.ToArray(); } if (MaterialsList.Count > 0) { materials = MaterialsList.ToArray(); } if (TexturesList.Count > 0) { textures = TexturesList.ToArray(); } if (ImagesList.Count > 0) { images = ImagesList.ToArray(); } if (SamplersList.Count > 0) { samplers = SamplersList.ToArray(); } if (AnimationsList.Count > 0) { var animationsList = new List <GLTFAnimation>(); AnimationsList.ForEach(animation => { animation.Prepare(); // Exclude empty animations if (animation.channels != null) { animationsList.Add(animation); } }); if (animationsList.Count > 0) { animations = animationsList.ToArray(); } } if (SkinsList.Count > 0) { skins = SkinsList.ToArray(); } if (extensionsUsed != null && extensionsUsed.Count == 0) { extensionsUsed = null; } if (extensionsRequired != null && extensionsRequired.Count == 0) { extensionsRequired = null; } }
private void tryAddMathXML(bool isInsert, string xml, bool isPaste) { string s = ""; bool hasS = false; bool ok = false; try { if (this.HasSelection) { xml = xml.Trim(); if ((xml.IndexOf("<math", 0, 5) != -1) && (((xml.IndexOf(" nugenCursor=\"") != -1) || (xml.IndexOf(" nugenCursor='") != -1)) || ((xml.IndexOf(" nugenCursorEnd=\"") != -1) || (xml.IndexOf(" nugenCursorEnd='") != -1)))) { Selection selection = this.CaptureSelection(); if ((selection != null)) { XmlDocument doc = new XmlDocument(); if (this.SaveToXml(doc, selection)) { string outerxml = doc.OuterXml; int startIndex = outerxml.IndexOf("<math"); if (startIndex != -1) { outerxml = outerxml.Substring(startIndex, outerxml.Length - startIndex); outerxml = outerxml.Trim(); if ((outerxml.IndexOf("<math", 0, 5) != -1) && (outerxml.Substring(outerxml.Length - 7, 7) == "</math>")) { s = outerxml; hasS = true; } } } } } } } catch { } if (isInsert) { this.OnInsert(true); } bool emptyRow = false; Node selectedNode = this.GetCurrentlySelectedNode(); if (selectedNode == null) { return; } if (selectedNode.type_ == null) { return; } if (!this.IsEditable()) { return; } NodeClass nodeClass = this.GetNodeClass(selectedNode); selectedNode = this.GetCurrentlySelectedNode(); bool wasSplit = false; selectedNode = this.CarriageReturn(selectedNode, ref wasSplit); if (wasSplit) { this.SelectNode(selectedNode, false); } XmlNode xmlRoot = this.LoadXml(xml, new XmlDocument()); if (xmlRoot == null) { return; } if (!this.IsMultiline) { Node wasSelected = selectedNode; if (this.CreateTopLevelTable()) { nodeClass = this.GetNodeClass(selectedNode); selectedNode = this.GetCurrentlySelectedNode(); } else { return; } } if ((nodeClass == NodeClass.unknown)) { return; } bool wasSelect = false; Node lastRow = null; if (!((xmlRoot == null) || !xmlRoot.HasChildNodes)) { Node selRow = selectedNode; int count = 0; count = xmlRoot.ChildNodes.Count; int rCount = 0; if (((selRow.type_ != null) && (selRow.type_.type == ElementType.Mrow)) && !selRow.HasChildren()) { emptyRow = true; rCount = 1; } if ((((selRow.parent_ != null)) && ((selRow.parent_.type_.maxChilds != -1) && (((selRow.parent_.numChildren - rCount) + count) >= selRow.parent_.type_.maxChilds))) || ((selRow.parent_.type_.type == ElementType.Mmultiscripts) || (selRow.parent_.type_.type == ElementType.Maction))) { selRow = this.WrapInRowInplace(selRow); } if (selRow.IsAppend) { Node row = selRow; Node lastCell = null; if (isPaste && (xmlRoot.Name == "math")) { Node newNode = new Node(); newNode.Parse(xmlRoot, this.types_, this.entityManager, true, null); if ((newNode.type_ != null) && newNode.HasChildren()) { NodesList list = newNode.GetChildrenNodes(); Node n = list.Next(); lastRow = row; for (int i = 0; (row != null) && (n != null); i++) { row.AppendNode(n); lastCell = n; n = list.Next(); row = row.nextSibling; } if (lastCell != null) { if (lastCell.nextSibling != null) { this.SelectNode(lastCell.nextSibling, false); } else { this.SelectNode(lastCell, true); } wasSelect = true; } } } else { for (int i = 0; i < count; i++) { XmlNode x = xmlRoot.ChildNodes[i]; Node n = new Node(); n.Parse(x, this.types_, this.entityManager, false, null); if (n.type_ != null) { row.AppendNode(n); lastCell = n.Parse(x, this.types_, this.entityManager, true, null); if (lastCell != null) { this.SelectNode(lastCell, lastCell.IsAppend); wasSelect = true; ok = true; } else if (i == 0) { lastRow = n; } } row = n; } } } else { Node newSelectedNode = null; if (isPaste && (xmlRoot.Name == "math")) { Node newNode = new Node(); newNode.Parse(xmlRoot, this.types_, this.entityManager, true, null); if ((newNode.type_ != null) && newNode.HasChildren()) { NodesList list = newNode.GetChildrenNodes(); Node n = list.Next(); for (int i = 0; (selRow != null) && (n != null); i++) { selRow.PrependNode(n); n = list.Next(); } this.SelectNode(selRow, false); wasSelect = true; } } else if (xmlRoot.Name == "math") { for (int i = 0; i < count; i++) { XmlNode x = xmlRoot.ChildNodes[i]; Node newMode = new Node(); newMode.Parse(x, this.types_, this.entityManager, false, null); if (newMode.type_ != null) { selRow.PrependNode(newMode); newSelectedNode = newMode.Parse(x, this.types_, this.entityManager, true, null); if (newSelectedNode != null) { this.SelectNode(newSelectedNode, newSelectedNode.IsAppend); ok = true; wasSelect = true; } } } } else { for (int i = 0; i < count; i++) { Node newNode = new Node(); XmlNode x = xmlRoot.ChildNodes[i]; this.InsertFromXml(selRow, x, newNode, ref newSelectedNode, ref wasSelect); } } } if (!wasSelect && (lastRow != null)) { this.SelectNode(lastRow, false); } if (emptyRow) { if (selRow == this.selectedNode) { this.SelectNeighbor(selRow); } this.Tear(selRow); } } if ((!hasS || !ok) || ((this.selectedNode.type_.type != ElementType.Mrow) || (this.selectedNode.numChildren != 0))) { return; } Node lastSelected = null; Node firstSelected = null; Node singleSelected = null; try { Node curPrev = null; Node curNext = null; Node cur = null; cur = this.selectedNode; cur.InternalMark = 0; curPrev = cur.prevSibling; curNext = cur.nextSibling; singleSelected = cur.parent_; Node targetSelected = null; this.tryAddMathXML(false, s, false); try { targetSelected = singleSelected.GetChildrenNodes().Get(this.selectedNode.childIndex); } catch { } if (targetSelected != null) { if ((targetSelected.type_.type == ElementType.Mrow) && (targetSelected.firstChild != null)) { cur = targetSelected; lastSelected = cur.firstChild; firstSelected = cur.lastChild; } else if (((curPrev != null) && !curPrev.tagDeleted) && ((curNext != null) && !curNext.tagDeleted)) { lastSelected = curPrev.nextSibling; firstSelected = curNext.prevSibling; } else if ((curPrev != null) && !curPrev.tagDeleted) { lastSelected = curPrev.nextSibling; firstSelected = singleSelected.lastChild; } else if ((curNext != null) && !curNext.tagDeleted) { lastSelected = singleSelected.firstChild; firstSelected = curNext.prevSibling; } } } catch { } if ((lastSelected != null) && (firstSelected != null)) { this.SelectNode(firstSelected, true); this.multiSelectNode = lastSelected; this.hasSelection = true; } else if (singleSelected != null) { this.SelectNode(singleSelected, false); } }
public void TestCreation() { var p = new NodesList<Node>(); }
public void TestCreation() { var p = new NodesList <Node>(); }