Example #1
0
        /// <inheritdoc cref="Map{K,V}.Xor"/>
        public MMap <K, V> Xor(MapOrMMap <K, V> other)
        {
            var set    = _set.CloneFreeze();
            int count2 = _count + set.SymmetricExceptWith(other._set, Comparer);

            return(new MMap <K, V>(set, _keyComparer, count2));
        }
Example #2
0
        /// <inheritdoc cref="Map{K,V}.Intersect"/>
        public MMap <K, V> Intersect(MapOrMMap <K, V> other)
        {
            var set    = _set.CloneFreeze();
            int count2 = _count - set.IntersectWith(other._set, other.Comparer);

            return(new MMap <K, V>(set, _keyComparer, count2));
        }
Example #3
0
        /// <inheritdoc cref="Map{K,V}.Union"/>
        public MMap <K, V> Union(MapOrMMap <K, V> other, bool replaceWithValuesFromOther)
        {
            var set    = _set.CloneFreeze();
            int count2 = _count + set.UnionWith(other._set, Comparer, replaceWithValuesFromOther);

            return(new MMap <K, V>(set, _keyComparer, count2));
        }
Example #4
0
File: Map.cs Project: bel-uwa/Loyc
        /// <summary>Duplicates the current map and then modifies it so that it
        /// contains only keys that are present either in the current map or in
        /// the specified other map, but not both.</summary>
        public Map <K, V> Xor(MapOrMMap <K, V> other)
        {
            Debug.Assert(_set.IsRootFrozen);
            var set    = _set;
            int count2 = _count + set.SymmetricExceptWith(other._set, Comparer);

            return(new Map <K, V>(set, _keyComparer, count2));
        }
Example #5
0
File: Map.cs Project: bel-uwa/Loyc
        /// <summary>Returns a copy of the current map with all keys removed from
        /// this map that are not present in the other map. The <see cref="Values"/>
        /// in 'other' are ignored.</summary>
        public Map <K, V> Intersect(MapOrMMap <K, V> other)
        {
            Debug.Assert(_set.IsRootFrozen);
            var set    = _set;
            int count2 = _count - set.IntersectWith(other._set, other.Comparer);

            return(new Map <K, V>(set, _keyComparer, count2));
        }
Example #6
0
File: Map.cs Project: bel-uwa/Loyc
        /// <summary>Returns a copy of the current map with the specified items added.</summary>
        /// <param name="replaceWithValuesFromOther">When a key is present in both maps,
        /// the values from 'other' replace the values in the current map. If this is
        /// false, the values in this map are not replaced.</param>
        public Map <K, V> Union(MapOrMMap <K, V> other, bool replaceWithValuesFromOther)
        {
            Debug.Assert(_set.IsRootFrozen);
            var set    = _set;
            int count2 = _count + set.UnionWith(other._set, Comparer, replaceWithValuesFromOther);

            return(new Map <K, V>(set, _keyComparer, count2));
        }
Example #7
0
File: Map.cs Project: bel-uwa/Loyc
 /// <summary>Returns a copy of the current map with the specified items
 /// added; each item is added only if the key is not already present.</summary>
 public Map <K, V> Union(MapOrMMap <K, V> other)
 {
     return(Union(other, false));
 }