internal PathNode Resolve(Context context, string path) { if( _disposed) { throw new ObjectDisposedException( "MongoDrive" ); } Regex re = new Regex(@"^[-_a-z0-9:]+:/?"); path = path.Replace('\\', '/'); path = re.Replace(path, ""); PathNode factory = new RootNode(context); var nodeMonikers = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries); foreach (var nodeMoniker in nodeMonikers) { factory = factory.Resolve(nodeMoniker); if (null == factory) { break; } } return factory; }
public void TestAddComponent() { RootNode node = new RootNode(); GeneratedApplicationNode.Nodes.Add(node); node.Nodes.Add(new ChildNode()); Assert.AreEqual(3, Container.Components.Count); }
public ParentNodeWrapper(RootNode rootNode, IParentNodeImplementor node, IParentNode parent) : base(rootNode, node) { _contextRoot = this; _parentNode = node; _parent = parent; }
private ParentNodeWrapper(RootNode rootNode, IParentNode contextRoot, IParentNodeImplementor node, IParentNode parent) : base(rootNode, node) { _contextRoot = contextRoot; _parentNode = node; _parent = parent; }
public RootNode Parse() { //GO RootNode root = new RootNode(); //here is the root node while(tokens.CurrentToken != TokenType.EOF) ParseDeclaration(root); return root; }
public Canvas(Context context) : base(context) { root = new RootNode (); root.ChildAdded += (sender, e) => AddChild (sender as Node); root.ChildRemoved += (sender, e) => RemoveChild (sender as Node); root.Canvas = this; AddChild (root); }
public Canvas() { Motion.Tweener.Sync = this; root = new RootNode (); root.ChildAdded += (o, e) => AddChild (o as Node); root.ChildRemoved += (o, e) => RemoveChild (o as Node); root.Canvas = this; AddChild (root); }
private void SetupRootNodes() { var rootNode = new RootNode(); var dataXml = XmlNode.Parse("<data><note desc=\"1\" body=\"One!\"/><note desc=\"2\" body=\"Two?\"/></data>"); var template = XDocument.Load(@"..\..\templates\noteviewer.xml"); var templateXml = XmlNode.Parse(template.ToString()); rootNode.Register<IParentNodeImplementor>(new AggregateNode(dataXml, templateXml)); dataNode = rootNode.Nodes("data").First(); templateNode = rootNode.Nodes().Skip(1).First(); }
public IList<AssemblyNode> CreateNodesFromAssemblies(List<CciModuleSource> modules, ICodePartsMatcher constraints) { var matcher = constraints.Join(new ProperlyNamedMatcher()); List<AssemblyNode> assemblyNodes = modules.Select(m => CreateAssemblyNode(m.Module, matcher)).ToList(); var root = new RootNode(); root.Children.AddRange(assemblyNodes); root.IsIncluded = true; return assemblyNodes; }
public IList<AssemblyNode> CreateNodesFromAssemblies(IModuleSource modules, CciMethodMatcher constraints) { List<AssemblyNode> assemblyNodes = modules.Modules.Select(m => CreateAssemblyNode(m, constraints)).ToList(); var root = new RootNode(); root.Children.AddRange(assemblyNodes); root.IsIncluded = true; return assemblyNodes; }
public Canvas() { root = new RootNode (); renderers = new List<object> (); uisync = new UISyncInvoke (); Motion.Tweener.Sync = uisync; testButton = new NSButton (new System.Drawing.RectangleF (100, 100, 100, 50)); testButton.BezelStyle = NSBezelStyle.Rounded; testButton.FrameCenterRotation = 40; AddSubview (testButton); }
public Canvas() { Motion.Tweener.Sync = new GlibSyncInvoke (); AppPaintable = true; VisibleWindow = false; CanFocus = true; engine = new Cairo.Engine (() => Gdk.CairoHelper.Create (GdkWindow), () => PangoContext); root = new RootNode (); root.Canvas = this; AddEvents ((int)(Gdk.EventMask.AllEventsMask)); root.RedrawNeeded += (object sender, EventArgs e) => { QueueDraw (); }; }
public object InitializeController(IContainer container) { _xpath = new XPathDecoder(); var rootNode = new RootNode(); var template = XDocument.Load(@"..\..\templates\noteviewer.xml"); if (template.Root == null) throw new Exception("Invalid xml document"); var xmlNode = XmlNode.Parse("<data><note desc=\"1\" body=\"One!\"/><note desc=\"2\" body=\"Two?\"/></data>"); //TODO: This needs to be generated dynamically somehow var storageNode = XmlNode.Parse("<dynamicData><rowSelector/><textOutput/></dynamicData>"); var templateNode = XmlNode.Parse(template.ToString()); rootNode.Register<IParentNodeImplementor>(new AggregateNode(xmlNode, storageNode, templateNode)); var dataRoot = rootNode.Nodes("data").First(); var dynamicData = rootNode.Nodes("dynamicData").First(); var uiRoot = rootNode.Nodes().Skip(2).First(); //bug: here it is... this needs to be implemented. Will want to switch EndNodeWrapper to derive from NodeBase to fix // ProcessTemplateElem(dataRoot, uiRoot); // var fnGetDesc = _xpath.GetPathFunc<IAccessor<string>>("@descr"); // var fnGetText = _xpath.GetPathFunc<IAccessor<string>>("@body"); Func<IParentNode, IAccessor<string>> fnGetDesc = node => node.Attribute("desc").Get<IAccessor<string>>(); Func<IParentNode, IAccessor<string>> fnGetText = node => node.Attribute("body").Get<IAccessor<string>>(); var fnGetNotes = _xpath.GetPathFunc<IEnumerable<IParentNode>>("//note"); EntityList entityList; BuildNoteList(dataRoot, fnGetNotes, fnGetDesc, container, out entityList); var textDisplay = BuildTextDisplay(dynamicData, container); var _entityListController = BuildEntitySelector(dataRoot, fnGetText, rootNode, dynamicData); Initialize((IUIInitialize)textDisplay, entityList); //TODO: 3. Enforce the constraint that new objects go through a factory where the INode is known at creation time, and a proxy is returned //This will eliminate a lot of the difficulty I've been having figuring out what to do when I new objects //TODO: $$ Overall this is pretty awesome, but it can't respond to changes to the IAccessor<string>, only to the column list of the IEntityRow return _entityListController; }
private static EntityListController BuildEntitySelector(INode rootNode, Func<IParentNode, IAccessor<string>> fnGetText, RootNode actualRootNode, IParentNode dynamicData) { var entityList = rootNode.Get<IEntityList<IUIEntityRow>>(); var selector = new EntitySelector {Rows = entityList.Rows, SelectedRow = entityList.Rows.First()}; var rowSelector = dynamicData.Nodes("rowSelector").First(); rowSelector.Register(selector); var textOutput = dynamicData.Nodes("textOutput").First().Get<IAccessor<string>>(); var nodeMessage = new NodeMessage { Target = textOutput, MessagePredicate = (message => message.Method.Name == "set_SelectedRow"), TargetDelegate = (Func<IInvocation, Action<IAccessor<string>>>) (row => accessor => accessor.Value = fnGetText(((IEntityRow)row.Arguments.First()).Context).Value) //TODO: 1. This seems a little complicated... //Somebody, or something in the xml needs to clue the framework in to how to do this wiring. }; actualRootNode.InstallHook(nodeMessage); var _entityListController = new EntityListController {EntityList = rowSelector.Get<IEntitySelector>()}; _entityListController.Beginning(); return _entityListController; }
public void EqualsShouldReturnFalseWhenComparingRootNodeWithRootNodeOfDifferentId() { var lhs = new RootNode(123); var rhs = new RootNode(456); Assert.IsFalse(lhs == rhs); }
private static void ProcessLinks(List <InvestigationLink> linksToBeInvestigated, RootNode rootNode, bool includeExternalReferences) { while (linksToBeInvestigated.Any()) { var item = linksToBeInvestigated[0]; linksToBeInvestigated.RemoveAt(0); var link = new ProjectLinkObject { FullPath = item.FullPath }; var projectDetail = new ProjectFileManager().Create(link, includeExternalReferences); if (item.Parent != null) { projectDetail.ParentProjects.Add(item.Parent); } link.Id = projectDetail.Id; //get all child links and create link investigations for them linksToBeInvestigated.AddRange(projectDetail.ChildProjects.Select(p => new InvestigationLink { FullPath = p.FullPath, Parent = link }).ToList()); rootNode.ProjectDetails.Add(projectDetail); } }
public void HandleEvents() { Event e = Event.current; switch (e.type) { case EventType.MouseDown: GUI.FocusControl(""); mMousePos = e.mousePosition; if (!BTEditorWindow.windowRect.Contains(mMousePos)) { BTEditorWindow.Instance.CloseSubWin(); } if (BTEditorWindow.windowRect.Contains(mMousePos) && BTEditorWindow.IsShowSubWin) { break; } //单击选中 if (e.button == 0) { CheckMouseInNode(); } //双击折叠 if (e.button == 0 && e.clickCount == 2 && mState != State.ConnectLeft && mState != State.ConnectRight) { mSelectedNode?.Fold(); CalcGraphRect(); } //右键 if (e.button == 1) { //取消选中 mSelectedNode?.onSelect(false); mSelectedNode = null; //重新选中 CheckMouseInNode(); //右键菜单 PopMenu(); } if (e.button == 0 && e.mousePosition.x < mLeftWidth + 30 && e.mousePosition.x > mLeftWidth) { mDragingLeftBorder = true; } if (e.button == 0 && e.mousePosition.x < mLeftWidth + mBorderRect.width && e.mousePosition.x > mLeftWidth + mBorderRect.width - 30) { mDragingRightBorder = true; } break; case EventType.MouseUp: if (BTEditorWindow.windowRect.Contains(mMousePos) && BTEditorWindow.IsShowSubWin) { break; } if (e.button == 0 && e.shift) { mSelectedNode.Offset = mSrcOffset; mSelectedNode.Parent.AutoSort(); CheckMouseInNode(); } if (e.button == 0) { CheckMouseInNode(); } mState = State.Normal; mDragingLeftBorder = false; mDragingRightBorder = false; break; case EventType.MouseDrag: //中键 if (e.button == 2 || (e.button == 0 && e.alt)) { mScrollPosition.x -= e.delta.x; mScrollPosition.y -= e.delta.y; mState = State.Normal; return; } if (e.button == 0 && e.shift) { if (mSelectedNode != null) { mSrcOffset = mSelectedNode.Offset; mSelectedNode.onDrag(e.delta); mState = State.Shift; } return; } if (e.button == 0 && e.control) { if (mSelectedNode != null) { mSrcOffset = mSelectedNode.Offset; mSelectedNode.onDrag(e.delta); mState = State.Ctrl; } return; } if (mDragingLeftBorder) { mLeftWidth += e.delta.x; return; } if (mDragingRightBorder) { mRightWidth -= e.delta.x; BTEditor.Instance.GetComponent <EventComponent>().Run(EventIdType.BehaviorTreeRightDesignerDrag, e.delta.x); return; } //左键 if (e.button == 0 && (e.control || !mLock)) { if (mSelectedNode != null) { mSelectedNode.onDrag(e.delta); mState = State.Drag; DrawMouseIcon("DragIcon"); } } break; case EventType.KeyUp: //F1自动排序 if (e.keyCode == KeyCode.F1) { RootNode?.AutoSort(); RootNode.UpdateChildren(); } if (e.keyCode == KeyCode.F2) { mLock = !mLock; if (mLock) { BehaviorTreeTipsHelper.ShowMessage("节点位置已锁定"); } else { BehaviorTreeTipsHelper.ShowMessage("节点位置已解锁"); } } if (e.keyCode == KeyCode.Delete) { RemoveNode(); } break; case EventType.MouseMove: DrawMouseIcon("DragIcon2"); break; } }
public Node(string path, RootNode root) { Root = root; Path = path; }
public DefaultWM(Rete engine, RootNode node, IRuleCompiler compiler) { InitBlock(); this.engine = engine; root = node; this.compiler = compiler; this.compiler.WorkingMemory = this; agenda = new Agenda(engine); init(); }
private void InitBlock() { defclass = CollectionFactory.localMap(); templateToDefclass = CollectionFactory.localMap(); functions = CollectionFactory.localMap(); outputStreams = CollectionFactory.localMap(); listeners = new List<Object>(); functionGroups = new List<Object>(); //log = new Log4netLogger(typeof (Rete)); router = new MessageRouter(this); initFact = new InitialFact(); deffunctions = new DeffunctionGroup(); root = new RootNode(); rulesFired = CollectionFactory.localMap(); }
void Add(RootNode rootNode) { window.Hide(); rootNode.RootNodes = app.RootNodes; app.RootNodes.Configuration.Roots.Add(rootNode); }
public void SaveXML(string fileName) { RootNode.Save(fileName); }
public void TestNodeContent() { var root = new RootNode("Root"); Assert.AreEqual("Root", root.GetContent()); }
public void Visit(RootNode node) { node.Expression.Accept(this); node.Accept(_visitor); }
/// <summary> /// Constructor /// </summary> public VMPscHighAvailabilitySnapIn() { RootNode = new RootNode { DisplayName = Constants.RootNodeDisplayName }; }
public override void SetUp() { base.SetUp(); rootNode = new RootNode(); GeneratedApplicationNode.Nodes.Add(rootNode); }
public double App(string inp) { string[] elements = GetElements(inp); Node current, currentRoot, newNode; Stack <Node> roots = new Stack <Node>(); char prevOperator = '+'; current = new RootNode(); currentRoot = current; roots.Push(currentRoot); for (int i = 0; i < elements.Length; i++)//"(2 / (2 + 3.33) * 4) - -6" { if (Operators.ContainsKey(elements[i])) { newNode = new OperatorNode { Operator = elements[i] }; if (elements[i].Last() == 'u') { current.AddOperand(newNode); } else { if (IsHigher(elements[i].First(), prevOperator)) { newNode.InsertAbowe(current); } else { newNode.InsertBelowAsFirstOperand(currentRoot); } prevOperator = elements[i][0]; } current = newNode; } else if (char.IsDigit(elements[i].First())) { newNode = new ValueNode { Value = double.Parse(elements[i]) }; current.AddOperand(newNode); current = newNode; } else { if (elements[i][0] == '(') { newNode = new RootNode(); current.AddOperand(newNode); current = newNode; roots.Push(current); currentRoot = roots.Peek(); } else if (elements[i][0] == ')') { prevOperator = '*'; roots.Pop(); currentRoot = roots.Peek(); current = currentRoot; } } } TestContext.Out.Write(currentRoot.GetString()); return(currentRoot.CalculateValue()); }
public OpenApiDocument LoadDocument(RootNode rootNode) { return(OpenApiV2Deserializer.LoadOpenApi(rootNode)); }
/// <summary> /// Devuelve la información contenida en el grupo "\info" del documento RTF. /// </summary> /// <returns>Objeto InfoGroup con la información del grupo "\info" del documento RTF.</returns> public InfoGroup GetInfoGroup() { InfoGroup info = null; RtfTreeNode infoNode = RootNode.SelectSingleNode("info"); //Si existe el nodo "\info" exraemos toda la información. if (infoNode != null) { RtfTreeNode auxnode = null; info = new InfoGroup(); //Title if ((auxnode = rootNode.SelectSingleNode("title")) != null) { info.Title = auxnode.NextSibling.NodeKey; } //Subject if ((auxnode = rootNode.SelectSingleNode("subject")) != null) { info.Subject = auxnode.NextSibling.NodeKey; } //Author if ((auxnode = rootNode.SelectSingleNode("author")) != null) { info.Author = auxnode.NextSibling.NodeKey; } //Manager if ((auxnode = rootNode.SelectSingleNode("manager")) != null) { info.Manager = auxnode.NextSibling.NodeKey; } //Company if ((auxnode = rootNode.SelectSingleNode("company")) != null) { info.Company = auxnode.NextSibling.NodeKey; } //Operator if ((auxnode = rootNode.SelectSingleNode("operator")) != null) { info.Operator = auxnode.NextSibling.NodeKey; } //Category if ((auxnode = rootNode.SelectSingleNode("category")) != null) { info.Category = auxnode.NextSibling.NodeKey; } //Keywords if ((auxnode = rootNode.SelectSingleNode("keywords")) != null) { info.Keywords = auxnode.NextSibling.NodeKey; } //Comments if ((auxnode = rootNode.SelectSingleNode("comment")) != null) { info.Comment = auxnode.NextSibling.NodeKey; } //Document comments if ((auxnode = rootNode.SelectSingleNode("doccomm")) != null) { info.DocComment = auxnode.NextSibling.NodeKey; } //Hlinkbase (The base address that is used for the path of all relative hyperlinks inserted in the document) if ((auxnode = rootNode.SelectSingleNode("hlinkbase")) != null) { info.HlinkBase = auxnode.NextSibling.NodeKey; } //Version if ((auxnode = rootNode.SelectSingleNode("version")) != null) { info.Version = auxnode.Parameter; } //Internal Version if ((auxnode = rootNode.SelectSingleNode("vern")) != null) { info.InternalVersion = auxnode.Parameter; } //Editing Time if ((auxnode = rootNode.SelectSingleNode("edmins")) != null) { info.EditingTime = auxnode.Parameter; } //Number of Pages if ((auxnode = rootNode.SelectSingleNode("nofpages")) != null) { info.NumberOfPages = auxnode.Parameter; } //Number of Chars if ((auxnode = rootNode.SelectSingleNode("nofchars")) != null) { info.NumberOfChars = auxnode.Parameter; } //Number of Words if ((auxnode = rootNode.SelectSingleNode("nofwords")) != null) { info.NumberOfWords = auxnode.Parameter; } //Id if ((auxnode = rootNode.SelectSingleNode("id")) != null) { info.Id = auxnode.Parameter; } //Creation DateTime if ((auxnode = rootNode.SelectSingleNode("creatim")) != null) { info.CreationTime = parseDateTime(auxnode.ParentNode); } //Revision DateTime if ((auxnode = rootNode.SelectSingleNode("revtim")) != null) { info.RevisionTime = parseDateTime(auxnode.ParentNode); } //Last Print Time if ((auxnode = rootNode.SelectSingleNode("printim")) != null) { info.LastPrintTime = parseDateTime(auxnode.ParentNode); } //Backup Time if ((auxnode = rootNode.SelectSingleNode("buptim")) != null) { info.BackupTime = parseDateTime(auxnode.ParentNode); } } return(info); }
protected override void Context() { _view = A.Fake <IBuildingBlockExplorerView>(); A.CallTo(() => _view.TreeView).Returns(A.Fake <IUxTreeView>()); _regionResolver = A.Fake <IRegionResolver>(); _region = A.Fake <IRegion>(); A.CallTo(() => _regionResolver.RegionWithName(RegionNames.BuildingBlockExplorer)).Returns(_region); _project = new PKSimProject(); var compound = new Compound().WithName("compound"); _individual = new Individual().WithName("individual"); _individual.OriginData = new OriginData { Species = new Species() }; _project.AddBuildingBlock(_individual); _project.AddBuildingBlock(compound); _observedDataInExplorerPresenter = A.Fake <IObservedDataInExplorerPresenter>(); _buildingBlockIconRetriever = A.Fake <IBuildingBlockIconRetriever>(); _treeNodeFactory = A.Fake <ITreeNodeFactory>(); _contextMenuFactory = A.Fake <ITreeNodeContextMenuFactory>(); _buildingBlockTask = A.Fake <IBuildingBlockTask>(); _toolTipCreator = A.Fake <IToolTipPartCreator>(); _projectRetriever = A.Fake <IProjectRetriever>(); _classificationPresenter = A.Fake <IClassificationPresenter>(); _multipleTreeNodeContextMenuFactory = A.Fake <IMultipleTreeNodeContextMenuFactory>(); sut = new BuildingBlockExplorerPresenter(_view, _treeNodeFactory, _contextMenuFactory, _multipleTreeNodeContextMenuFactory, _buildingBlockIconRetriever, _regionResolver, _buildingBlockTask, _toolTipCreator, _projectRetriever, _classificationPresenter, _observedDataInExplorerPresenter); _compoundFolderNode = new RootNode(PKSimRootNodeTypes.CompoundFolder); _individualFolderNode = new RootNode(PKSimRootNodeTypes.IndividualFolder); _formulationFolderNode = new RootNode(PKSimRootNodeTypes.FormulationFolder); _protocolFolderNode = new RootNode(PKSimRootNodeTypes.ProtocolFolder); _observersFolderNode = new RootNode(PKSimRootNodeTypes.ObserversFolder); _populationFolderNode = new RootNode(PKSimRootNodeTypes.PopulationFolder); _eventRootNode = new RootNode(PKSimRootNodeTypes.EventFolder); _simulationNode = new SimulationNode(new ClassifiableSimulation { Subject = new IndividualSimulation { Id = "1" } }); _compoundNode = new ObjectWithIdAndNameNode <Compound>(compound); _individualNode = new ObjectWithIdAndNameNode <Individual>(_individual); _observationRootNode = new RootNode(RootNodeTypes.ObservedDataFolder); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.CompoundFolder)).Returns(_compoundFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.IndividualFolder)).Returns(_individualFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.ProtocolFolder)).Returns(_protocolFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.ObserversFolder)).Returns(_observersFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.FormulationFolder)).Returns(_formulationFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.PopulationFolder)).Returns(_populationFolderNode); A.CallTo(() => _treeNodeFactory.CreateFor(RootNodeTypes.ObservedDataFolder)).Returns(_observationRootNode); A.CallTo(() => _treeNodeFactory.CreateFor(PKSimRootNodeTypes.EventFolder)).Returns(_eventRootNode); A.CallTo(() => _treeNodeFactory.CreateFor(_individual)).Returns(_individualNode); A.CallTo(() => _treeNodeFactory.CreateFor(compound)).Returns(_compoundNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.CompoundFolder.Id)).Returns(_compoundFolderNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.IndividualFolder.Id)).Returns(_individualFolderNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.ProtocolFolder.Id)).Returns(_protocolFolderNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.ObserversFolder.Id)).Returns(_observersFolderNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.FormulationFolder.Id)).Returns(_formulationFolderNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.PopulationFolder.Id)).Returns(_populationFolderNode); A.CallTo(() => _view.TreeView.NodeById(RootNodeTypes.ObservedDataFolder.Id)).Returns(_observationRootNode); A.CallTo(() => _view.TreeView.NodeById(PKSimRootNodeTypes.EventFolder.Id)).Returns(_eventRootNode); A.CallTo(() => _view.AddNode(A <ITreeNode> ._)).ReturnsLazily(s => s.Arguments[0].DowncastTo <ITreeNode>()); }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="rootNode">Root node.</param> /// <param name="parent">Parent.</param> public RootNodeViewModel(ViewModelStore viewModelStore, RootNode rootNode, ModelTreeViewModel parent) : base(viewModelStore, rootNode, null) { this.parentVM = parent; }
public AbstractSyntaxTree(RootNode root) { Root = root; }
private static void ProcessSlnRootNode(RootNode rootNode, bool includeExternalReferences) { var projectLinks = new SolutionFileManager().FindAllProjectLinks(rootNode); ProcessLinks(projectLinks, rootNode, includeExternalReferences); }
internal static NodeInfo Create(RootNode node) { return(new NodeInfo(NodeType.Root, string.Empty)); }
/// <summary> /// Constructs a new instance of the <see cref="StudyBuilder"/> using the default options. /// </summary> public StudyBuilder() { _patients = new PatientNodeCollection(this); _rootNode = new RootNode(); }
private void AssignRootFolder() { var root = new RootNode(_rootFolder); _rootFolder.Parent = root; _foldersTree.Nodes = root; _foldersTree.ActiveNode = _rootFolder; }
public void AddFitFunctionList(string rootname, Altaxo.Main.Services.IFitFunctionInformation[] entries, FitFunctionContextMenuStyle menustyle) { // The key of the entries is the FitFunctionAttribute, the value is the type of the fitting function this._twFitFunctions.BeginUpdate(); RootNode rnode = new RootNode(rootname, RootNodeType.Builtin); this._twFitFunctions.Nodes.Add(rnode); TreeNodeCollection root = rnode.Nodes; foreach (Altaxo.Main.Services.IFitFunctionInformation entry in entries) { string[] path = entry.Category.Split(new char[]{'\\','/'}); TreeNodeCollection where = root; for(int j=0;j<path.Length;j++) { TreeNode node = GetPathNode(where,path[j]); if(node==null) { node = new CategoryNode(path[j]); where.Add(node); } where = node.Nodes; } BuiltinLeafNode leaf = new BuiltinLeafNode(entry.Name,entry); switch (menustyle) { case FitFunctionContextMenuStyle.None: break; case FitFunctionContextMenuStyle.EditAndDelete: leaf.ContextMenu = _userFileLeafNodeContextMenu; break; case FitFunctionContextMenuStyle.Edit: leaf.ContextMenu = _appFileLeafNodeContextMenu; break; } where.Add(leaf); } this._twFitFunctions.EndUpdate(); }
/// <summary> /// Adds a new RootNode view model for the given RootNode. /// </summary> /// <param name="element">RootNode.</param> public void AddRootNode(RootNode element) { foreach (RootNodeViewModel viewModel in this.rootNodeVMs) if (viewModel.RootNode.Id == element.Id) return; RootNodeViewModel vm = new RootNodeViewModel(this.ViewModelStore, element, this); this.rootNodeVMs.Add(vm); foreach (RootNodeViewModel vmS in this.rootNodeVMs) vmS.UpdateNodePosition(); }
/// <summary> /// コンストラクタ /// </summary> private VideoData(string videoId, XmlNode node) : base(node, "nicovideo_thumb_response", videoId) { TagList = new List <string>(); StartTime = DateTime.MinValue; ViewCounter = -1; CommentCounter = -1; MylistCounter = -1; IsVisible = true; Timestamp = Time; var root = RootNode.SelectSingleNode("thumb"); if (root == null) { throw new NicoException( "XMLがパースできません。", videoId); } foreach (var childObj in root.ChildNodes) { var child = (XmlNode)childObj; var text = child.InnerText; switch (child.Name) { case "video_id": this.IdString = text; break; case "title": this.Title = text; break; case "description": this.Description = text; break; case "thumbnail_url": this.ThumbnailUrl = text; break; case "first_retrieve": this.StartTime = DateTime.Parse(text); break; case "length": var values = text.Split(':'); this.Length = new TimeSpan( 0, int.Parse(values[0]), int.Parse(values[1])); break; case "view_counter": this.ViewCounter = StrUtil.ToInt(text, 0); break; case "comment_num": this.CommentCounter = StrUtil.ToInt(text, 0); break; case "mylist_counter": this.MylistCounter = StrUtil.ToInt(text, 0); break; case "tags": this.TagList = child.ChildNodes .OfType <XmlNode>() .Where(_ => _.Name == "tag") .Select(_ => _.InnerText) .ToList(); break; } } }
public void AutoSort() { RootNode?.AutoSort(); }
public void Visit(RootNode node) { }
protected override void LoadContent() { Window.Title = "Different Lights Sample"; Type sp = typeof(Spatial); Type me = typeof(Mesh); bool ishash = sp.GetHashCode() == sp.GetHashCode(); bool ishash2 = sp.GetHashCode() == me.GetHashCode(); bool iseq = sp.Equals(sp); pl = new PointLight(); pl.Specular = Color.DarkGray; //Cut down on the specular so we don't get blinded sl = new SpotLight(); //Spot light angles - inner angle is where the light is most intense. The intensity smoothly //fades from this angle to the outer angle, so we don't have an abrupt cutoff. Essentially spot lights //are similar to point lights, except for this restricting cone. sl.OuterAngle = 45; sl.InnerAngle = 20; sl.Direction = new Vector3(-.577f, -.577f, -.577f); //Simple directional light - simulates a light source infinitely away like the Sun. dl = new DirectionalLight(); dl.Direction = new Vector3(-.577f, -.577f, -.577f); activeLight = pl; //Create an inverted cube Box b = new Box("InsideOut", Vector3.Zero, 100, 100, 100, true); b.Material = ContentManager.Load <Material>("LitBasicColor.tem"); b.RenderBucketType = RenderBucketType.Skip; //These are object material properties (built-in shaders also include Emissive, shininess factor, and an alpha factor) b.Material.SetParameter("MatDiffuse", Color.Crimson.ToVector3()); b.Material.SetParameter("MatAmbient", new Color(.4f, .2f, .2f).ToVector3()); b.Material.SetParameter("MatSpecular", new Color(.3f, .3f, .3f).ToVector3()); b.SetModelBound(new BoundingBox()); RootNode.AddChild(b); RootNode.RemoveAllLights(); RootNode.AddLight(activeLight); text = "Active Light: Point"; //Input response to set the active light InputLayer.RegisterTrigger(new InputTrigger(new KeyPressedCondition(Keys.D1, false), new InputAction( delegate(GameTime time) { activeLight = pl; RootNode.RemoveAllLights(); RootNode.AddLight(activeLight); text = "Active Light: Point"; } ))); InputLayer.RegisterTrigger(new InputTrigger(new KeyPressedCondition(Keys.D2, false), new InputAction( delegate(GameTime time) { activeLight = sl; RootNode.RemoveAllLights(); RootNode.AddLight(activeLight); text = "Active Light: Spot"; } ))); InputLayer.RegisterTrigger(new InputTrigger(new KeyPressedCondition(Keys.D3, false), new InputAction( delegate(GameTime time) { activeLight = dl; RootNode.RemoveAllLights(); RootNode.AddLight(activeLight); text = "Active Light: Directional"; } ))); //Set up some text rendering batch = new SpriteBatch(); font = ContentManager.Load <SpriteFont>("Fonts//comicsans.fnt"); }
internal static NodeInfo Create(RootNode node) { return new NodeInfo(NodeType.Root, string.Empty); }
private void InitializeTree(Control control) { IList itemsToShow = new RootNode {control}; foreach (var o in PropertyObjects) { itemsToShow.Add(o); } treeView1.ImageList = new ImageList { ColorDepth = ColorDepth.Depth32Bit }; treeView1.ImageList.Images.Add("Control", Resources.Control); treeView1.ImageList.Images.Add("Data", Resources.Data); AddAllNodes(treeView1.Nodes, itemsToShow); treeView1.NodeMouseClick += delegate { propertyGrid1.SelectedObject = treeView1.SelectedNode.Tag; }; }
/// <summary> /// Deletes a new RootNode view model for the given RootNode. /// </summary> /// <param name="element">ModelContext.</param> public void DeleteRootNode(RootNode element) { for (int i = this.rootNodeVMs.Count - 1; i >= 0; i--) if (this.rootNodeVMs[i].RootNode.Id == element.Id) { this.rootNodeVMs[i].Dispose(); this.rootNodeVMs.RemoveAt(i); } foreach (RootNodeViewModel vm in this.rootNodeVMs) vm.UpdateNodePosition(); }
public override void SetUp() { base.SetUp(); CopyFilesRecursively(new DirectoryInfo(backupPath), new DirectoryInfo(basePath)); operations = new List<string>(); arguments = new List<FileEventArgs>(); root = engine.Resolve<ContentActivator>().CreateInstance<RootNode>(null); engine.Persister.Save(root); engine.Resolve<IHost>().DefaultSite.RootItemID = root.ID; engine.Resolve<IHost>().DefaultSite.StartPageID = root.ID; upload = engine.Resolve<ContentActivator>().CreateInstance<RootDirectory>(root); upload.Title = "Upload"; upload.Name = "Upload"; engine.Persister.Save(upload); }
public void EqualsShouldReturnTrueWhenComparingRootNodeWithRootNodeOfSameId() { var lhs = new RootNode(123); var rhs = new RootNode(123); Assert.IsTrue(lhs == rhs); }
public List() { Head = Tail = new RootNode(); }
protected override void LoadContent() { Window.Title = "Input Handling Sample"; rotateSpeed = 2.5f; speed = 105.0f; Renderer.CurrentCamera.Position = new Vector3(0, 800, 100); Renderer.CurrentCamera.LookAt(Vector3.Zero, Vector3.Up); Renderer.CurrentCamera.Update(); //Load our fancy pants racecar ModelLoaderParameters mlp = new ModelLoaderParameters(); mlp.SwapWindingOrder = true; mlp.NormalGeneration = NormalGeneration.Crease; mlp.PreferLitMaterials = true; Spatial car = ContentManager.Load <Spatial>("Models//Jeep.dxs", mlp); car.SetModelBound(new BoundingBox()); RootNode.AddChild(car); //Create an input layer, this layer will hold all of our controls and input response to the arrow keys, moving the car input = new InputLayer(); //Input layers can be disabled or enabled, so you're able to logically group your inputs together and treat them as one unit. //E.g. if you have a screen menu and want the mouse enabled, but for gameplay do not want the mouse enabled. //Rather than disabling the whole layer, we'll just disable the first 5 triggers - which are the //FPS controls set in BasicApp. InputLayer.EnableTrigger(0, false); InputLayer.EnableTrigger(1, false); InputLayer.EnableTrigger(2, false); InputLayer.EnableTrigger(3, false); InputLayer.EnableTrigger(4, false); //Since we disabled the basicApp's input alyer, lets make sure we can get out of the app input.RegisterTrigger(new InputTrigger(new KeyPressedCondition(Keys.Escape, false), new InputAction(delegate(GameTime time) { Exit(); }))); input.RegisterTrigger(new InputTrigger(new KeyPressedCondition(Keys.A, true), new InputAction( delegate(GameTime time) { car.Rotation *= Quaternion.FromAngleAxis(rotateSpeed * (float)time.ElapsedTimeInSeconds, Vector3.Up); } ))); input.RegisterTrigger(new InputTrigger(new KeyPressedCondition(Keys.D, true), new InputAction( delegate(GameTime time) { car.Rotation *= Quaternion.FromAngleAxis(-rotateSpeed * (float)time.ElapsedTimeInSeconds, Vector3.Up); } ))); input.RegisterTrigger(new InputTrigger(new KeyPressedCondition(Keys.W, true), new InputAction( delegate(GameTime time) { //Usually a good idea to use the world properties, since this may be attached to a node that is moving also car.Translation -= car.WorldTransform.GetRotationVector(2) * speed * (float)time.ElapsedTimeInSeconds; } ))); input.RegisterTrigger(new InputTrigger(new KeyPressedCondition(Keys.S, true), new InputAction( delegate(GameTime time) { car.Translation += car.WorldTransform.GetRotationVector(2) * speed * (float)time.ElapsedTimeInSeconds; } ))); //Add another point light to the scene PointLight pl = new PointLight(); pl.Attenuate = false; pl.Position = new Vector3(0, 0, 50); car.AddLight(pl); }
public virtual void Visit(RootNode node) { Nodes.Push(new RootNode(Nodes.Pop())); }
public void GenerateCode(RootNode node) { node.GenerateCode(this); }
private RemoveResult Delete <T>(NodePin thisLock, TKey key, ref T condition, NodePin parent, int parentIx) where T : IRemoveValue <TKey, TValue> { Node me = thisLock.Ptr; if (me.Count == 0) { return(RemoveResult.NotFound); } int minimumKeys = me.IsLeaf ? _options.MinimumValueNodes : _options.MinimumChildNodes; if (me.Count <= minimumKeys && parent != null && !parent.Ptr.IsRoot) { if (parentIx < parent.Ptr.Count - 1) { using (NodePin bigger = _storage.Lock(parent, parent.Ptr[parentIx + 1].ChildNode)) Join(thisLock, bigger, false, parent, parentIx); thisLock.Dispose(); return(Delete(parent, key, ref condition, null, int.MinValue)); } if (parentIx > 0) { using (NodePin smaller = _storage.Lock(parent, parent.Ptr[parentIx - 1].ChildNode)) Join(smaller, thisLock, true, parent, parentIx - 1); thisLock.Dispose(); return(Delete(parent, key, ref condition, null, int.MinValue)); } Assert(false, "Failed to join node before delete."); } else if (parent != null && parent.Ptr.IsRoot && me.Count == 1 && !me.IsLeaf) { using (NodePin onlyChild = _storage.Lock(thisLock, me[0].ChildNode)) { using (NodeTransaction t = _storage.BeginTransaction()) { RootNode rootNode = (RootNode)t.BeginUpdate(parent); rootNode.ReplaceChild(0, thisLock.Handle, onlyChild.Handle); t.Destroy(thisLock); t.Commit(); } return(Delete(onlyChild, key, ref condition, null, int.MinValue)); } } if (parent != null) { parent.Dispose();//done with the parent lock. } bool isValueNode = me.IsLeaf; int ordinal; if (me.BinarySearch(_itemComparer, new Element(key), out ordinal) && isValueNode) { if (condition.RemoveValue(key, me[ordinal].Payload)) { using (NodeTransaction t = _storage.BeginTransaction()) { me = t.BeginUpdate(thisLock); me.Remove(ordinal, new Element(key), _keyComparer); t.RemoveValue(key); t.Commit(); return(RemoveResult.Removed); } } return(RemoveResult.Ignored); } if (isValueNode) { return(RemoveResult.NotFound); } if (ordinal >= me.Count) { ordinal = me.Count - 1; } using (NodePin child = _storage.Lock(thisLock, me[ordinal].ChildNode)) return(Delete(child, key, ref condition, thisLock, ordinal)); }
public void Visit(RootNode node, INode parentNode) { }
public void Visit(RootNode node) { RootScript = new RootNode(Nodes.Pop()); }
public void Initialize(XmlDocument xdoc) { nodeList = new Dictionary<string, NodeDef>(); controllerToNodeDefMap = new Dictionary<ControllerInfo, NodeDef>(); nameToNodeDefMap = new Dictionary<string, NodeDef>(); // LabelEdit = true; ImageList = new ImageList(); Clifton.MycroParser.MycroParser mp = new Clifton.MycroParser.MycroParser(); mp.Load(xdoc, null, null); // Type t = typeof(RootNode); // string qname = t.AssemblyQualifiedName; // TODO: Fix this by getting the correct qname (minus the ".RootNode") from the above commented-out code. mp.NamespaceMap[""] = "Clifton.Windows.Forms.XmlTree, Clifton.Windows.Forms"; // object ret = mp.Process(); // MessageBox.Show(ret.GetType().AssemblyQualifiedName+"\r\n"+typeof(RootNode).AssemblyQualifiedName); rootNode=(RootNode)mp.Process(); nodeList[rootNode.Name] = rootNode; BuildFlatNodeList(rootNode); // TreeNode tn=CreateNodeAndRequiredChildren(rootNode); // Nodes.Add(tn); }
public override DynValue Visit(RootNode rootNode) { return(ExecuteStatementList(rootNode.Children).Result); }
public async Task <DynValue> VisitAsync(RootNode rootNode, CancellationToken token) { return(await ExecuteStatementList(rootNode.Children, token)); }
private void ParseUntil(RootNode baseNode, TokenKind?stopToken = null) { while (_enumerator.MoveNext()) { var token = _enumerator.Current; if (token.Kind == stopToken) { break; } switch (token.Kind) { case TokenKind.DEF: { DefStatement temp = null; switch (baseNode) { case IVariableTableContainer tableContainer: { temp = ParseDef(new Dictionary <string, int>(tableContainer.varTable)); break; } default: { temp = ParseDef(new Dictionary <string, int>(_base.varTable)); break; } } baseNode.AddChild(temp); break; } case TokenKind.NAME: { //Console.WriteLine(_enumerator.Current.data); if (_enumerator.MoveNext()) { if (_enumerator.Current.Kind == TokenKind.EQUAL) { _enumerator.MovePrevious(); var name = _enumerator.Current.data; _enumerator.MoveNext(); _enumerator.MoveNext(); var expr = ParseExpr(); baseNode.AddChild(new AssignStatement( _enumerator.Current.row, _enumerator.Current.column, name, expr)); switch (baseNode) { case IVariableTableContainer tableContainer: { tableContainer.AddVar(name); break; } default: { _currentNameSpace.AddVar(name); break; } } } else if (_enumerator.Current.Kind == TokenKind.PLUSEQUAL || _enumerator.Current.Kind == TokenKind.MINEQUAL || _enumerator.Current.Kind == TokenKind.STAREQUAL || _enumerator.Current.Kind == TokenKind.SLASHEQUAL) { _enumerator.MovePrevious(); var name = _enumerator.Current.data; var row = _enumerator.Current.row; var col = _enumerator.Current.column; switch (baseNode) { case IVariableTableContainer tableContainer: { if (!tableContainer.HaveVariable(name)) { throw new CompilerException( $"Name {name} is not defined at {_enumerator.Current.row}:{_enumerator.Current.column}", _enumerator.Current.row, _enumerator.Current.column); } break; } default: { if (!_currentNameSpace.HaveVariable(name)) { throw new CompilerException( $"Name {name} is not defined at {_enumerator.Current.row}:{_enumerator.Current.column}", _enumerator.Current.row, _enumerator.Current.column); } break; } } _enumerator.MoveNext(); //var op = _enumerator.Current.Kind; var op = _enumerator.Current.Kind switch { TokenKind.PLUSEQUAL => TokenKind.PLUS, TokenKind.MINEQUAL => TokenKind.MINUS, TokenKind.STAREQUAL => TokenKind.STAR, TokenKind.SLASHEQUAL => TokenKind.SLASH }; if (_enumerator.MoveNext()) { baseNode.AddChild(new AssignStatement( _enumerator.Current.row, _enumerator.Current.column, name, new BinOp(_enumerator.Current.row, _enumerator.Current.column, op, new VarExpression(row, col, name), ParseExpr() ))); } } else if (_enumerator.Current.Kind == TokenKind.LPAR) { _enumerator.MovePrevious(); var tempEx = ParseExpr(); var temp = new ExprStatement(tempEx.Row, tempEx.Column, tempEx); //var temp = ParseName(); baseNode.AddChild(temp); // if (!_base.root.GetChildren() // .Any(def => // def is DefStatement d && // d.Name == temp.Name)) // { // throw new SyntaxException( // $"Name {temp.Name} is not defined at {temp.Row + 1}:{temp.Column}", // temp.Row, temp.Column); // } this.MatchIndentation(); break; } else { _enumerator.MovePrevious(); baseNode.AddChild(new ExprStatement( _enumerator.Current.row, _enumerator.Current.column, ParseExpr())); ; } } break; } case TokenKind.IF: { var temp = ParseConditional(); baseNode.AddChild(temp); //_enumerator.MovePrevious(); break; } case TokenKind.INT: case TokenKind.MINUS: case TokenKind.TILDE: case TokenKind.EXCLAMINATION: case TokenKind.LPAR: { var temp = new ExprStatement(_enumerator.Current.row, _enumerator.Current.column, ParseExpr()); //Console.WriteLine(temp.ToString()); baseNode.AddChild(temp); MatchIndentationCurrent(); break; } case TokenKind.WHILE: { var temp = ParseWhileLoop(); baseNode.AddChild(temp); break; } case TokenKind.BREAK: { if (_currentLoop == null) { throw new CompilerException($"Break is outside of loop at {_enumerator.Current.row}:" + $"{_enumerator.Current.column}", _enumerator.Current.row, _enumerator.Current.column); } baseNode.AddChild(new BreakStatement(_enumerator.Current.row, _enumerator.Current.column)); break; } case TokenKind.CONTINUE: { if (_currentLoop == null) { throw new CompilerException($"Continue is outside of loop at {_enumerator.Current.row}:" + $"{_enumerator.Current.column}", _enumerator.Current.row, _enumerator.Current.column); } baseNode.AddChild(new ContinueStatement(_enumerator.Current.row, _enumerator.Current.column)); break; } case TokenKind.PRINT: { var temp = new Print(_enumerator.Current.row, _enumerator.Current.column); Match(TokenKind.LPAR); temp.expr = ParseExpr(); _enumerator.MovePrevious(); MatchCurrent(TokenKind.RPAR); baseNode.AddChild(temp); break; } case TokenKind.RETURN: { if (_currentNameSpace.GetType() != typeof(DefStatement)) { throw new CompilerException($"Return outside of function at {_enumerator.Current.row}:" + $"{_enumerator.Current.column}", _enumerator.Current.row, _enumerator.Current.column); } var t = _enumerator.Current; _enumerator.MovePrevious(); baseNode.AddChild(new ReturnStatement(t.row, t.column, MatchReturn())); break; } default: { break; } } } }