private ILeaf <t1, t2, t3> Parse(string Formula) { Formula = Formula.Trim(); string left = String.Empty, right = String.Empty; ILeaf <t1, t2, t3> delimiterLeaf = this.ParseDelimiters(Formula); if (delimiterLeaf != null) { return(delimiterLeaf); } ILeaf <t1, t2, t3> functionLeaf = this.ParseFunctions(Formula); if (functionLeaf != null) { return(functionLeaf); } if (Formula.StartsWith("(") && Formula.EndsWith(")")) { return(Parse(Formula.Substring(1, Formula.Length - 2))); } return(new EndLeaf <t1, t2, t3>(Formula, this.GenerateKey)); }
private void listViewDoc_Click(object sender, EventArgs e) { if (selectedNode == null) { return; } if (listViewDoc.SelectedItems.Count == 0) { return; } ListViewItem it = listViewDoc.SelectedItems[0]; ILeaf s = it.Tag as ILeaf; if (selected == s) { return; } selected = s; if (selected != null) { selectedItem = it; string desc = selected.Description; labelDescr.Text = desc; textBoxDescription.Text = desc; buttonDelete.Enabled = true; buttonLoad.Enabled = true; } }
public virtual bool Remove(ILeaf <T> leaf) { var success = false; if (leaf.IntersectionTest(Volume)) { if (childNodes.Count > 0) { foreach (var child in childNodes) { success |= child.Remove(leaf); } if (success) { LeafCount--; } } else { success = leafs.Remove(leaf); LeafCount = leafs.Count; } } return(success); }
public virtual bool Add(ILeaf <T> leaf) { var success = false; if (leaf.IntersectionTest(Volume)) { if (childNodes.Count > 0) { success = AddToChildren(leaf); if (success) { LeafCount++; } } else { success = leafs.Add(leaf); LeafCount = leafs.Count; if (leafs.Count > maxLeafsPerNode && Level < maxDepth) { Extend(); } } } return(success); }
public LeafContainerBase ReadTypeDirect(bool hasSize = true) { long typeStartOffset = Position; UInt16 size = 0; if (hasSize) { size = ReadUInt16(); } LeafType leafType = ReadEnum <LeafType>(); ILeaf typeSym = CreateLeafStream(leafType); typeSym.Read(); ConsumePadding(); #if !PEFF long typeDataSize = size + sizeof(UInt16); UInt32 typeHash = PerformAt(typeStartOffset, () => { byte[] typeData = ReadBytes((int)typeDataSize); return(HasherV2.HashBufferV8(typeData, 0xFFFFFFFF)); }); #endif return(new DirectLeafProvider(0, leafType, typeSym)); }
public void SendScribble(String sender, ILeaf leaf) { if (this.Data == null) { return; } leaf.Scribble(sender == null ? Server.Chatroom.BotName : sender, this.Data, this.Height); }
/// <summary> /// Gets called when the parent model element of the current model element is about to change /// </summary> /// <param name="oldParent">The old parent model element</param> /// <param name="newParent">The new parent model element</param> protected override void OnParentChanging(IModelElement newParent, IModelElement oldParent) { ILeaf oldOwner = ModelHelper.CastAs <ILeaf>(oldParent); ILeaf newOwner = ModelHelper.CastAs <ILeaf>(newParent); ValueChangedEventArgs e = new ValueChangedEventArgs(oldOwner, newOwner); this.OnOwnerChanging(e); this.OnPropertyChanging("Owner", e, _ownerReference); }
public JSLeaf(ObjectInstance prototype, ILeaf leaf, String script) : base(prototype.Engine, ((ClrFunction)prototype.Engine.Global["Leaf"]).InstancePrototype) { this.PopulateFunctions(); this.parent = leaf; this.ScriptName = script; DefineProperty(Engine.Symbol.ToStringTag, new PropertyDescriptor("Leaf", PropertyAttributes.Sealed), true); }
public static t4 GetLeafValue <t1, t2, t3, t4>(this ILeaf <t1, t2, t3> Leaf, t1 Variables) where t1 : IVariableCollection <t2> where t2 : IVariableCollectionKey where t3 : IRequiredVariables <t1, t2> where t4 : IComparable { IComparable val = Leaf.Solve(Variables); return((t4)val); }
private ILeaf ExecuteAllLeafFilter(ILeaf leaf) { foreach (var leafexcuter in LeafWorkunit()) { leafexcuter.Workunit = leaf; ((IExecuteable)leafexcuter).Execute(); leaf = leafexcuter.Workunit; } return leaf; }
public bool Remove(ILeaf <T> leaf) { var result = rootNode.Remove(leaf); if (result) { rootNode.TryMerge(); } return(result); }
protected virtual bool AddToChildren(ILeaf <T> leaf) { var success = false; foreach (var child in childNodes) { success |= child.Add(leaf); } return(success); }
static void Main(string[] args) { IComposite html = HtmlElement.GetInstance <IComposite>("Html"); IComposite head = HtmlElement.GetInstance <IComposite>("head"); head.AddChilde(HtmlElement.GetInstance <ILeaf>("Title", "Test")); ILeaf link = HtmlElement.GetInstance <ILeaf>("link"); link.AddAttribute("src", "www.link.com"); link.AddAttribute("rel", "icon"); head.AddChilde(link); html.AddChilde(head); IComposite body = HtmlElement.GetInstance <IComposite>("Body"); body.AddChilde(HtmlElement.GetInstance <IComposite>("div")); html.AddChilde(body); Console.WriteLine(html.GetHtml(0)); }
/// <summary> /// Gets called when the parent model element of the current model element changes /// </summary> /// <param name="oldParent">The old parent model element</param> /// <param name="newParent">The new parent model element</param> protected override void OnParentChanged(IModelElement newParent, IModelElement oldParent) { ILeaf oldOwner = ModelHelper.CastAs <ILeaf>(oldParent); ILeaf newOwner = ModelHelper.CastAs <ILeaf>(newParent); if ((oldOwner != null)) { oldOwner.Assignments.Remove(this); } if ((newOwner != null)) { newOwner.Assignments.Add(this); } ValueChangedEventArgs e = new ValueChangedEventArgs(oldOwner, newOwner); this.OnOwnerChanged(e); this.OnPropertyChanged("Owner", e, _ownerReference); base.OnParentChanged(newParent, oldParent); }
private static bool LeafHandler(YangStatement statement, ILeaf partial) { switch (statement.Keyword) { case "type": partial.Type = ParseType(statement); return(true); case "default": partial.Default = statement.Argument; return(true); case "units": partial.Units = statement.Argument; return(true); default: return(false); } }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.Port == null)) { IOutputPort portCasted = item.As <IOutputPort>(); if ((portCasted != null)) { this._parent.Port = portCasted; return; } } if ((this._parent.Owner == null)) { ILeaf ownerCasted = item.As <ILeaf>(); if ((ownerCasted != null)) { this._parent.Owner = ownerCasted; return; } } }
private void GenerateControl(Control Parent, ILeaf <t1, t2, t3> TreeLeaf) { if (TreeLeaf is EndLeaf <t1, t2, t3> ) { this.GenerateEndLeafControl(Parent, TreeLeaf as EndLeaf <t1, t2, t3>); } else { ITemplate template = this.TemplateLookup(TreeLeaf.GetType()); if (template == null) { Parent.Controls.Add(new Label() { Text = TreeLeaf.Formula }); } else { this.GenerateFromTemplate(Parent, template, TreeLeaf); } } }
public LeafContainerBase ReadTypeDirect(bool hasSize = true) { long typeStartOffset = Position; UInt16 size = 0; if (hasSize) { size = ReadUInt16(); if (size == 0) { throw new InvalidDataException("Leaf size field cannot be 0"); } } LeafType leafType = ReadEnum <LeafType>(); ILeaf typeSym = CreateLeafStream(leafType); typeSym.Read(); Position += (typeSym as LeafBase).Length; ConsumePadding(); // for PDB 1.0: hash collides with padding, and is not properly encoded sometimes AlignStream(2); #if !PEFF long typeDataSize = size + sizeof(UInt16); UInt32 typeHash = PerformAt(typeStartOffset, () => { byte[] typeData = ReadBytes((int)typeDataSize); return(HasherV2.HashBufferV8(typeData, 0xFFFFFFFF)); }); #endif return(new DirectLeafProvider(0, leafType, typeSym)); }
private static string DecodeEscape(ILeaf node) { switch (node.Value) { case "]": return("]"); case "-": return("-"); case "\"": return("\""); case "\'": return("\'"); case "\\": return("\\"); case "0": return("\0"); case "a": return("\a"); case "b": return("\b"); case "e": return("\x1b"); case "f": return("\f"); case "n": return("\n"); case "r": return("\r"); case "t": return("\t"); case "v": return("\v"); default: throw new NotImplementedException(); } }
private string AskTagInformation(ILeaf leaf) { return "CD 1 TRACK 7"; }
private string[] fillCurrentInfo(IRoot root, ISubRoot subRoot, ILeaf leaf) { string[] info = new string[7]; info[0] = getRootFolderByCopyMode(); info[1] = root.Name; info[2] = subRoot.Year > 0 ? subRoot.Year.ToString() : ""; info[3] = subRoot.Name; info[4] = leaf.Count > 0 ? leaf.Count.ToString() : ""; string tracknr = ""; if (leaf.Number > 0) { tracknr = leaf.Number.ToString(); if (leaf.Number < 10) { tracknr = "0" + tracknr; } } info[5] = tracknr; info[6] = leaf.Name; return info; }
public Multiply(String Formula, ILeaf <t1, t2, t3> LHS, ILeaf <t1, t2, t3> RHS) : base(Formula, LHS, RHS) { }
public DirectLeafProvider(uint typeIndex, LeafType type, ILeaf data) { this.typeIndex = typeIndex; this.type = type; this.data = data; }
/// <summary> /// Creates a new instance /// </summary> public LeafReferencedElementsCollection(ILeaf parent) { this._parent = parent; }
/// <summary> /// Creates a new instance /// </summary> public LeafChildrenCollection(ILeaf parent) { this._parent = parent; }
public Twig(ILeaf leaf) { Console.WriteLine("ctor ---> Twig"); }
public TreeAssignmentsCollection(ILeaf leaf) : base(leaf.AncestorTree().Select(tree => new TreeAssignment((tree.Parent as ISubtree).Port, (tree.Parent as ISubtree).TreeForOne == tree.Child))) { _leaf = leaf; }
public ParserDataItem(ILeaf <t1, t2, t3> TreeLeaf, string Field) { this.TreeLeaf = TreeLeaf; this.Field = Field; }
private void WriteFolderStruct(IRoot root, ISubRoot subRoot, ILeaf leaf) { List<string> formatstrings = FormatString.Split('\\').ToList(); string[] info = fillCurrentInfo(root, subRoot, leaf); // bzw da das nicht geht // wird das stück formatstring das diese lehren zahlen enthält nicht mit ein gefügt // das alles noch in ordner ändern wird fies DirectoryInfo Folder = null; bool ContainsValue = false; // das alles soll nur für die ordner geschehen for(int i = 0; i< formatstrings.Count -1 ; i++) { foreach(char c in formatstrings[i]) { // such die zahlen im formatstring if( 47 < c && c < 58) // wenn es ne zahl ist , ich brauch nur einstellige suchen { // zum int parsen schauen was in dem array an information enthalten ist // format entfernen oder nicht .... int pos = c - 48; // an manchen stellen hatten sie einfach keine lust mehr if(pos < info.Length) { // kontrolliere alle werte die zu diesen zahlen gehören if(!String.IsNullOrWhiteSpace(info[pos])) { ContainsValue = true; break; } } } } if(!ContainsValue) { // wer fehlt fliegt formatstrings.RemoveAt(i); i--; continue; } ContainsValue = false; // hier wird das getan was notwendiog ist ?! // formatstück nehmen info anwenden string currentSubFolder = ApplyWriteType(String.Format(formatstrings[i], info)); if (Folder == null) { Folder = new DirectoryInfo(currentSubFolder); } else { Folder = Folder.CreateSubdirectory(currentSubFolder); } Folder.Create(); } // jetzt "nur" noch die Dateien aber das ja egal FileInfo fi = new FileInfo(leaf.FullFilePath); string folder = Folder.FullName; string extension = fi.Extension; string fileName = ApplyWriteType(String.Format(formatstrings[formatstrings.Count - 1], info)); string FullTargetName = folder + "\\" + fileName + extension; Copy(FullTargetName, leaf.FullFilePath); //fi.CopyTo(FullName, true); }