public TupleMarkup GetMatchingTupleMarkup(DataRow instRow, string tupleName) { TupleMarkup temp = new TupleMarkup((string)instRow[InstanceUtils._ElementIDCol], (string)instRow[InstanceUtils._parentIdCol], tupleName); if ((bool)instRow[InstanceUtils._IsNestedTuple]) { int index2 = nestedTupleMarkups.BinarySearch(temp); if (index2 >= 0) { return(nestedTupleMarkups[index2]); } return(null); } // this gives us the first match in the list, which may or may not have already been consumed int index = regularTupleMarkups.BinarySearch(temp, new ElementParentComparer()); if (index >= 0) { return(regularTupleMarkups[index]); } return(null); }
/// <summary> /// We're making an assumption that the tuples given to us are correct - that a tupleset can't contain /// multiple elements with the same context. /// </summary> protected void InsertRegularTuple(DataRow instRow, string tupleName, string colName, string markupData, int level) { TupleMarkup tm = new TupleMarkup((string)instRow[InstanceUtils._ElementIDCol], (string)instRow[InstanceUtils._parentIdCol], tupleName, level); int index = regularTupleMarkups.BinarySearch(tm, new ElementParentComparer()); if (index < 0) { tm.AddMarkup(colName, markupData, tupleName); tm.InstanceRow = instRow; regularTupleMarkups.Insert(~index, tm); } else { regularTupleMarkups[index].AddMarkup(colName, markupData, tupleName); regularTupleMarkups[index].TupleSetNames.Add(tupleName); } }
protected void InsertNestedTuple(DataRow instRow, string tupleName, string colName, string markupData, int level) { TupleMarkup tm = new TupleMarkup((string)instRow[InstanceUtils._ElementIDCol], (string)instRow[InstanceUtils._parentIdCol], tupleName, level); int index = nestedTupleMarkups.BinarySearch(tm); if (index < 0) { tm.AddMarkup(colName, markupData, tupleName); tm.InstanceRow = instRow; nestedTupleMarkups.Insert(~index, tm); } else { // this probably won't be hit nestedTupleMarkups[index].AddMarkup(colName, markupData, tupleName); nestedTupleMarkups[index].TupleSetNames.Add(tupleName); } }