Пример #1
0
            public void set(OutPortId id, string s)
            {
                bool alreadyThere = keys.Contains(id.ToString());

                int keySize = names.Keys.Count;

                if (names.ContainsKey(id) && !namesghost.ContainsKey(id.ToString()))
                {
                    throw new Exception();
                }

                names[id] = s;
                namesghost[id.ToString()] = s;

                if (names.Keys.Count != namesghost.Keys.Count)
                {
                    throw new Exception();
                }

                if (alreadyThere && keySize < names.Keys.Count)
                {
                    throw new Exception();
                }

                keys.Add(id.ToString());
            }
Пример #2
0
            public override bool Equals(object obj)
            {
                OutPortId other  = obj as OutPortId;
                bool      retval = true;

                if (other == null)
                {
                    retval = false;
                }
                else if (this.i != other.i)
                {
                    retval = false;
                }
                else if (this.list.Count != other.list.Count)
                {
                    retval = false;
                }
                else
                {
                    for (int c = 0; c < this.list.Count; c++)
                    {
                        if (this.list[c] != other.list[c])
                        {
                            retval = false;
                            break;
                        }
                    }
                }

                string s1 = this.ToString();
                string s2 = other.ToString();

                if (retval == true && this.GetHashCode() != other.GetHashCode())
                {
                    throw new Exception();
                }
                if (retval == false && s1.Equals(s2))
                {
                    throw new Exception();
                }
                if (retval == true && !s1.Equals(s2))
                {
                    throw new Exception();
                }

                return(retval);
            }
Пример #3
0
            public void set(OutPortId id, string s)
            {
                bool alreadyThere = keys.Contains(id.ToString());

                int keySize = names.Keys.Count;

                if (names.ContainsKey(id) && !namesghost.ContainsKey(id.ToString()))
                    throw new Exception();

                names[id] = s;
                namesghost[id.ToString()] = s;

                if (names.Keys.Count != namesghost.Keys.Count)
                    throw new Exception();

                if (alreadyThere && keySize < names.Keys.Count)
                    throw new Exception();

                keys.Add(id.ToString());

            }