public bool Remove(T item)
        {
            bool res;

            _Letter = _Letter.Remove(item, out res);
            return(res);
        }
        public bool Add(T item)
        {
            bool res;

            _Letter = _Letter.Add(item, out res);
            return(res);
        }
        public void SymmetricExceptWith(IEnumerable <T> other)
        {
            var otherHashSet = new HashSet <T>(other);
            var first        = _Letter.Where(n => !otherHashSet.Contains(n));
            var second       = otherHashSet.Where(n => !_Letter.Contains(n));

            _Letter = LetterSimpleSetFactoryBuilder.Factory.GetDefault(first.Concat(second));
        }
Esempio n. 4
0
        public HybridSetTest()
        {
            _Enumerable = Substitute.For <IEnumerable <string> >();
            _LetterSimpleSetSubstitute = Substitute.For <ILetterSimpleSet <string> >();
            _LetterSimpleSetFactory    = Substitute.For <ILetterSimpleSetFactory>();
            _LetterSimpleSetFactory.GetDefault <string>().Returns(_LetterSimpleSetSubstitute);
            _LetterSimpleSetFactory.GetDefault <string>(Arg.Any <string>()).Returns(_LetterSimpleSetSubstitute);
            _LetterSimpleSetFactory.GetDefault <string>(Arg.Any <IEnumerable <string> >()).Returns(arg =>
            {
                _GetDefaultParameter = ((IEnumerable <string>)arg[0]).ToList();
                return(_LetterSimpleSetSubstitute);
            });

            bool res;

            _LetterSimpleSetSubstitute.Add(Arg.Any <string>(), out res).Returns(_LetterSimpleSetSubstitute);

            _Factory = LetterSimpleSetFactoryBuilder.Factory;
            LetterSimpleSetFactoryBuilder.Factory = _LetterSimpleSetFactory;
        }
        public void ExceptWith(IEnumerable <T> other)
        {
            var otherHashSet = new HashSet <T>(other);

            _Letter = LetterSimpleSetFactoryBuilder.Factory.GetDefault(_Letter.Where(n => !otherHashSet.Contains(n)));
        }
 public void IntersectWith(IEnumerable <T> other)
 {
     _Letter = LetterSimpleSetFactoryBuilder.Factory.GetDefault(other.Where(_Letter.Contains));
 }
 public HybridSet(IEnumerable <T> items)
 {
     _Letter = Factory.GetDefault(items);
 }
 public HybridSet(T firstitem)
 {
     _Letter = Factory.GetDefault(firstitem);
 }
 public HybridSet()
 {
     _Letter = Factory.GetDefault <T>();
 }
Esempio n. 10
0
 public void Clear()
 {
     _Letter = Factory.GetDefault <T>();
 }
Esempio n. 11
0
        public ILetterSimpleSet <T> OnRemove <T>(SimpleHashSet <T> current)
        {
            ILetterSimpleSet <T> listSet = current;

            return((current.Count == _MaxList - 1) ? new ListSet <T>(this, current, _MaxList) : listSet);
        }
Esempio n. 12
0
 public ILetterSimpleSet <T> OnAdd <T>(ILetterSimpleSet <T> current)
 {
     return((current.Count == _MaxList) ? new SimpleHashSet <T>(this, current) : current);
 }