/// <summary> /// Returns <see langword="true" /> if the set contains all the elements in the specified collection. /// </summary> /// <param name="c">A collection of objects.</param> /// <returns><see langword="true" /> if the set contains all the elements in the specified collection, <see langword="false" /> otherwise.</returns> public override sealed bool ContainsAll(ICollection c) { Set temp; lock (c.SyncRoot) { temp = new HybridSet(c); } lock (mSyncRoot) { return(mBasisSet.ContainsAll(temp)); } }
/// <summary> /// Retains only the elements in this set that are contained in the specified collection. /// </summary> /// <param name="c">Collection that defines the set of elements to be retained.</param> /// <returns><c>true</c> if this set changed as a result of this operation.</returns> public sealed override bool RetainAll(ICollection c) { Set temp; lock (c.SyncRoot) { temp = new HybridSet(c); } lock (mSyncRoot) { return(mBasisSet.RetainAll(temp)); } }
/// <summary> /// Returns <c>true</c> if the set contains all the elements in the specified collection. /// </summary> /// <param name="c">A collection of objects.</param> /// <returns><c>true</c> if the set contains all the elements in the specified collection, <c>false</c> otherwise.</returns> public sealed override bool ContainsAll(ICollection c) { Set temp; lock (c.SyncRoot) { temp = new HybridSet(c); } lock (_syncRoot) { return(_basisSet.ContainsAll(temp)); } }
/// <summary> /// Retains only the elements in this set that are contained in the specified collection. /// </summary> /// <param name="c">Collection that defines the set of elements to be retained.</param> /// <returns><c>true</c> if this set changed as a result of this operation.</returns> public override bool RetainAll(ICollection c) { //Put data from C into a set so we can use the Contains() method. Set cSet = new HybridSet(c); //We are going to build a set of elements to remove. Set removeSet = new HybridSet(); foreach (object o in this) { //If C does not contain O, then we need to remove O from our //set. We can't do this while iterating through our set, so //we put it into RemoveSet for later. if (!cSet.Contains(o)) { removeSet.Add(o); } } return(RemoveAll(removeSet)); }
/// <summary> /// Gets the set of NHibernate <see cref="Table"/> objects known to the specified configuration. /// </summary> /// <param name="cfg"></param> /// <param name="namespaceFilter"></param> /// <returns></returns> private static List<Table> GetTables(Configuration cfg, RelationalSchemaOptions.NamespaceFilterOption namespaceFilter) { // build set of all tables var tables = new HybridSet(); var filteredClassMappings = CollectionUtils.Select( cfg.ClassMappings, classMapping => namespaceFilter.Matches(classMapping.MappedClass.Namespace)); foreach (var pc in filteredClassMappings) { foreach (var table in pc.TableClosureIterator) { tables.Add(table); } } var filteredCollectionMappings = CollectionUtils.Select( cfg.CollectionMappings, collectionMapping => namespaceFilter.Matches(collectionMapping.Owner.MappedClass.Namespace)); foreach (var collection in filteredCollectionMappings) { tables.Add(collection.CollectionTable); } return CollectionUtils.Sort(tables, (Table x, Table y) => x.Name.CompareTo(y.Name)); }