public NetworkNode_class Deep_copy() { NetworkNode_class copy = (NetworkNode_class)this.MemberwiseClone(); int nodes_length = Nodes_length; copy.Nodes = new NetworkNode_line_class[nodes_length]; for (int indexN = 0; indexN < nodes_length; indexN++) { copy.Nodes[indexN] = this.Nodes[indexN].Deep_copy(); } return(copy); }
public void Add_other_nodes_remove_duplicates_and_reindex(NetworkNode_class other) { Add_new_obo_node_lines_remvoe_duplicates_and_reindex(other.Nodes); }
public NetworkNode_class Merge_this_nodes_with_other_nodes_and_get_new_indexes_of_other_UN(NetworkNode_class inputOther) { NetworkNode_class other = inputOther.Deep_copy(); this.Order_by_name(); other.Order_by_name(); int this_length = this.Nodes.Length; int indexThis = 0; int other_length = other.Nodes.Length; int indexOther = 0; int stringCompare = 0; List <NetworkNode_line_class> mergedUN = new List <NetworkNode_line_class>(); NetworkNode_line_class this_line = new NetworkNode_line_class(); NetworkNode_line_class other_line = new NetworkNode_line_class(); int overlapping_nodes_count = 0; int indexOtherNew = this_length - 1; while ((indexThis < this_length) || (indexOther < other_length)) { if ((indexThis < this_length) && (indexOther < other_length)) { this_line = this.Nodes[indexThis]; other_line = other.Nodes[indexOther]; this_line.NW_index_old = this_line.NW_index; stringCompare = other_line.Name.CompareTo(this_line.Name); } else if (indexThis < this_length) { this_line = this.Nodes[indexThis]; this_line.NW_index_old = this_line.NW_index; stringCompare = 2; } else // if (indexOther < other_count) { other_line = other.Nodes[indexOther]; stringCompare = -2; } if (stringCompare < 0) //other_line is not in this.un { indexOtherNew++; other_line.NW_index_old = other_line.NW_index; other_line.NW_index = indexOtherNew; NetworkNode_line_class newOtherLine = other_line.Deep_copy(); newOtherLine.NW_index = indexOtherNew; newOtherLine.NW_index_old = indexOtherNew; mergedUN.Add(newOtherLine); indexOther++; } else if (stringCompare == 0) { mergedUN.Add(this_line); other_line.NW_index_old = other_line.NW_index; other_line.NW_index = this_line.NW_index; overlapping_nodes_count++; indexOther++; indexThis++; } else // (stringCompare > 0) { mergedUN.Add(this_line); indexThis++; } } Nodes = mergedUN.ToArray(); other.Index_change_adopted = false; return(other); }