Exemplo n.º 1
0
 public void CloneIsEqual()
 {
     var l = new PtrLenList();
     l.TryInclude(0, 1);
     l.TryInclude(10, 11);
     var l2 = l.Clone();
     Assert.AreEqual("0-1;10-21", Str(l2));
     Assert.AreEqual("0-1;10-21", Str(l));
 }
Exemplo n.º 2
0
        public PtrLenList MergeIntoNew(PtrLenList mergeWith)
        {
            if (mergeWith == null || mergeWith.Empty)
            {
                return(Clone());
            }
            if (Empty)
            {
                return(mergeWith.Clone());
            }

            // TODO: optimize this
            var result = Clone();

            foreach (var range in mergeWith)
            {
                result.TryInclude(range.Key, range.Value);
            }
            return(result);
        }
Exemplo n.º 3
0
        public PtrLenList MergeIntoNew(PtrLenList mergeWith)
        {
            if (mergeWith == null || mergeWith.Empty) return Clone();
            if (Empty) return mergeWith.Clone();

            // TODO: optimize this
            var result = Clone();
            foreach (var range in mergeWith)
            {
                result.TryInclude(range.Key, range.Value);
            }
            return result;
        }
Exemplo n.º 4
0
 public void EmptyCloneIsEmpty()
 {
     var l = new PtrLenList();
     var l2 = l.Clone();
     Assert.IsTrue(l2.Empty);
 }