Exemple #1
0
        public virtual Boolean TryAdd([NotNull] TKey key, [NotNull] TValue value)
        {
            if (key is null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (ContainsKey(key) || ContainsValue(value))
            {
                return(false);
            }

            Boolean added = Base.TryAdd(key, value);

            if (added ^ Reversed.TryAdd(value, key))
            {
                throw new CollectionSyncException();
            }

            return(added);
        }
Exemple #2
0
        public virtual void Add([NotNull] TKey key, [NotNull] TValue value)
        {
            if (key is null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (ContainsKey(key))
            {
                throw new ArgumentException(@"Already exists", nameof(key));
            }

            if (ContainsValue(value))
            {
                throw new ArgumentException(@"Already exists", nameof(value));
            }

            Base.Add(key, value);
            Reversed.Add(value, key);
        }
Exemple #3
0
        public virtual TValue this[[NotNull] TKey key]
        {
            get
            {
                return(Base[key]);
            }
            set
            {
                if (key is null)
                {
                    throw new ArgumentNullException(nameof(key));
                }

                if (value is null)
                {
                    throw new ArgumentNullException(nameof(value));
                }

                Boolean valueRemoved = Reversed.Remove(value, out TKey rKey);
                Boolean keyRemoved   = Base.Remove(key, out TValue rValue);
                if (valueRemoved)
                {
                    Base.Remove(rKey);
                }
                if (keyRemoved)
                {
                    Reversed.Remove(rValue);
                }

                Base[key]       = value;
                Reversed[value] = key;
            }
        }
Exemple #4
0
        public override int GetHashCode()
        {
            unchecked {
                int hash = 17;
                hash = hash * 23 + Status.GetHashCode();
                hash = hash * 23 + Amount.GetHashCode();
                hash = hash * 23 + Currency.GetHashCode();
                hash = hash * 23 + Description.GetHashCode();
                hash = hash * 23 + Capture.GetHashCode();
                hash = hash * 23 + Authorized.GetHashCode();
                hash = hash * 23 + Reversed.GetHashCode();
                hash = hash * 23 + Paid.GetHashCode();
                hash = hash * 23 + Transaction.GetHashCode();
                hash = hash * 23 + Card.GetHashCode();
                hash = hash * 23 + Refunded.GetHashCode();
                hash = hash * 23 + Refunds.GetHashCode();
                hash = hash * 23 + FailureCode.GetHashCode();
                hash = hash * 23 + FailureMessage.GetHashCode();
                hash = hash * 23 + Customer.GetHashCode();
                hash = hash * 23 + IP.GetHashCode();
                hash = hash * 23 + Dispute.GetHashCode();
                hash = hash * 23 + ReturnURI.GetHashCode();
                hash = hash * 23 + AuthorizeURI.GetHashCode();

                return(hash);
            }
        }
Exemple #5
0
 public override void Serialize(XmlDocument document, XmlElement localRoot)
 {
     localRoot.SetAttribute("id", Data.ShortName);
     if (Data.HouseWall)
     {
         localRoot.SetAttribute("reversed", Reversed.ToString().ToLower());
     }
 }
Exemple #6
0
        public ImmutableMap <TKey, TValue> SetItems([NotNull] IEnumerable <KeyValuePair <TKey, TValue> > items)
        {
            if (items is null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            items = items.Materialize();

            return(new ImmutableMap <TKey, TValue>(Base.SetItems(items), Reversed.SetItems(items.ReversePairs())));
        }
Exemple #7
0
        public ImmutableMap <TKey, TValue> AddRange([NotNull] IEnumerable <KeyValuePair <TKey, TValue> > pairs)
        {
            if (pairs is null)
            {
                throw new ArgumentNullException(nameof(pairs));
            }

            pairs = pairs.Materialize();

            return(new ImmutableMap <TKey, TValue>(Base.AddRange(pairs), Reversed.AddRange(pairs.ReversePairs())));
        }
Exemple #8
0
        public Boolean Contains([NotNull] TKey key, [NotNull] TValue value)
        {
            if (key is null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            return(Base.TryGetValue(key, out TValue bvalue) && Reversed.TryGetValue(value, out TKey rvalue) && bvalue.Equals(value) && rvalue.Equals(key));
        }
Exemple #9
0
            public bool Equals(Reversed other)
            {
                if (ReferenceEquals(null, other))
                {
                    return(false);
                }

                if (ReferenceEquals(this, other))
                {
                    return(true);
                }

                return(Equals(Node, other.Node) && Count == other.Count);
            }
Exemple #10
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                if (__isset.startRow)
                {
                    hashcode = (hashcode * 397) + StartRow.GetHashCode();
                }
                if (__isset.stopRow)
                {
                    hashcode = (hashcode * 397) + StopRow.GetHashCode();
                }
                if (__isset.timestamp)
                {
                    hashcode = (hashcode * 397) + Timestamp.GetHashCode();
                }
                if (__isset.columns)
                {
                    hashcode = (hashcode * 397) + TCollections.GetHashCode(Columns);
                }
                if (__isset.caching)
                {
                    hashcode = (hashcode * 397) + Caching.GetHashCode();
                }
                if (__isset.filterString)
                {
                    hashcode = (hashcode * 397) + FilterString.GetHashCode();
                }
                if (__isset.batchSize)
                {
                    hashcode = (hashcode * 397) + BatchSize.GetHashCode();
                }
                if (__isset.sortColumns)
                {
                    hashcode = (hashcode * 397) + SortColumns.GetHashCode();
                }
                if (__isset.reversed)
                {
                    hashcode = (hashcode * 397) + Reversed.GetHashCode();
                }
                if (__isset.cacheBlocks)
                {
                    hashcode = (hashcode * 397) + CacheBlocks.GetHashCode();
                }
            }
            return(hashcode);
        }
Exemple #11
0
        public virtual Boolean Remove([NotNull] TKey key, [NotNull] TValue value)
        {
            if (!Contains(key, value))
            {
                return(false);
            }

            Boolean removed = Base.Remove(key);

            if (removed ^ Reversed.Remove(value))
            {
                throw new CollectionSyncException();
            }

            return(removed);
        }
Exemple #12
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                if ((Start != null))
                {
                    hashcode = (hashcode * 397) + Start.GetHashCode();
                }
                if ((Finish != null))
                {
                    hashcode = (hashcode * 397) + Finish.GetHashCode();
                }
                hashcode = (hashcode * 397) + Reversed.GetHashCode();
                hashcode = (hashcode * 397) + Count.GetHashCode();
            }
            return(hashcode);
        }
Exemple #13
0
        public override string ToString()
        {
            var sb = new StringBuilder("SliceRange(");

            if ((Start != null))
            {
                sb.Append(", Start: ");
                Start.ToString(sb);
            }
            if ((Finish != null))
            {
                sb.Append(", Finish: ");
                Finish.ToString(sb);
            }
            sb.Append(", Reversed: ");
            Reversed.ToString(sb);
            sb.Append(", Count: ");
            Count.ToString(sb);
            sb.Append(')');
            return(sb.ToString());
        }
Exemple #14
0
 public IEnumerator <KeyValuePair <TValue, TKey> > GetValuesEnumerator()
 {
     return(Reversed.GetEnumerator());
 }
Exemple #15
0
        public override int GetHashCode()
        {
            unchecked {
                int hash = 17;
                if (Status != default(ChargeStatus))
                {
                    hash = hash * 23 + Status.GetHashCode();
                }
                if (Amount != default(long))
                {
                    hash = hash * 23 + Amount.GetHashCode();
                }
                if (Currency != default(string))
                {
                    hash = hash * 23 + Currency.GetHashCode();
                }
                if (Description != default(string))
                {
                    hash = hash * 23 + Description.GetHashCode();
                }
                if (Metadata != default(IDictionary <string, object>))
                {
                    hash = hash * 23 + Metadata.GetHashCode();
                }
                if (Capture != default(bool))
                {
                    hash = hash * 23 + Capture.GetHashCode();
                }
                if (Authorized != default(bool))
                {
                    hash = hash * 23 + Authorized.GetHashCode();
                }
                if (Reversed != default(bool))
                {
                    hash = hash * 23 + Reversed.GetHashCode();
                }
                if (Paid != default(bool))
                {
                    hash = hash * 23 + Paid.GetHashCode();
                }
                if (Transaction != default(string))
                {
                    hash = hash * 23 + Transaction.GetHashCode();
                }
                if (SourceOfFund != default(SourceOfFunds))
                {
                    hash = hash * 23 + SourceOfFund.GetHashCode();
                }
                if (Card != default(Card))
                {
                    hash = hash * 23 + Card.GetHashCode();
                }
                if (Refunded != default(long))
                {
                    hash = hash * 23 + Refunded.GetHashCode();
                }
                if (Refunds != default(ScopedList <Refund>))
                {
                    hash = hash * 23 + Refunds.GetHashCode();
                }
                if (FailureCode != default(string))
                {
                    hash = hash * 23 + FailureCode.GetHashCode();
                }
                if (FailureMessage != default(string))
                {
                    hash = hash * 23 + FailureMessage.GetHashCode();
                }
                if (Customer != default(string))
                {
                    hash = hash * 23 + Customer.GetHashCode();
                }
                if (IP != default(string))
                {
                    hash = hash * 23 + IP.GetHashCode();
                }
                if (Dispute != default(Dispute))
                {
                    hash = hash * 23 + Dispute.GetHashCode();
                }
                if (ReturnURI != default(string))
                {
                    hash = hash * 23 + ReturnURI.GetHashCode();
                }
                if (AuthorizeURI != default(string))
                {
                    hash = hash * 23 + AuthorizeURI.GetHashCode();
                }
                if (Offsite != default(OffsiteTypes))
                {
                    hash = hash * 23 + Offsite.GetHashCode();
                }
                if (InstallmentTerms != default(int))
                {
                    hash = hash * 23 + InstallmentTerms.GetHashCode();
                }

                return(hash);
            }
        }
Exemple #16
0
 public void CopyTo(KeyValuePair <TValue, TKey>[] array, Int32 index)
 {
     Reversed.CopyTo(array, index);
 }
Exemple #17
0
 public virtual void Clear()
 {
     Base.Clear();
     Reversed.Clear();
 }
 public bool Equals(Reversed other)
 {
     return(_collection == other._collection &&
            _count == other._count);
 }
Exemple #19
0
 public Boolean TryGetKey([NotNull] TValue key, out TKey value)
 {
     return(Reversed.TryGetValue(key, out value));
 }
Exemple #20
0
 public Boolean ContainsValue([NotNull] TValue value)
 {
     return(Reversed.ContainsKey(value));
 }
Exemple #21
0
 /// <inheritdoc/>
 public bool Equals(Reversed other) => _list.Equals(other._list);
 public bool Equals(Reversed other)
 {
     return(_node == other._node &&
            _count == other._count);
 }
 public void Reverse() => Reversed.Toggle();
Exemple #24
0
    public void Calibrate()
    {
        GameObject DataManager = GameObject.Find("DataManager");
        int        Cal_x, Cal_y, Cal_z;
        bool       Reversed;

        if (DataManager != null)
        {
            Cal_x    = DataManager.GetComponent <DataManager>().cal_x;
            Cal_y    = DataManager.GetComponent <DataManager>().cal_y;
            Cal_z    = DataManager.GetComponent <DataManager>().cal_z;
            Reversed = DataManager.GetComponent <DataManager>().XZ_Reversed;
        }
        else
        {
            Cal_x    = 1;
            Cal_y    = 1;
            Cal_z    = 1;
            Reversed = false;
        }
        string msg = "CAL|" + Cal_x.ToString() + '%' + Cal_y.ToString() + '%' + Cal_z.ToString() + '%' + Reversed.ToString() + '%' + '|';

        Send(msg, ReliableChannel, clients);
    }
Exemple #25
0
 public KeyValuePair <TValue, TKey> GetValueKeyPairByIndex(Int32 index)
 {
     return(Reversed.GetPair(GetValueByIndex(index)));
 }
Exemple #26
0
 public Boolean TryGetValueKeyPairByIndex(Int32 index, out KeyValuePair <TValue, TKey> pair)
 {
     return(Reversed.TryGetPair(GetValueByIndex(index), out pair));
 }
 public bool Equals(Reversed other)
 {
     return(this.node == other.node &&
            this.count == other.count);
 }
 public bool Equals(Reversed other)
 {
     return(_chain.Equals(other._chain));
 }
Exemple #29
0
 public bool Equals(Reversed other)
 {
     return(_list.Equals(other._list));
 }
Exemple #30
0
 public bool Equals(Reversed other)
 {
     return(this.list.Equals(other.list));
 }