private void RemoveTrackingRefUpdate(ObjectId want) { Iterator <TrackingRefUpdate> i = localUpdates.Iterator(); while (i.HasNext()) { TrackingRefUpdate u = i.Next(); if (u.GetNewObjectId().Equals(want)) { i.Remove(); } } }
private void RemoveFetchHeadRecord(ObjectId want) { Iterator <FetchHeadRecord> i = fetchHeadUpdates.Iterator(); while (i.HasNext()) { FetchHeadRecord fh = i.Next(); if (fh.newValue.Equals(want)) { i.Remove(); } } }
/// <summary>Copy a table in this database into a new delimited text file.</summary> /// <remarks>Copy a table in this database into a new delimited text file.</remarks> /// <param name="cursor">Cursor to export</param> /// <param name="out">Writer to export to</param> /// <param name="header">If <code>true</code> the first line contains the column names /// </param> /// <param name="delim">The column delimiter, <code>null</code> for default (comma)</param> /// <param name="quote">The quote character</param> /// <param name="filter">valid export filter</param> /// <exception cref="System.IO.IOException"></exception> public static void ExportWriter(Cursor cursor, BufferedWriter @out, bool header, string delim, char quote, ExportFilter filter) { string delimiter = (delim == null) ? DEFAULT_DELIMITER : delim; // create pattern which will indicate whether or not a value needs to be // quoted or not (contains delimiter, separator, or newline) Sharpen.Pattern needsQuotePattern = Sharpen.Pattern.Compile("(?:" + Sharpen.Pattern .Quote(delimiter) + ")|(?:" + Sharpen.Pattern.Quote(string.Empty + quote) + ")|(?:[\n\r])" ); IList <Column> origCols = cursor.GetTable().GetColumns(); IList <Column> columns = new AList <Column>(origCols); columns = filter.FilterColumns(columns); ICollection <string> columnNames = null; if (!origCols.Equals(columns)) { // columns have been filtered columnNames = new HashSet <string>(); foreach (Column c in columns) { columnNames.AddItem(c.GetName()); } } // print the header row (if desired) if (header) { for (Iterator <Column> iter = columns.Iterator(); iter.HasNext();) { WriteValue(@out, iter.Next().GetName(), quote, needsQuotePattern); if (iter.HasNext()) { @out.Write(delimiter); } } @out.NewLine(); } // print the data rows IDictionary <string, object> row; object[] unfilteredRowData = new object[columns.Count]; while ((row = cursor.GetNextRow(columnNames)) != null) { // fill raw row data in array for (int i = 0; i < columns.Count; i++) { unfilteredRowData[i] = row.Get(columns[i].GetName()); } // apply filter object[] rowData = filter.FilterRow(unfilteredRowData); // print row for (int i_1 = 0; i_1 < columns.Count; i_1++) { object obj = rowData[i_1]; if (obj != null) { string value = null; if (obj is byte[]) { value = ByteUtil.ToHexString((byte[])obj); } else { value = rowData[i_1].ToString(); } WriteValue(@out, value, quote, needsQuotePattern); } if (i_1 < columns.Count - 1) { @out.Write(delimiter); } } @out.NewLine(); } @out.Flush(); }