public void AddAttribute(string attributeName, string value) { MapTree.AttributeSpec aSpec = Tree.GetAttributeSpec(attributeName); if (aSpec == null) { aSpec = new MapTree.AttributeSpec(Tree, attributeName); } MapNode.Attribute attribute = new Attribute(aSpec, value); AddAttribute(attribute); }
public bool ContainsAttribute(MapTree.AttributeSpec attSpec) { if (attributeList != null) { foreach (Attribute att in attributeList) { if (att.AttributeSpec == attSpec) { return(true); } } } return(false); }
/// <summary> /// Returns the index of attribute. '-1' if not found. /// </summary> /// <param name="attributeName"></param> /// <returns></returns> public int FindAttributeIndex(MapTree.AttributeSpec attribute) { if (attributeList != null) { for (int i = 0; i < attributeList.Count; i++) { if (attributeList[i].AttributeSpec == attribute) { return(i); } } } return(-1); }
/// <summary> /// Returns false if attribute not found /// </summary> /// <param name="aSpec">AttributeSpec</param> /// <param name="value">New value</param> /// <returns></returns> public bool UpdateAttribute(MapTree.AttributeSpec aSpec, string value) { if (attributeList != null) { for (int i = 0; i < attributeList.Count; i++) { if (attributeList[i].AttributeSpec == aSpec) { UpdateAttribute(i, value); return(true); } } } return(false); }
public bool GetAttribute(MapTree.AttributeSpec attSpec, out Attribute attribute) { if (attributeList != null) { foreach (Attribute att in attributeList) { if (att.AttributeSpec == attSpec) { attribute = att; return(true); } } } attribute = Attribute.Empty; return(false); }
public bool DeleteAttribute(MapTree.AttributeSpec attributeSpec) { return(DeleteAttribute(a => a.AttributeSpec == attributeSpec)); }
public Attribute(MapTree.AttributeSpec aspec, object val) { this.AttributeSpec = aspec; this.Value = val; }