private RenameList.RowData BinarySearchid(int key, int min, int max) { RenameList.RowData rowData = this.Table[min]; if (rowData.id == key) { return(rowData); } RenameList.RowData rowData2 = this.Table[max]; if (rowData2.id == key) { return(rowData2); } if (max - min <= 1) { return(null); } int num = min + (max - min) / 2; RenameList.RowData rowData3 = this.Table[num]; if (rowData3.id.CompareTo(key) > 0) { return(this.BinarySearchid(key, min, num)); } if (rowData3.id.CompareTo(key) < 0) { return(this.BinarySearchid(key, num, max)); } return(rowData3); }
protected override void ReadLine(BinaryReader reader) { RenameList.RowData rowData = new RenameList.RowData(); base.Read <int>(reader, ref rowData.id, CVSReader.intParse); this.columnno = 0; base.Read <int>(reader, ref rowData.cost, CVSReader.intParse); this.columnno = 1; this.AddRowid(rowData.id, rowData, 0, this.Table.Count - 1); this.columnno = -1; }
protected override bool OnLine(string[] Fields) { RenameList.RowData rowData = new RenameList.RowData(); if (!base.Parse(Fields[this.ColMap[0]], ref rowData.id)) { return(false); } if (!base.Parse(Fields[this.ColMap[1]], ref rowData.cost)) { return(false); } this.AddRowid(rowData.id, rowData, 0, this.Table.Count - 1); return(true); }
private void AddRowid(int key, RenameList.RowData row, int min, int max) { if (this.Table.Count == 0) { this.Table.Add(row); return; } RenameList.RowData rowData = this.Table[min]; if (rowData.id.CompareTo(key) > 0) { this.Table.Insert(min, row); return; } if (rowData.id == key) { XSingleton <XDebug> .singleton.AddErrorLog2("Table: RenameList duplicate id:{0} lineno: {1}", new object[] { key, this.lineno }); return; } RenameList.RowData rowData2 = this.Table[max]; if (rowData2.id.CompareTo(key) < 0) { this.Table.Insert(max + 1, row); return; } if (rowData2.id == key) { XSingleton <XDebug> .singleton.AddErrorLog2("Table: RenameList duplicate id:{0} lineno: {1}", new object[] { key, this.lineno }); return; } if (max - min <= 1) { this.Table.Insert(min + 1, row); return; } int num = min + (max - min) / 2; RenameList.RowData rowData3 = this.Table[num]; if (rowData3.id.CompareTo(key) > 0) { this.AddRowid(key, row, min, num); return; } if (rowData3.id.CompareTo(key) < 0) { this.AddRowid(key, row, num, max); return; } XSingleton <XDebug> .singleton.AddErrorLog2("Table: RenameList duplicate id:{0} lineno: {1}", new object[] { key, this.lineno }); }