public Element[] getPassiveElementsByIndexes(int[] indexes) { int count = indexes.Length; Element[] elements = new Element[count]; for (int i = 0; i < count; i++) elements[i] = passiveElementsList[indexes[i]]; return elements; }
/* Стягивание элемента */ public void transformElementToZero(Element element, List<Element> elementsList) { List<Element> modifiedElements = elementToModifiedElementsDictionary[element].modifiedToZeroElements; if (modifiedElements != null) elementsList.AddRange(modifiedElements); //elementsList.Remove(element); }
public static string elementsToNamesString(Element[] elements) { const string defaultDelimiter = ";"; const string defaultPattern = ""; return elementsToNamesString(elements, defaultPattern, defaultDelimiter); }
/* Конвертация массива элементов в строку вида Шаблон(<элемент1>)<разделитель>Шаблон(<элемент2>);... */ public static string elementsToNamesString(Element[] elements, string pattern, string delimiter) { const string elementNameSymbol = "%element%"; if (!pattern.Contains(elementNameSymbol)) pattern = elementNameSymbol; string elementsString = ""; string[] names = new string[elements.Length]; for (int i = 0; i < elements.Length; i++) { names[i] = elements[i].getRightName(); } Array.Sort(names); for (int i = 0; i < names.Length; i++) { elementsString += pattern.Replace(elementNameSymbol, names[i]); elementsString += delimiter; } if (elementsString.Length > 0) if (elementsString.Substring(elementsString.Length - delimiter.Length) == delimiter) elementsString = elementsString.Remove(elementsString.Length - delimiter.Length); return elementsString; }
DataGridViewRow getElementRow(Element element, int index) { string elementType = element.getTypeString(); DataGridViewRow row = new DataGridViewRow(); row.CreateCells(schemeDataGrid); row.HeaderCell.Value = index; if (!(element is PassiveElement)) { row.Cells[0].ReadOnly = true; row.Cells[0].Style.BackColor = Color.LightGray; row.Cells[0].Style.ForeColor = Color.DarkGray; row.Cells[8].ReadOnly = true; row.Cells[8].Style.BackColor = Color.LightGray; row.Cells[8].Style.ForeColor = Color.DarkGray; } row.Cells[0].Value = false; row.Cells[1].Value = element.getRightName(); row.Cells[2].Value = Element.typeStringToElementTypeDictionary[elementType]; for (int j = 0; j < element.knots.Length; j++) { row.Cells[j + 3].Value = element.knots[j]; } if (element is ValueHavingElement) row.Cells[7].Value = ((ValueHavingElement)element).value; return row; }
public Element(Element element) { name = element.name; for (int i = 0; i < element.knots.Length; i++) knots[i] = element.knots[i]; }
public RealElement(Element element) : base(element) { }