public void print_node_revision_info(node_revision_info info) { DateTime d0 = Convert.ToDateTime("1998-01-01"); Console.Write("{0}, ", info.number_of_revision); Console.Write("{0}, ", info.outlink_vector_size); Console.Write("{0}, ", d0.AddDays(info.time_duration[0])); for (int i = 1; i < info.number_of_revision; i++) { Console.Write("{0}, ", d0.AddDays(info.time_duration[i])); } Console.WriteLine(); }
public SortedDictionary <string, long> getOutlinkInDuration(long nodeId, long[] uids, string[] urls, DateTime start_date, DateTime end_date) { node_revision_info info = getNodeInfo(nodeId); //Console.Write("{0}, ", nodeId); //print_node_revision_info(info); DateTime d0 = Convert.ToDateTime("1998-01-01"); long dist_start = (start_date - d0).Days; long dist_end = (end_date - d0).Days; if (start_date > end_date) { return(null); } //DateTime first_time_stamp = Convert.ToDateTime(info.first_time_stamp); //long dist_start = (first_time_stamp - start_date).Milliseconds; //long dist_end = (first_time_stamp - end_date).Milliseconds; byte[] union_vector = new byte[info.outlink_vector_size]; if (info.outlink_vector_size != uids.Length) { Console.WriteLine("Some error happen!!!"); } List <long> final_outlink = new List <long>(); for (int i = 0; i < union_vector.Length; i++) // byte vector { union_vector[i] = 0; } for (int i = 0; i < info.number_of_revision; i++) { //Console.WriteLine("Current {0}, {1}, {2}, {3}", dist_start, dist_end, info.first_time_stamp.ToString(), info.first_time_stamp.AddSeconds(info.time_duration[i]).ToString()); if (info.time_duration[i] < dist_end && info.time_duration[i] > dist_start) { for (int k = 0; k < union_vector.Length; k++) { //Console.Write("{0}|{1}={2}", info.revision_matrix[i][k], union_vector[k], (byte)(info.revision_matrix[i][k] | union_vector[k])); union_vector[k] = (byte)(link_at_index(info.revision_matrix, i * union_vector.Length + k) | union_vector[k]); } //Console.WriteLine(); } } //for (int k = 0; k < union_vector.Length; k++) //{ // Console.Write("{0}, ", union_vector[k]); //} //Console.WriteLine(); SortedDictionary <string, long> dict = new SortedDictionary <string, long>(); for (int i = 0; i < uids.Length; i++) // byte vector { if (union_vector[i] > 0) { dict.Add(urls[i], uids[i]); } } //dict.Values.CopyTo(uids, 0); //for (int i = 0; i < info.outlink_vector_size; i++) //{ // if (link_at_index(union_vector, i) == 0) // { // dict.Remove(urls[i]); // } //} return(dict); }