internal MapperNode( TKey key, TValue value, int[] hashes, MapperNode <TKey, TValue> next) { _key = key; _value = value; _hashes = hashes; _next = next; }
/// <summary> /// Add a new node or update current if keys are equal /// </summary> /// <param name="key">Key</param> /// <param name="value">Value</param> /// <param name="hashes">Hashes of key properties</param> /// <param name="added">Out parameter. Represents number of new elements added (0 or 1)</param> public void Add(TKey key, TValue value, int[] hashes, out int added) { if (Mapper <TKey, TValue> .IsKeysEqual(_key, key)) { _value = value; added = 0; } else if (_next != null) { _next.Add(key, value, hashes, out added); } else { _next = new MapperNode <TKey, TValue>(key, value, hashes, null); added = 1; } }
public void CreateJavaResDataConfig(ExcelData excelSheetData, CJavaDataConfig javaDataConfig) { string dataConfigPath = javaDataConfig.folder + @"\src\data-config.xml"; if (File.Exists(dataConfigPath)) { XmlDocument doc = ConfigControl.GetXmlDocument(dataConfigPath); XmlElement rootElement = ConfigControl.GetXmlRootAsElement(doc, "configuration"); XmlElement mappersElement = rootElement.SelectSingleNode("mappers") as XmlElement; if (mappersElement.ChildNodes.Count > 0) { XmlNodeList list = mappersElement.ChildNodes; MapperNode[] nodes = new MapperNode[list.Count / 2]; for (int i = 0; i < nodes.Length; i++) { nodes[i] = new MapperNode(); //nodes[i].nodeValue = list[i*2].Value; XmlElement element = (XmlElement)list[i * 2 + 1]; string fullNmae = element.GetAttribute("resource"); int beginIndex = fullNmae.LastIndexOf(@"/"); int endIndex = fullNmae.LastIndexOf("."); nodes[i].name = fullNmae.Substring(beginIndex + 1, endIndex - beginIndex - 1).Trim(); string nodeValue = list[i * 2].Value; int startIndex = nodeValue.IndexOf(":"); nodes[i].time = nodeValue.Substring(startIndex + 1).Trim(); } WriteToDataConfig(excelSheetData, dataConfigPath, javaDataConfig, nodes); } else { WriteToDataConfig(excelSheetData, dataConfigPath, javaDataConfig, null); } Debug.Log(" data-config" + ".xml文件更新完毕"); } else { WriteToDataConfig(excelSheetData, dataConfigPath, javaDataConfig, null); Debug.Log(" data-config" + ".xml文件生成完毕"); } }
/// <summary> /// Method sets <see cref="_next"/> - link to next node /// </summary> /// <param name="next">Represents next node</param> public void SetNext(MapperNode <TKey, TValue> next) { _next = next; }