コード例 #1
0
 public EnumerableSurrogate(ReferenceMultiRankMap <KeyType, ValueType> map, bool forward, bool robust, bool startKeyed, KeyType startKey)
 {
     this.map        = map;
     this.forward    = forward;
     this.robust     = robust;
     this.startKeyed = startKeyed;
     this.startKey   = startKey;
 }
コード例 #2
0
        public void ConditionalSetOrRemove(KeyType key, UpdatePredicate <KeyType, ValueType> predicate)
        {
            if (predicate == null)
            {
                throw new ArgumentNullException();
            }

            ValueType value;
            bool      resident = TryGetValue(key, out value);

            uint version = inner.version;
            ReferenceMultiRankMap <KeyType, ValueType> savedInner = inner;

            inner         = new ReferenceMultiRankMap <KeyType, ValueType>();
            inner.version = savedInner.version;

            bool remove = predicate(key, ref value, resident);

            savedInner.version = inner.version;
            inner = savedInner;
            if (version != inner.version)
            {
                throw new InvalidOperationException();
            }

            if (resident)
            {
                if (remove)
                {
                    bool f = TryRemove(key);
                    Debug.Assert(f);
                }
                else
                {
                    bool f = TrySetValue(key, value);
                    Debug.Assert(f);
                }
            }
        }
コード例 #3
0
 public ReferenceMultiRankMap(ReferenceMultiRankMap <KeyType, ValueType> original)
 {
     items.AddRange(original.items);
 }
コード例 #4
0
 public ReferenceRankMap(ReferenceRankMap <KeyType, ValueType> original)
 {
     inner = new ReferenceMultiRankMap <KeyType, ValueType>(original.inner);
 }