/// <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); }
/// <summary> /// Returns a list of racks, the first ones are in lines that have prio, than the other lists /// </summary> /// <param name="agv"></param> /// <returns></returns> public List <Rack> GetPossibleRacksForAGV(AGV agv, OrderItem oi) { List <Rack> racklist = new List <Rack>(); List <Rack> prioRackList = new List <Rack>(); List <Line> sortedLines = LinesList.OrderByDescending(x => x.Position.Y).ToList(); foreach (Line l in sortedLines) { if (l.PriorityProduct == oi.productItem.Type) { foreach (Rack r in l.RackList) { if (r.Available == true) { prioRackList.Add(r); } } } else { foreach (Rack r in l.RackList) { if (r.Available == true) { racklist.Add(r); } } } } racklist.InsertRange(0, prioRackList); return(racklist); }
public Bitmap DrawAreas() { AreaList.ForEach(x => x.DrawArea()); LinesList.ForEach(x => x.DrawLine()); GetRackList().ForEach(x => x.DrawRack()); AGVList.ForEach(x => x.LoadImage()); return(iBlade.DrawArea); }
public void DisplayLines() { var newlines = LinesFromFileOrTraitValue(); if (newlines != null) { LinesList.UpdateLineSource(newlines); } }
public void AddLine(Node startNode, Node endNode) { int linenumber = LinesList.Count + 1; string linename = ("e" + linenumber.ToString()); Line newLine = new Line(linename, startNode, endNode); LinesList.Add(linename, newLine); //SetTheConnectionAndStartArray(); }
//==== READ Methods ==== // Read: InputDoc // "Initialize Object Properties" public void Read_InputDoc(string _inputFilePath) { this.Txt_FilePath = _inputFilePath; // Populate 'textLines' Array from .txt document this.TextArray = System.IO.File.ReadAllLines(this.Txt_FilePath); this.LinesList = TextArray.ToList(); this.LineCount = LinesList.Count(); Console.WriteLine("LineCount: " + LineCount); }
// Mod Line to TitleCasing public void ToTitleCase() { TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; for (int i = 0; i < LinesList.Count(); i++) { if (LinesList[i].Contains("MODULE") || LinesList[i].ToUpper().Contains("KNOWLEDGE CHECK")) { LinesList[i] = textInfo.ToTitleCase(LinesList[i]); } } }
// Get Flagless Version of Line (live) public string GetFlaglessLine(int _lineIndex) { int i = _lineIndex; string line = LinesList.ElementAtOrDefault(i); bool isPageBreak = false; bool isModule = false; bool isSubmodule = false; bool isGreen = false; bool isVideo = false; if (line.StartsWith("$$$")) { isPageBreak = true; } else if (line.StartsWith("!!! Video:")) { isVideo = true; } else if (line.StartsWith("***")) { isModule = true; line = line.Remove(0, 3); } else if (line.StartsWith("###")) { isSubmodule = true; line = line.Remove(0, 3); } else if (line.Trim().StartsWith("^GREEN^")) { char[] tagGreen = "^GREEN^".ToCharArray(); char[] tagStrong = "<strong>".ToCharArray(); char[] tagStrongEnd = @"</strong>".ToCharArray(); line = line.Trim(tagGreen); if (line.Contains(tagStrong.ToString())) { line = line.TrimStart(tagStrong); } if (line.Contains(tagStrongEnd.ToString())) { line = line.TrimEnd(tagStrongEnd); } isGreen = true; } return(line); }
public Bitmap DrawAreas() { LinesList.ForEach(x => x.DrawLine()); GetRackList().ForEach(x => x.DrawRack()); Area inbound = new Area("INBOUND", new Size(150, 100), new Point(130, 500)); Area outbound = new Area("OUTBOUND", new Size(150, 100), new Point(550, 500)); this.AreaList.Add(inbound); this.AreaList.Add(outbound); AreaList.ForEach(x => x.DrawArea()); return(iBlade.DrawArea); }
public void Filter(string searchText) { if (searchText.Length > LastSearchText.Length && searchText.StartsWith(LastSearchText)) { //if just adding to the last search (continuing to type) then can filter from what is already showing LinesList.UpdateLineSource(LinesList.CurrentLines.FilteredCopy(searchText)); } else { //...otherwise need to get content from the source var newlines = LinesFromFileOrTraitValue(); newlines = newlines.FilteredCopy(searchText); LinesList.UpdateLineSource(newlines); } LastSearchText = searchText; }
public bool MoveNext() { var result = true; if (LinesList.Count > 0) { Current = LinesList[0]; LinesList.RemoveAt(0); } else { int i; for (i = 0; i < MaxRetryCount; i++) { result = ChunksEnumerator.MoveNext(); if (result) { var c = ChunksEnumerator.Current; var str = LastStr + Encoding.UTF8.GetString(c); if (string.IsNullOrEmpty(NewLine)) { NewLine = GetEmbeddedNewLineChars(str); } var lines = (string.IsNullOrEmpty(NewLine)) ? new string[0] : str.Split(NewLine); if (Current == null && lines.Length > 0) { if (!ValidateHeader(lines[0])) { throw new InvalidOperationException(); } } if (Current == null && lines.Length == 2) { LastStr = lines[1]; continue; } else if (Current == null && lines.Length > 2) { for (int t = 1; t < lines.Length - 1; t++) { LinesList.Add(GetPTurnData(lines[t])); } Current = LinesList[0]; LinesList.RemoveAt(0); LastStr = lines[^ 1];
private void TextsListItemClick(object sender, MouseButtonEventArgs e) { bool temp = ShouldSave; LinesList.DataContext = (sender as ListBoxItem).DataContext; NameBox.DataContext = (sender as ListBoxItem).DataContext; Binding binding = new Binding(); binding.Path = new PropertyPath("Lines"); binding.Source = (sender as ListBoxItem).DataContext; binding.Mode = BindingMode.TwoWay; binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; LinesList.SetBinding(ItemsControl.ItemsSourceProperty, binding); if (!temp) { ShouldSave = false; } }
// Flag Module Breaks public void FlagModuleBreaks() { TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; for (int i = 0; i < LinesList.Count(); i++) { string line = LinesList[i]; if (LinesList[i].ToUpper().Contains("SUBMODULE")) { LinesList[i] = LinesList[i].Replace("SUBMODULE", "Submodule"); LinesList[i] = textInfo.ToTitleCase(LinesList[i]); LinesList[i] = LinesList[i].Insert(0, "###"); } else if (LinesList[i].ToUpper().Contains("MODULE")) { LinesList[i] = LinesList[i].Replace("MODULE", "Module"); LinesList[i] = textInfo.ToTitleCase(LinesList[i]); LinesList[i] = LinesList[i].Insert(0, "***"); } } }
public List <String> JoinWithComma(params List <String>[] LinesList) { if (LinesList.Length == 0) { return(new List <String> { }); } var l = new List <String>(); foreach (var Lines in LinesList.Take(LinesList.Length - 1)) { if (Lines.Count == 0) { continue; } l.AddRange(Lines.Take(Lines.Count - 1)); l.Add(Lines[Lines.Count - 1] + ","); } l.AddRange(LinesList[LinesList.Length - 1]); return(l); }
/// <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> /// Removes the line with the specified name from the Graph. /// </summary> /// <param name="lineName">The name of the line to remove.</param> /// <exception cref="ArgumentNullException">lineName is Null.</exception> /// <exception cref="KeyNotFoundException">line to remove is not in the Graph.</exception> public void RemoveLine(string lineName) { ValidateArgumentIsNotNull(lineName); LinesList.Remove(lineName); SetTheConnectionAndStartArray(); }
/// <summary> /// Determines whether the Graph contains a specific line. /// </summary> /// <param name="lineName">The name of line to locate in the Graph. The value can not be null.</param> /// <returns>true if the Graph contains line with the specified name; otherwise, false.</returns> /// <exception cref=" ArgumentNullException">name of line is null.</exception> public bool ContainsLine(string lineName) { ValidateArgumentIsNotNull(lineName); return(LinesList.ContainsKey(lineName)); }