public void addAttribute(FcaAttribute attr, FcaObject obj) { bool contains = false; foreach (FcaAttribute at in attributes) { if (at.getName().Equals(attr.getName())) { getObjByName(obj.getName()).addAttr(at); contains = true; } } if (!contains) { attr.setId(attributes.Count); getObjByName(obj.getName()).addAttr(attr); attributes.Add(attr); } }
public void addObject(FcaObject obj) { bool contains = false; foreach (FcaObject o in objects) { if (o.getName().Equals(obj.getName())) contains = true; } if (!contains) { obj.setId(objects.Count); objects.Add(obj); } }
/// <summary> /// Поиск элемента по имени /// </summary> /// <param name="elem">Имя элемента</param> /// <returns>его порядковый номер</returns> public int findElem(FcaObject elem) { int i = 0; int len = this.objects.Count(); while((i < len) && (this.objects[i].getName() != elem.getName())) i++; if (i >= len) return -1; return i; }